Commit Graph

58 Commits

Author SHA1 Message Date
Javi Martín
95d395343b Use two puma workers
This is the same configuration we had with unicorn.

With several workers, we've got two basic configuration options:

* Preload the application and use a hot restart
* Don't preload the application and use a phased restart

I've decided to preload the application because using a hot restart
changes are available immediately, while with a phased restart there are
a few seconds when both workers for the old code and workers for the new
code exist.

Using a phased restart also has advantages, so some forks might want to
disable the `puma_preload_app` setting in order to use it.
2019-11-12 15:32:04 +01:00
Javi Martín
d17b2523cf Make puma restarts work with systemd
Just like mentioned in puma's documentation:

https://github.com/puma/puma/blob/master/docs/systemd.md#socket-activation
2019-11-12 15:32:04 +01:00
Javi Martín
d7aab4c929 Check permissions for secrets file
Old versions of the installer created this file as root, making it
impossible to change it as a regular user.

So for old installations we need to make sure we've got write access to
this file.

We're using `sudo` because in these applications the installer gives
`sudo` access to the deploy user, so everything works fine with the
default configuration.
2019-11-12 14:58:35 +01:00
Javi Martín
a08d42d3f8 Enable/disable delayed jobs in the secrets file
While this is not a secret and in theory should be in a file under
version control, currently the CONSUL installer disables delayed jobs by
default, meaning we were keeping two versions of the delayed jobs
configuration file, and some existing configurations have their settings
defined in a file in capistrano's `shared` folder.

So we're moving existing settings to the secrets file.
2019-11-12 14:58:35 +01:00
Javi Martín
6ecd9e59dc Update secrets based on the previous release
We were copying the current SMTP and SSL settings to the secrets file
after overwriting them, but we need to copy them before overwriting
them.

The workaround I've found is to copy the tasks to the folder of the
previous release and execute them there.
2019-11-12 14:58:06 +01:00
Julian Herrero
d6130cf6e2 Add task to move force_ssl settings to secrets.yml
Existing installations having their configuration settings in the
capistrano shared folder needed this migration.
2019-11-12 14:58:05 +01:00
Javi Martín
03c4275525 Add task to move SMTP settings to secrets.yml
Existing installations having their configuration settings in the
capistrano shared folder needed this migration.

Note we can't just use `YAML.load` because we'd lose the anchors defined
in the file. So we have to parse the file the hard way.
2019-11-12 14:47:27 +01:00
Javi Martín
bc9471b49e Define SMTP configuration in the secrets file
Since SMTP passwords should not be in a file under version control, and
they're usually configured in the production.rb file (which is under
version control), the natural place to configure it is the secrets.yml
file.

Until now we were using the capistrano shared folder, but that's a bit
inconvenient since changes we've done to the production.rb file (like
changing eager_load_paths when we upgraded to Rails 5) won't take effect
after a deployment.
2019-11-11 12:11:20 +01:00
Senén Rodero Rodríguez
15b4ff64f4 Run local census records remove_duplicates rake task during deployment
... and before applying new migrations.
2019-11-08 14:46:45 +01:00
Javi Martín
41d252bf10 Simplify syntax to execute RMV
We use `:rvm` just as we use `:rake` in other places.
2019-10-13 00:31:13 +02:00
Javi Martín
48dd4be851 Use .ruby-version to detect our Ruby version
Travis and Rubocop and rmv1-capistrano3 automatically detect the version
based on the `.ruby-version` file.
2019-10-13 00:31:13 +02:00
Javi Martín
19f8e3ac8e Enable tasks to install Ruby and bundler
We're going to upgrade our ruby version, and we need these tasks.

Note we now get a warning caused by `rvm1:install:ruby` invoking
`deploy:updating`. It doesn't seem to be an issue because we don't add
any hooks to `deploy:updating`, and neither do the rest of the gems we
use.
2019-10-13 00:28:33 +02:00
Javi Martín
f26f8b3c3e Add support for legacy unicorn installations
Old CONSUL nginx configurations will probably have a reference to a
unicorn socket. Making that file a symbolic link to a puma socket makes
it possible for the application to keep working without updating the
nginx configuration file.
2019-10-12 17:01:15 +02:00
Javi Martín
3b79a1a3db Add compatibility between puma and RMV1
Puma was adding commands to `rvm_map_bins`, which meant RMV1 wasn't
using the default value of `rvm1_map_bins`.

Changing the order we use to require `rmv1/capistrano3` and
`capistrano/puma` did not fix the issue.
2019-10-12 16:51:28 +02:00
Javi Martín
b36e659f4e Use puma instead of unicorn
Puma is the server we use in the development environment, so this way we
don't need to maintain two servers. Furthermore, puma seems to offer a
few advantages over unicorn (like multithreading) and no disadvantages.
2019-10-12 16:50:49 +02:00
Javi Martín
488461b8ac Remove consecutive blank lines 2019-09-10 20:02:15 +02:00
Javi Martín
b5b07bccd3 Apply PercentLiteralDelimiters rubocop rule 2019-09-10 20:02:15 +02:00
Javi Martín
d2c075cc93 Add new settings on servers with the db role
This task adds records to the database, so the role `db` is more
appropriate.
2019-06-05 20:23:56 +02:00
Javi Martín
685c96c40d Add capistrano task to deploy and upgrade CONSUL 2019-06-05 20:23:56 +02:00
Javi Martín
e339ed94d1 Add new settings every time we deploy
This way we don't need to add and execute rake tasks every time we add a
new setting.
2019-05-31 19:33:31 +02:00
Julian Nicolas Herrero
d83bf940be Merge pull request #3370 from consul/double_quoutes_everywhere
Change single quotes to double quotes everywhere
2019-03-19 12:20:16 +01:00
Julian Herrero
c9cdc72537 Use double quotes in config/ 2019-03-15 10:29:07 +01:00
Julian Herrero
63182569f4 Keep images uploaded with CKEditor when deploying
Images uploaded with CKEditor go to a folder that was not linked, so
every new deploy with capistrano the reference to those images was
lost.

By linking the directory the references to the images remain after a
new deploy.
2019-03-14 15:57:26 +01:00
voodoorai2000
bebcc3da48 Skip ruby and bundler installations
Ruby and bundler should already be installed in the system

Before we can bring back these commands we need to review them, right now they are raising an interesting exception
2018-09-21 15:31:40 +02:00
voodoorai2000
335cd2b597 Link unicorn and production.rb to capistrano's shared folder 2018-09-21 15:29:57 +02:00
Bertocq
0ecfbfe55c Fix capistrano version lock on deploy.rb script to same on Gemfile 2018-01-07 12:51:42 +01:00
Juanjo Bazán
ab2391b78d adds sitemap updating task to deploy 2017-06-06 12:25:45 +02:00
Juanjo Bazán
29e5cff13f updates capistrano 2017-05-01 12:20:52 +02:00
kikito
1d456b0459 updates capistrano to match the Gemfile 2017-04-04 13:20:45 +02:00
Juanjo Bazán
2d3e3586d1 updates capistrano scm config 2017-03-14 13:30:31 +01:00
rgarcia
d0b0782c46 sets only one server to run delayed jobs 2016-12-28 21:24:56 +01:00
rgarcia
5d6c083f67 updates sitemap daily in all servers 2016-12-04 19:57:10 +01:00
rgarcia
cea90fea47 installs bundler gem for new ruby versions 2016-11-21 10:15:57 +01:00
rgarcia
d24ef1615f cleans up deploy.rb 2016-11-21 10:15:51 +01:00
rgarcia
c8c5b55816 updates ruby version for capistrano 2016-11-21 10:15:44 +01:00
rgarcia
a1095089af configures up to date capistrano rvm gem 2016-11-21 10:15:34 +01:00
Juanjo Bazán
f91385873a updates ruby version in deploy.rb to 2.3.1 2016-07-12 11:21:15 +02:00
Juanjo Bazán
575d9a1998 updates capistrano 2016-07-11 14:21:54 +02:00
kikito
62745136db Fixes capistrano setup mismatch 2016-04-25 15:14:44 +02:00
Juanjo Bazán
b946f31fc7 changes 'participacion' to 'consul' in config 2015-11-23 14:10:46 +01:00
Juanjo Bazán
7a5454da68 updates consul url 2015-11-20 20:09:24 +01:00
Juanjo Bazán
1e0ac137bb removes beta testers functionality 2015-10-29 13:19:00 +01:00
kikito
1e59d3259a removes unnecessary whenever setup 2015-09-12 09:01:16 +02:00
kikito
05bfaa5c30 move whenever require to Capfile 2015-09-12 08:56:47 +02:00
kikito
054f3b94e5 uses -> instead of refer 2015-09-11 17:32:10 +02:00
kikito
44b5ea6018 first try at integrating whenever and capistrano 2015-09-11 14:23:41 +02:00
kikito
1a855b2a90 Fixes error which prevented executing cap -T 2015-09-07 13:03:11 +02:00
rgarcia
554d58b620 comments out custom capistrano asset task 2015-09-06 17:04:25 +02:00
rgarcia
ebddcfa1d0 cleans up delayed_jobs for capistrano 2015-09-04 00:27:14 +02:00
rgarcia
feaf4465f3 adds capistrano tasks and hooks for delayed_jobs 2015-09-03 23:26:28 +02:00