This is the API of the Room project which is a web application that aims to improve the interaction experience of remote workers.
You can get the frontend, the Endpoints documentation and the MVP Process Documentation on github.
Check the work in progress application here.
Rbenv: repo
- Check that the rbenv PATH is configured correctly, according to the repo instructions.
Rbenv-gemset: repo
$ rbenv install 2.5.5
$ rbenv global 2.5.5
$ curl -sL https://deb.nodesource.com/setup_12.x | bash -
$ apt-get install -y nodejs && npm install -g mjml
If rbenv complains you don't have that ruby version, upgrade ruby-build.
$ git clone git@github.com:roavellarm/room-api.git
$ cd <identifier_name>
You must have the correct .env
variables.
There is values there that we CANNOT send to the github, otherwise this will
represent a secutiry flaw. If you're using Docker you also need to change
some values like POSTGRES_HOST
(if you use Docker, you should know the values).
$ cp .env.sample .env
$ bin/bundle
Always use this command to ensure the gems are installed in .gems
.
$ bin/rails db:create db:migrate db:seed
$ bin/rails s
You can check that it worked by browsing localhost:3000
.
In order to use that, ALL mailer views should end in .mjml
extensions, and can be used both for MJML
AND for ERB views. Example: my_mailer.html.erb
will be converted in my_mailer.mjml
and will
continue to have all traditional features of ERB files, including support for embedded Ruby lines.
In other words, you can write both HTML and Ruby code inside this mailers. Once you have written your template, MJML Rails Gem will automatically convert this file into HTML, and will try at max to make it responsible even for mobile screens.
The documentation for MJML templates can be found HERE!!!!.
$ bin/rspec
# OR for Docker
$ docker-compose run rails bin/rspec
The coverage will be available on the coverage/
folder. Open coverage/index.html
on your browser to see details.
$ bin/rubocop
# OR for Docker
$ docker-compose run rails bin/rubocop
$ docker-compose build
options:
--no-cache (build the entire container using no cached infos)
$ docker-compose up
$ docker ps
This command will show the running containers, example:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
dfb80bf0ae96 postgres:10.4 "docker-entrypoint.s…" 3 hours ago Up 3 hours 0.0.0.0:5432->5432/tcp room-api_postgres_1
$ docker-compose run [container name] [command]
example:
$ docker-compose run rails bin/rails db:create
$ docker exec [options] [container ID] [command]
options:
-i (interactive)
-t (attach terminal to command)
examples:
$ docker exec -it dfb80bf0ae96 bin/rails db:migrate
The dfb80bf0ae96
string here is shown when you run docker ps
. This is the container ID running on your machine.
- Create a one Heroku project for Staging and another one for Production.
- Inside Heroku Apps you should add the NodeJS buildpacks (for MJML mailer templates)
heroku buildpacks:add --index 1 heroku/nodejs
- Configure the
RAILS_MASTER_KEY
env var for both heroku projects (they are the same). - Check app names at
.circleci/config.yml
to see if they match the names on Heroku dashboard
The URLs for production and staging are:
All commits to master
branch will be pushed to staging by CircleCI.
Generate a new release - all tags in the format vX
, where X
is an integer, will be automatically pushed to production.
Example: v1
, v2
... v10
and so on.
bin/rails generate "service_object_name"
This command generates the service object template and a test template for Rspec.