- Ruby
- PostgreSQL
- Bundler (run
gem install bundler
)
bundle install
Ensure you have Postgres 11 installed. If you are working on a Mac, this tutorial will take you through the process.
You will need to have a user with the role name postgres, which has the Create DB
and Superuser
permissions to create databases and install the fuzzystrmatch
extension.
Once you have set this up, run the command to set up and seed your local database
make seed-local-db
export STAGE=test
Set the endpoint of unleash to be any valid URL. You will need to run your own local version of unleash if you want to use feature toggles.
export EPB_UNLEASH_URI=https://google.com
To decode and validate JWTs passed in to the API the environment variables JWT_ISSUER
and JWT_SECRET
need to be set.
The values for these should match those on the auth server being connected to.
export JWT_ISSUER=dev.issuer
export JWT_SECRET=dev.secret
make test
make run
This will make the API available at http://localhost:9191
.
To run Rubocop:
make format
Build commands are stored in the buildspec directory
The codebase contains a dockerfile for the api
To rebuild the api Docker image locally, run
docker build . --tag epb-register-api
You can run the created image in Docker Desktop by going to Images and pressing Run in the Actions column. This will create a persistent deployment and has an interface to provide multiple useful options.
docker run -p {host_port}:80 -p {host_port2}:443 --name test-epb-register-api epb-register-api
Where host_port is a free port you want to use on your host machine to make calls to the API.
When running the containers, you may want them to communicate with a containerized instance of PostgreSQL, Redis, or another container in general. To do this, you will need to use a bridge network and connect any containers that need to communicate with each other to it
You can set up a bridge network using
docker network create {network_name}
And then connect the containers to the network when going to run them e.g.
- for the api
docker run -p {host_port}:80 -p {host_port2}:443 --network {network_name} --name test-epb-register-api epb-register-api