If you're going to run the project with Docker, you only need to install the following prerequisites:
Otherwise, you need the following prerequisites installed:
.ruby-version
, install with rvm
or rbenv
)~> 9.5
)xcode-select --install
.env.example
to .env
and update the fields to reflect your environment. To allow the development Docker configuration on amber-ui to work, change COMPOSE_PROJECT_NAME
to "amber_development".docker-compose -f docker-compose.development.yml build api
. This will install the dependencies and set up the image. If dependencies are updated/added, you need to run this command again.bundle exec rails db:setup
(see tip on how to run commands in the container).Tip: to run commands in the container, you can run the following:
$ docker-compose -f docker-compose.development.yml run api <COMMAND>
For example:
$ docker-compose -f docker-compose.development.yml run api bundle exec rspec
Create a Postgres user with permission to create databases. (optional)
Example of doing this (it could be that you need to be the postgres
user: do sudo su postgres
):
createuser -Pd <username>
The username can be you own username, or any other name.
Configure the database by setting your environment variables according to config/database.yml
bundle install
bundle exec rails db:setup
.env.example
to .env
and update the fields to reflect your environmentIf you're using Docker, you can run the project by using docker-compose -f docker-compose.development.yml up api
, otherwise run bundle exec rails server
.
Before you can start the application you will need the master.key
. Ask a fellow developer for it, or pull it from the server via ssh.
When the master.key
is present, you can use bundle exec rails credentials:edit
to open the default editor on your machine to read and edit the credentials. Be informed: these are production credentials so be careful.
Read more about Rails credentials on EngineYard.com.
Tip: you can also use one of the following commands to use an editor of your choice:
$ EDITOR="atom --wait" bundle exec rails credentials:edit
$ EDITOR="subl --wait" bundle exec rails credentials:edit
$ EDITOR="code --wait" bundle exec rails credentials:edit
To test the ImprovMX endpoint you can setup ImprovMX to forward mail to your local machine. To do this you should follow the following steps.
./ngrok http 3000
https://actionmailbox:<action_mailbox-ingress-password>@<ngrok-address>/rails/action_mailbox/improvmx/inbound_emails
NGROK_HOST
to your .env
fileThe tests are written with RSpec, a behaviour driven test environment.
To run all tests, execute:
bundle exec rspec
Guard is a command line tool to handle events on file system modifications. When active, it re-runs specs each time a change is noticed.
To run Guard, execute:
bundle exec guard
RuboCop is used to inspect the quality of the code. The rules used by RuboCop are specified in rubocop.yml
.
To run RuboCop, execute:
bundle exec rubocop
GitHub Actions is a CI/CD service which automatically tests the application after a commit has been pushed. GitHub Actions will run RuboCop and RSpec (see .github/workflows/continuous-integration.yml
) and will fail if one of these fails.
See DEPLOY.md for that.
See PERMISSIONS.md for that.