- DC/OS cluster: cluster built using Mesosphere DC/OS 1.10
- load balancing: load balancing and autoscaling is handled by marathon-lb
- CI: continuous delivery with Jenkins
- log management: Graylog for log aggregation
- error tracking: manage errors with Sentry
- development setup: start coding within minutes - seamless developer experience thanks to Docker & docker-compose
- DC/OS cluster running with marathon-lb plugin enabled
- Jenkins up and running
- Sentry up and running
- Graylog up and running
- Docker registry up and running (or one could use https://hub.docker.com/)
- Docker & docker-compose installed on developer host machine
Setting up the production environment requires some credentials in Jenkins to be setup first. Please check the Jenkinsfile
included in repo.
Credentials to be added:
YND_PHX_REGISTRY_URL
docker registry URLYND_PHX_REGISTRY_CREDS
docker registry credentialsYND_PHX_DCOS_DR
first part of docker image tag if you are pushing to private docker registry it should point to hostname of your private docker registryYND_PHX_MARATHON_URL
marathon service urlYND_PHX_MARATHON_ID
marathon application name identifierYND_PHX_DCOS_CREDS
marathon credentials
We use Jenkins config file provider plugin to provide ad hoc build configuration for orchestration platform. We have provided two example files (marathon.json.example
, marathon-db.json.example
) to ilustrate how the setup might look like.
Proper configuration files based on those templates has to be submitted to Jenkins credentials as Secret files, with ids YND_PHX_MARATHON_JSON
and YND_PHX_MARATHON_DB_JSON
respectively.
Excerpt of marathon.json
configuration options
id
it should match themarathon_id
from Jenknisfilecontainer.docker.image
tag name of docker image you wish to pull from docker registrycontainer.portMappings.name
name of your app in DC/OSenv
those env variables are accessible in your container and used by binary elixir phoenix release. You probably want to alter all of the variables here exceptMIX_ENV
andPORT
.SENTRY_ENDPOINT
is also know as sentry dsn.labels.HAPROXY_0_VHOST
Excerpt of marathon-db.json
configuration options
id
identifier of the postgresql database service in DC/OScontainer.portMappings.name
name of postgresql database service in DC/OSenv.POSTGRES_USER
this env variable should matchenv.DB_REPO_USER
inmarathon.json
fileenv.POSTGRES_PASSWORD
this env variable should matchenv.DB_REPO_PASSWORD
in `marathon.json** file
To run commands in development you need to have working .env
file
$ cp .env.example .env
Install the dependencies and compile
$ docker-compose run --rm app mix do deps.get, compile
Start the server on port 4000
$ docker-compose up
Run tests
$ docker-compose run --rm app mix test
Elixir Phoenix Bootstrap is released under MIT license. See LICENSE for details.