Deployment is handled via the capistrano
gem.
This command deploys the master branch to the production server:
cap production deploy
The staging server can be found at dev.pfadiolten.ch.
Deploy to it with the staging
stage.
cap staging deploy
Development is usually done in a docker container. Use the container with the following commands:
# (re)build the image
docker-compose build
# start the server
docker-compose up
# start the server in the background
docker-compose up -d
In development, Gems are mounted in a local docker volume.
This makes it possible to just run a single command when modifying
the Gemfile
, instead of rebuilding the complete image.
# create the gem volume, only required once
docker volume create pfadiolten-home.gems
docker-compose run web bundle
This always has to be done before running the container for the first time.
The container saves its database in an external volume. It has to be created before first using the website:
docker volume create pfadiolten-home.data
Afterwards, the database has to be created and migrated.
docker-compose run web rails db:create db:migrate
Migrations on an existing database don't require the db:create
part.
docker-compose run web rails db:migrate
Afterwards, the API should be available at localhost:3000
.
The application requires access to a couple of APIs. Their respective access information can either be set with private credentials, or be copied from the deployment server.
PFADIOLTEN_OSM_ACCESS_TOKEN
PFADIOLTEN_INSTAGRAM_CLIENT_ID
PFADIOLTEN_INSTAGRAM_CLIENT_SECRET
PFADIOLTEN_INSTAGRAM_ACCESS_TOKEN