README.md in prun-ops-0.2.18 vs README.md in prun-ops-0.3.0
- old
+ new
@@ -33,25 +33,30 @@
Capfile should include these requirements:
```ruby
require 'capistrano/setup'
require 'capistrano/deploy'
+require "capistrano/rvm"
require 'capistrano/rails'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
+require "capistrano/puma"
+install_plugin Capistrano::Puma # Default puma tasks
+install_plugin Capistrano::Puma::Systemd
require "#{File.dirname(__FILE__)}/config/application"
require 'capistrano/prun-ops'
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
+Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
```
Notice that you are adding all prun-ops tasks with the line `require 'capistrano/prun-ops'`
Your config/deploy/production.rb:
```
-server "example.com", user: 'root', roles: %w{web app db}, port: 2222
+server "example.com", user: 'root', roles: %w{web app db} # , port: 2222
```
Note: Remember change this line in production.rb file: `config.assets.compile = true`
If you are accessing your server through a bastion you can define it:
@@ -62,50 +67,60 @@
### Configuration
Main task is `cap [stg] config`
-Secondary tasks:
+Secondary tasks:
-* `cap [stg] ubuntu:install` initial ubuntu dependencies
-* `cap [stg] ruby:install` install ruby on .ruby-version version
-* `cap [stg] rails:prepare` install rails dependencies
-* `cap [stg] postgres:install` install and configure postgres
-* `cap [stg] postgres:[start|stop|restart]` start/stop postgres
-* `cap [stg] nginx:install` install and configure nginx
-* `cap [stg] nginx:[start|stop|restart]` start/stop nginx
-* `cap [stg] nodejs:install` install node
-* `cap [stg] app:prepare` create init scripts
-* `cap [stg] app:db_prepare` database first load
-* `cap [stg] nginx:cert` create SSL certificates with [Let's Encrypt](https://letsencrypt.org/)
-* `cap [stg] nginx:ssl` configure nginx with SSL certificates
+- `cap [stg] ubuntu:prepare` initial ubuntu dependencies
+- `cap [stg] ruby:brightbox`(DEPRECATED) install ruby on .ruby-version version from brightbox
+- `cap [stg] ruby:rvm` install ruby version manager
+- `cap [stg] ruby:install_rvm_project_version` installs ruby version in .ruby-version file of the project
+- `cap [stg] rails:prepare` install rails dependencies
+- `cap [stg] postgres:install` install and configure postgres
+- `cap [stg] postgres:[start|stop|restart]` start/stop postgres
+- `cap [stg] nginx:install` install and configure nginx
+- `cap [stg] nginx:[start|stop|restart]` start/stop nginx
+- `cap [stg] nodejs:install` install node
+- `cap [stg] redis:install` install redis server
+- `cap [stg] app:prepare`(DEPRECATED) create init scripts
+- `cap [stg] app:db_prepare`(DEPRECATED) database first load
+- `cap [stg] nginx:cert` create SSL certificates with [Let's Encrypt](https://letsencrypt.org/)
+- `cap [stg] nginx:ssl` configure nginx with SSL certificates
+Considerations:
+-
### Deployment
Main task is `cap [stg] deploy`
-Secondary tasks:
+Secondary tasks:
-* `cap [stg] deploy:upload_linked_files` uploads configuration files defined as linked_files
-* `cap [stg] deploy` deploy your app as usual
-* `cap [stg] deploy:restart` restart thin server of this application
-* `cap [stg] deploy:stop` stop thin server
-* `cap [stg] deploy:start` start thin server
-* `cap [stg] deploy:db_create` create database
-* `cap [stg] deploy:db_reset` load schema and seeds for first DB setup
-* `cap [stg] deploy:db_seed` seeds the database
-* `cap [stg] git:remove_repo` Removes repo (useful when repo_url changes)
+- `cap [stg] deploy:upload_linked_files` uploads configuration files defined as linked_files
+- `cap [stg] deploy` deploy your app as usual
+- `cap [stg] deploy:restart` restart thin server of this application
+- `cap [stg] deploy:stop` stop thin server
+- `cap [stg] deploy:start` start thin server
+- `cap [stg] deploy:db_create` create database
+- `cap [stg] deploy:db_reset` load schema and seeds for first DB setup
+- `cap [stg] deploy:db_seed` seeds the database
+- `cap [stg] git:remove_repo` Removes repo (useful when repo_url changes)
Added the possibility of deploying from local repository. Add to `deploy.rb` or `[stg].rb` files:
```
before :deploy, "git:deploy_from_local_repo"
```
Take care to remove the previous repo if you are changing the :repo_url : `cap [stg] git:remove_repo`
+### Trouble shooting
+* In Rails 7 you have to create a new credentials/staging.key and file for each environment. This is just deleting credentials and runing again EDITOR="vim" rails credentials:edit --staging
+
+* If capistrano dos no find any command is the order of .basrc file, [here is well explained](https://stackoverflow.com/questions/25479348/how-can-i-instruct-capistrano-3-to-load-my-shell-environment-variables-set-at-re/29344562#29344562)
+
### Backup
Backups/restore database and files in your Rails app.
Configure your 'config/applciation.rb':
@@ -117,46 +132,45 @@
# Backup repo
config.backup_repo = "git@github.com:example/backup.git"
```
And
-
+
-* `cap [stg] pull:data`: downloads DDBB and file folders from the stage you need.
-* `cap [stg] pull:db`: Hot backup, download and restore of the stage database
-* `cap [stg] pull:files`: Hot restore of backup_files
-* `cap [stg] backup[TAG]`: Commit a backup of DDBB and files to the git repo configured. "application-YYYYMMDD" tagged if no tag is provided.
-* `cap [stg] backup:restore[TAG]`: Restore the last backup into the stage indicated, or tagged state if TAG is provided.
-* `rake backup |TAG|`: Uploads backup to git store from local, tagging with date, or with TAG if provided. Useful to backup production stage.
-* `rake backup:restore |TAG|`: Restore last backup copy, or tagged with TAG if provided.
+- `cap [stg] pull:data`: downloads DDBB and file folders from the stage you need.
+- `cap [stg] pull:db`: Hot backup, download and restore of the stage database
+- `cap [stg] pull:files`: Hot restore of backup_files
+- `cap [stg] backup[TAG]`: Commit a backup of DDBB and files to the git repo configured. "application-YYYYMMDD" tagged if no tag is provided.
+- `cap [stg] backup:restore[TAG]`: Restore the last backup into the stage indicated, or tagged state if TAG is provided.
+- `rake backup |TAG|`: Uploads backup to git store from local, tagging with date, or with TAG if provided. Useful to backup production stage.
+- `rake backup:restore |TAG|`: Restore last backup copy, or tagged with TAG if provided.
### TODO: Release
Release management
-* `rake release |VERSION|` push forward from dev-branch to master-branch and tag the commit with VERSION name.
-* `rake release:delete |VERSION|` remove tag with VERSION name.
-* `rake git:ff` merge dev branch towards master branch without releasing (Deprecating, new version "rake tomaster[message]")
+- `rake release |VERSION|` push forward from dev-branch to master-branch and tag the commit with VERSION name.
+- `rake release:delete |VERSION|` remove tag with VERSION name.
+- `rake git:ff` merge dev branch towards master branch without releasing (Deprecating, new version "rake tomaster[message]")
-
+
-
### Diagnosis
Some capistrano commands useful to connect to server and help with the problem solving.
-* `cap [stg] ssh` open a ssh connection with server
-* `cap [stg] log_tail[LOG_FILENAME]` tail all rails logs by default, or only one if LOG_FILENAME is provided
-* `cap [stg] log_patter[PATTERN]` search a pattern in all logs
-* `cap [stg] c` open a rails console with server
-* `cap [stg] dbconsole` open a rails database console with server
-* `cap [stg] x[COMMAND]` execute any command in server provided as COMMAND (i.e.: cap production x['free -m'])
-* `cap [stg] rake[TASK]` execute any rake task in server provided as TASK (i.e.: cap production rake[db:version])
+- `cap [stg] ssh` open a ssh connection with server
+- `cap [stg] log_tail[LOG_FILENAME]` tail all rails logs by default, or only one if LOG_FILENAME is provided
+- `cap [stg] log_patter[PATTERN]` search a pattern in all logs
+- `cap [stg] c` open a rails console with server
+- `cap [stg] dbconsole` open a rails database console with server
+- `cap [stg] x[COMMAND]` execute any command in server provided as COMMAND (i.e.: cap production x['free -m'])
+- `cap [stg] rake[TASK]` execute any rake task in server provided as TASK (i.e.: cap production rake[db:version])
### Monitoring
-At this moment we are implementing [NewRelic](http://newrelic.com/) monitoring, including as dependency ['newrelic_rpm'](https://github.com/newrelic/rpm) gem. To configure yourproject you just need to create an account at [NewRelic](http://newrelic.com/) and follow the instructions (creating a 'config/newrelic.yml file with your license_key).
+At this moment we are implementing [NewRelic](http://newrelic.com/) monitoring, including as dependency ['newrelic_rpm'](https://github.com/newrelic/rpm) gem. To configure yourproject you just need to create an account at [NewRelic](http://newrelic.com/) and follow the instructions (creating a 'config/newrelic.yml file with your license_key).
### TODO: Configuration management
`configure.yml`: for variables with environment dependency
@@ -169,12 +183,10 @@
`cap [stg] configure:newrelic`
`cap [stg] configure:jenkins`
`cap [stg] configure:wordpress`
-
-
## Contributing
1. Fork it ( https://github.com/[my-github-username]/prun-ops/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -187,42 +199,42 @@
## Release notes
### v0.0.2
-* First publication
+- First publication
### v0.0.4
-* Changing homepage and License
-* start|stop|restart thin server per application as Capistrano task
+- Changing homepage and License
+- start|stop|restart thin server per application as Capistrano task
### v0.0.5
-* Removing Application server version (thin 1.6.2) dependency
+- Removing Application server version (thin 1.6.2) dependency
### v0.0.6
-* Fixing DigitalOcean images error when slug is nil for client images
-* Adding git:ff rake task
+- Fixing DigitalOcean images error when slug is nil for client images
+- Adding git:ff rake task
### v0.0.8
-* Adding backup[tag] capistrano task for production
+- Adding backup[tag] capistrano task for production
### v0.0.9
-* Fixing Capistrano pulling tasks "pull:data"
+- Fixing Capistrano pulling tasks "pull:data"
### v0.0.10
-* Removing bin/ops command in order to create open-dock gem
-* Remove prun-ops dependency from 'config/deployment.rb' file and ad it to 'Capfile' as `require 'capistrano/prun-ops'`
+- Removing bin/ops command in order to create open-dock gem
+- Remove prun-ops dependency from 'config/deployment.rb' file and ad it to 'Capfile' as `require 'capistrano/prun-ops'`
### v0.0.21
-* Remove from your 'config/deploy.rb':
+- Remove from your 'config/deploy.rb':
```ruby
# Backup directories
require_relative "./application.rb"
set :backup_dirs, Taskboard::Application.config.backup_dirs
@@ -238,18 +250,18 @@
................
```
### v0.1.2
-* Add `cap stage dbconsole` to open a database console.
+- Add `cap stage dbconsole` to open a database console.
### v0.1.6
-* Add `cap stage rake[db:create]` to execute a rake task in remote server.
+- Add `cap stage rake[db:create]` to execute a rake task in remote server.
### v0.2.0
-* Configuration tasks: Add `cap stage config` and other tasks.
+- Configuration tasks: Add `cap stage config` and other tasks.
### v0.2.8
-* Bastion command
+- Bastion command