This is a part of the Deploy.RB project.
Deploy.RB consists of:
- Rails 5 App (You are here)
- Server Installation Script & Manual
- Deployment Tool
Please, visit Deploy.RB page to get more information.
Simple Rails 5 App for deploy.rb
project
With this App we demonstrate how basic Rails 5 can be configurated for deployment process
The app uses the following tools:
- PostgreSQL (as main DB Storage)
- Devise (Authentication)
- Redis (Cache store and store for SideKiq)
- SideKiq (Delayed jobs)
- Thinking Sphinx (Full-text search)
mysql2
adapter to work withThinking Sphinx
foreman
to start/stop services- WebSockets (ActionCable)
- Whenever (Cron tasks)
kaminari
for pagination
- Unix like OS
- NodeJS (https://nodejs.org)
- Redis (http://redis.io)
- Sphinx (http://sphinxsearch.com)
- PostgreSQL (http://postgresql.org)
- MySQL (http://mysql.com)
[open ▾] How to check required software?
$ which rvm
/Users/$HOME/.rvm/bin/rvm
$ which node
/usr/local/bin/node
$ which redis-server
/usr/local/bin/redis-server
$ which searchd
/usr/local/bin/searchd
$ which psql
/usr/local/bin/psql
$ which mysql
/usr/local/bin/mysql
git clone https://github.com/DeployRB/Rails5App.git
cd Rails5App
gem install bundler
bundle install
cp -av config/ENV/production.example config/ENV/development
-
Edit files were copied and replace
/ABS/PATH/TO
with real absolute path to yourRails5App
app pathFor example,
/ABS/PATH/TO/Rails5App
=>/Users/the-teacher/rails/Rails5App
-
Edit files were copied and replace
production.example
with a name of your environment
For example:
sed -i '' 's/production.example/development/g' config/ENV/development/services/*
cp config/database.yml.example config/database.yml
Edit file and set required parameters.
[open ▾] How to create PQSL user?
createuser rails5app -sW
> qwerty
psql -U postgres
CREATE USER "rails5app" WITH PASSWORD 'qwerty';
ALTER ROLE "rails5app" SUPERUSER CREATEDB;
\q
bundle exec rake app:init
bundle exec rake ts:configure ts:index
Start cron tasks
[open ▾] CRON. Notes
- tasks list
crontab -l
- remove all tasks
crontab -r
bundle exec whenever --clear-crontab Rails5App
bundle exec whenever --update-crontab \
-i Rails5App \
--load-file config/ENV/development/services/schedule.rb \
--set 'environment=development'
Start services with foreman
bundle exec foreman start
bundle exec puma -b tcp://localhost -p 3000
or just
bundle exec rails s
http://localhost:3000
http://localhost:3000/async/tasks
login: admin
password: qwerty