Capistrano setup on MacOS Mojave

520 views
Skip to first unread message

Miroslav Schlossberg

unread,
Sep 29, 2019, 11:37:47 AM9/29/19
to alavet...@googlegroups.com
Hi everyone,
I'm trying to setup Capistrano but always hit a blocker.


To install Ruby on MacOS Mojave I have followed steps here:

Ruby 2.6.3 was installed as recommended in the gorails guide:
Installed ruby-2.6.3 to /Users/miroslav/.rbenv/versions/2.6.3

I've also installed rbenv, so Ruby versions are managed via rbenv. 

When I execute step "still on your local machine, run cap -S stage=staging deploy:setup to setup capistrano on the server" I get following error:

(base) Mac:alaveteli miroslav$ cap -S stage=staging deploy:setup

invalid option: -S


Did anybody had similar issues on MacOS? 

Cheers,
Miroslav

photo
Miroslav Schlossberg
Code for Croatia

--------------------------------------------
Q: Why is this email [hopefully] three sentences or less?

NOTE that my emails are delayed from arriving in my inbox until 5pm daily (Central European Time). If urgent, please use another way of getting in touch. #slowwebmovement

Gareth Rees

unread,
Sep 30, 2019, 11:56:28 AM9/30/19
to Alaveteli Dev
You need to use the capistrano version provided by Alaveteli, so run `bundle exec cap…`

Best,

Gareth

Miroslav Schlossberg

unread,
Sep 30, 2019, 2:06:23 PM9/30/19
to alavet...@googlegroups.com
Hi Gareth,
Thanks! I've opened GH issue as it seems that deploy guide is not mentioning part that it should be run via bundle exec.

I've hit another problem:

(base) Mac:alaveteli miroslav$ bundle exec cap -S stage=staging deploy:setup

Could not find rake-12.0.0 in any of the sources

Run `bundle install` to install missing gems.


So I've tried to do bundle install:

(base) Mac:alaveteli miroslav$ bundle install

Fetching gem metadata from https://rubygems.org/.............

Fetching https://github.com/heapsource/active_model_otp.git

Fetching https://github.com/technoweenie/acts_as_versioned.git

Fetching https://github.com/mysociety/ruby-msg.git

NOTE: Gem::Specification#has_rdoc= is deprecated with no replacement. It will be removed on or after 2018-12-01.

Gem::Specification#has_rdoc= called from /Users/miroslav/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/bundler/gems/ruby-msg-fae72e547299/ruby-msg.gemspec:24.

Fetching https://github.com/mysociety/strip_attributes.git

rails (4.2.9) has dependency bundler (>= 1.3.0, < 2.0), which is unsatisfied by the current bundler version 2.0.2, so the dependency is being ignored

Fetching rake 12.0.0

Installing rake 12.0.0

Fetching i18n 0.8.6

Installing i18n 0.8.6

Fetching minitest 5.10.3

Installing minitest 5.10.3

Fetching thread_safe 0.3.6

Installing thread_safe 0.3.6

Fetching tzinfo 1.2.3

Installing tzinfo 1.2.3

Fetching activesupport 4.2.9

Installing activesupport 4.2.9

Fetching builder 3.2.3

Installing builder 3.2.3

Fetching erubis 2.7.0

Installing erubis 2.7.0

Fetching mini_portile2 2.1.0

Installing mini_portile2 2.1.0

Fetching nokogiri 1.6.8.1

Installing nokogiri 1.6.8.1 with native extensions

Fetching rails-deprecated_sanitizer 1.0.3

Installing rails-deprecated_sanitizer 1.0.3

Fetching rails-dom-testing 1.0.8

Installing rails-dom-testing 1.0.8

Fetching loofah 2.0.3

Installing loofah 2.0.3

Fetching rails-html-sanitizer 1.0.3

Installing rails-html-sanitizer 1.0.3

Fetching actionview 4.2.9

Installing actionview 4.2.9

Fetching rack 1.6.8

Installing rack 1.6.8

Fetching rack-test 0.6.3

Installing rack-test 0.6.3

Fetching actionpack 4.2.9

Installing actionpack 4.2.9

Fetching globalid 0.4.0

Installing globalid 0.4.0

Fetching activejob 4.2.9

Installing activejob 4.2.9

Fetching mime-types 2.99.3

Installing mime-types 2.99.3

Fetching mail 2.6.6

Installing mail 2.6.6

Fetching actionmailer 4.2.9

Installing actionmailer 4.2.9

Fetching activemodel 4.2.9

Installing activemodel 4.2.9

Fetching rotp 3.3.0

Installing rotp 3.3.0

Using active_model_otp 1.2.0 from https://github.com/heapsource/active_model_otp.git (at 55d93a3@55d93a3)

Fetching arel 6.0.4

Installing arel 6.0.4

Fetching activerecord 4.2.9

Installing activerecord 4.2.9

Using acts_as_versioned 0.6.0 from https://github.com/technoweenie/acts_as_versioned.git (at 63b1fc8@63b1fc8)

Fetching addressable 2.4.0

Installing addressable 2.4.0

Fetching flipper 0.10.2

Installing flipper 0.10.2

Fetching flipper-active_record 0.10.2

Installing flipper-active_record 0.10.2

Using bundler 2.0.2

Fetching thor 0.19.4

Installing thor 0.19.4

Fetching railties 4.2.9

Installing railties 4.2.9

Fetching concurrent-ruby 1.0.5

Installing concurrent-ruby 1.0.5

Fetching sprockets 3.7.1

Installing sprockets 3.7.1

Fetching sprockets-rails 3.2.0

Installing sprockets-rails 3.2.0

Fetching rails 4.2.9

Installing rails 4.2.9

Using alaveteli_features 0.0.1 from source at `gems/alaveteli_features`

Fetching annotate 2.7.2

Installing annotate 2.7.2

Fetching debug_inspector 0.0.3

Installing debug_inspector 0.0.3 with native extensions

Fetching binding_of_caller 0.7.2

Installing binding_of_caller 0.7.2 with native extensions

Fetching sass 3.4.21

Installing sass 3.4.21

Fetching bootstrap-sass 2.3.2.2

Installing bootstrap-sass 2.3.2.2

Fetching uniform_notifier 1.10.0

Installing uniform_notifier 1.10.0

Fetching bullet 5.5.1

Installing bullet 5.5.1

Fetching cancancan 1.12.0

Installing cancancan 1.12.0

Fetching highline 1.7.8

Installing highline 1.7.8

Fetching net-ssh 2.9.4

Installing net-ssh 2.9.4

Fetching net-scp 1.2.1

Installing net-scp 1.2.1

Fetching net-sftp 2.1.2

Installing net-sftp 2.1.2

Fetching net-ssh-gateway 1.3.0

Installing net-ssh-gateway 1.3.0

Fetching capistrano 2.15.9

Installing capistrano 2.15.9

Fetching mini_mime 0.1.3

Installing mini_mime 0.1.3

Fetching xpath 2.1.0

Installing xpath 2.1.0

Fetching capybara 2.15.1

Installing capybara 2.15.1

Fetching charlock_holmes 0.7.5

Installing charlock_holmes 0.7.5 with native extensions

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.


Now I found that this is known issue on charlock_holmes:
https://github.com/brianmario/charlock_holmes/issues/117 (different setup has issue with different charlock_holmes version)

I have tried and 0.7.6 can be installed.

Is it safe that I update this gem version from 0.7.5 to 0.7.6?
If yes, what is the safest way to do it? Just by updating Gemfile (or Gemfile.lock)?
(I'm installing version 0.30.0.0)

Thanks!

Cheers,
Miroslav

photo
Miroslav Schlossberg
Code for Croatia

--------------------------------------------
Q: Why is this email [hopefully] three sentences or less?

NOTE that my emails are delayed from arriving in my inbox until 5pm daily (Central European Time). If urgent, please use another way of getting in touch. #slowwebmovement
--
You received this message because you are subscribed to the Google Groups "Alaveteli Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alaveteli-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alaveteli-dev/a5b8e869-4fc6-4355-a6fd-2088ce322126%40googlegroups.com.

Gareth Rees

unread,
Oct 1, 2019, 4:48:20 AM10/1/19
to Alaveteli Dev
Hey Miroslav,

I have tried and 0.7.6 can be installed.

We use 0.7.6 in the latest release of Alaveteli https://github.com/mysociety/alaveteli/blob/master/Gemfile.lock#L114

Is it safe that I update this gem version from 0.7.5 to 0.7.6?

Patch releases are generally a safe bet, yeah.

If yes, what is the safest way to do it? Just by updating Gemfile (or Gemfile.lock)?

You can run `bundle update charlock_holmes`. This will install the new version and update Gemfile.lock for you.
The ~> actually means "the latest patch release of 0.7.0" – Bit more detail here https://guides.rubygems.org/patterns/#pessimistic-version-constraint

I've also made a pull request to clarify the deployment docs, based on the issue you raised at https://github.com/mysociety/alaveteli/issues/5386. You could ignore needing to bundle and just install the older version of capistrano (as per https://github.com/mysociety/alaveteli/pull/5387/commits/b90efa4a6c6034f9e9c966106ee8a576098439b0) to avoid needing to install all the dependencies on your Mac. If you're going to use your Mac install for development, then might be worth getting it running, if not, then just try `gem install capistrano -v 2.15.9`.

Best
To unsubscribe from this group and stop receiving emails from it, send an email to alaveteli-dev+unsubscribe@googlegroups.com.

Graeme Porteous

unread,
Oct 1, 2019, 5:28:02 AM10/1/19
to alavet...@googlegroups.com
To install charlock_holmes 0.7.5 you'll need to install an older version of icu4c - version 53.x [1]

On macOS if you're using homebrew [2] this can be install this with:
$ brew install icu4c@53

And then install the gem with:
$ gem install charlock_holmes -v '0.7.5' -- --with-icu-dir=/usr/local/opt/icu4c@53

Next time you bundle the gem should be found.

Best,


--
Graeme Porteous
gra...@mysociety.org


Miroslav Schlossberg

unread,
Oct 1, 2019, 2:45:21 PM10/1/19
to alavet...@googlegroups.com
Hi Gareth and Graeme,
Thank you guys, that helped. I had few more unresolved gems, but I don't need them as I won't be doing development on this computer.

Now, I've setup login via ssh key for deploy user as per capistrano guidelines, and I can login from terminal as usual "ssh deploy@ip". But, after setting up alaveteli capistrano config/deploy.yml and executing "cap -S stage=production deploy:setup" (again - guidelines does not say this specifically, but I assume if I don't want to deploy staging config but production, I should use "stage=production", correct?), I'm getting following error:

(base) Mac:alaveteli miroslav$ bundle exec cap -S stage=production deploy:setup

  * executing "cat /var/www/imamopravoznati.org/alaveteli/shared/rbenv-version 2>/dev/null || true"

    servers: ["xxx.xxx.xxx.xxx"]

/Users/miroslav/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/net-ssh-2.9.4/lib/net/ssh/transport/session.rb:67: warning: Object#timeout is deprecated, use Timeout.timeout instead.

/Users/miroslav/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/net-ssh-2.9.4/lib/net/ssh/transport/session.rb:84: warning: Object#timeout is deprecated, use Timeout.timeout instead.

/Users/miroslav/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/net-ssh-2.9.4/lib/net/ssh/transport/cipher_factory.rb:98: warning: constant OpenSSL::Cipher::Cipher is deprecated

connection failed for: xxx.xxx.xxx.xxx (NoMethodError: undefined method `p=' for #<OpenSSL::PKey::DH:0x00007fcc55038a58>

Did you mean?  p)


From earlier bundle install, I see that required gem net-ssh is 2.9.4 which is as per above.

Tried with newer net-ssh but it will insist specifically to use 2.9.4:


(base) Mac:alaveteli miroslav$ bundle exec cap -S stage=production deploy:setup

Could not find net-ssh-2.9.4 in any of the sources

Run `bundle install` to install missing gems.


Cheers,
Miroslav

photo
Miroslav Schlossberg
Code for Croatia

--------------------------------------------
Q: Why is this email [hopefully] three sentences or less?

NOTE that my emails are delayed from arriving in my inbox until 5pm daily (Central European Time). If urgent, please use another way of getting in touch. #slowwebmovement

Miroslav Schlossberg

unread,
Oct 1, 2019, 3:30:34 PM10/1/19
to alavet...@googlegroups.com
Hi everyone,
Ignore last email. I managed to start it after installing new net-ssh gem version. Yay!

(base) Mac:alaveteli miroslav$ bundle exec cap -S stage=production deploy:setup

  * executing "cat /var/www/imamopravoznati.org/alaveteli/shared/rbenv-version 2>/dev/null || true"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

    command finished in 390ms

  * 2019-10-01 21:23:05 executing `deploy:setup'

  * executing "mkdir -p /var/www/imamopravoznati.org/alaveteli /var/www/imamopravoznati.org/alaveteli/releases /var/www/imamopravoznati.org/alaveteli/shared /var/www/imamopravoznati.org/alaveteli/shared/system /var/www/imamopravoznati.org/alaveteli/shared/log /var/www/imamopravoznati.org/alaveteli/shared/pids"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

    command finished in 79ms

  * executing "chmod g+w /var/www/imamopravoznati.org/alaveteli /var/www/imamopravoznati.org/alaveteli/releases /var/www/imamopravoznati.org/alaveteli/shared /var/www/imamopravoznati.org/alaveteli/shared/system /var/www/imamopravoznati.org/alaveteli/shared/log /var/www/imamopravoznati.org/alaveteli/shared/pids"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

    command finished in 81ms

    triggering after callbacks for `deploy:setup'

  * executing "mkdir -p /var/www/imamopravoznati.org/alaveteli/shared/files"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

    command finished in 89ms

  * executing "mkdir -p /var/www/imamopravoznati.org/alaveteli/shared/cache"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

    command finished in 114ms

  * executing "mkdir -p /var/www/imamopravoznati.org/alaveteli/shared/log"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

    command finished in 76ms

  * executing "mkdir -p /var/www/imamopravoznati.org/alaveteli/shared/tmp/pids"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

    command finished in 78ms

  * executing "mkdir -p /var/www/imamopravoznati.org/alaveteli/shared/xapiandbs"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

    command finished in 76ms

  * executing "mkdir -p /var/www/imamopravoznati.org/alaveteli/shared/themes"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

    command finished in 77ms



Lijep pozdrav,
Miroslav

photo
Miroslav Schlossberg
Code for Croatia

--------------------------------------------
Q: Why is this email [hopefully] three sentences or less?

NOTE that my emails are delayed from arriving in my inbox until 5pm daily (Central European Time). If urgent, please use another way of getting in touch. #slowwebmovement

Gareth Rees

unread,
Oct 2, 2019, 4:36:23 AM10/2/19
to Alaveteli Dev
Excellent news! Great work!

Best,

Gareth

Miroslav Schlossberg

unread,
Oct 3, 2019, 3:22:31 PM10/3/19
to alavet...@googlegroups.com
Hi guys,
When making deploy update (initial, as per instructions), I got some lines with "err :: IP" - is this expected or some error?
How to troubleshoot this?

Example of err deployment output in terminal:

*** [err :: xxx.xxx.xxx.xxx] I, [2019-10-02T19:02:45.040221 #88422]  INFO -- : Writing /var/www/imamopravoznati.org/alaveteli/releases/20191002185052/public/assets/favicon-3e06c6d6cb34168fb0342ef3186f733b2c7d1c44422d1136013ad3cca6c4694f.ico


and on last line:

 ** transaction: commit

  * 2019-10-02 21:07:29 executing `deploy:restart'

  * executing "/etc/init.d/alaveteli restart"

    servers: ["xxx.xxx.xxx.xxx"]

    [xxx.xxx.xxx.xxx] executing command

*** [err :: xxx.xxx.xxx.xxx] su: must be run from a terminal

    command finished in 77ms

failed: "sh -c '/etc/init.d/alaveteli restart'" on xxx.xxx.xxx.xxx



So it looks app cant be started. Also tried grepping ps aux for 3000 and nothing is up.


Cheers,
Miroslav

photo
Miroslav Schlossberg
Code for Croatia

--------------------------------------------
Q: Why is this email [hopefully] three sentences or less?

NOTE that my emails are delayed from arriving in my inbox until 5pm daily (Central European Time). If urgent, please use another way of getting in touch. #slowwebmovement

--
You received this message because you are subscribed to the Google Groups "Alaveteli Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alaveteli-de...@googlegroups.com.

Gareth Rees

unread,
Oct 10, 2019, 4:20:29 AM10/10/19
to Alaveteli Dev
Looks like the permissions aren't allowing you to restart via the init.d service.

The `user` in your `config/deploy.yml` will need to have +x permissions on `/etc/init.d/alaveteli`.

In our manual install guide, we recommend they get set to 754 [1].

This allows users in the `alaveteli` group to execute the file (which is owned by root).

Does that look like the setup you've got?

To unsubscribe from this group and stop receiving emails from it, send an email to alaveteli-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages