Build Server
October 9, 2015 ยท View on GitHub
- Go to Digital Ocean
- Create new droplet
- London
- Ubuntu
- No apps
- Add SSH keys
Setup Server
- SSH to server as root
sudo apt-get install gitgit config --global user.name "Your Name"git config --global user.email "your@email.co.uk"
wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.debsudo apt-get updatesudo apt-get install elixirmix local.hexarchive.install https://github.com/phoenixframework/phoenix/releases/download/v1.0.3/phoenix_new-1.0.3.ezsudo apt-get install erlang-base-hipesudo apt-get install build-essentialsudo apt-get install erlang-devchmod -R 777 /optmkdir /gitchmod -R 777 /git
Setup EDeliver Project
- add edeliver dependency (pointing to master branch on GH for now...):
{:edeliver, git: "https://github.com/boldpoker/edeliver.git"} - change
{:phoenix_live_reload, "~> 1.0", only: :dev}to{:phoenix_live_reload, "~> 1.0"} - add
, :edeliver, :phoenix_live_reloadto applications list mix deps.getmix deps.compile- create
.deliver/configfile - populate config file with the following:
#!/usr/bin/env bash
APP="my_awesome_app" # name of your release
BUILD_HOST="server ip / hostname" # host where to build the release
BUILD_USER="root" # local user at build host
BUILD_AT="/git/my_awesome_app/builds" # build directory on build host
RELEASE_DIR="/git/my_awesome_app/builds/rel/my_awesome_app"
RELEASE_VERSION=0.0.1
STAGING_HOSTS="server ip / hostname" # staging / test hosts separated by space
STAGING_USER="git" # local user at staging hosts
TEST_AT="/test/my_awesome_app" # deploy directory on staging hosts. default is DELIVER_TO
PRODUCTION_HOSTS="server ip / hostname" # deploy / production hosts separated by space
PRODUCTION_USER="root" # local user at deploy hosts
DELIVER_TO="/opt/my_awesome_app" # deploy directory on production hosts
Establish Production Config
- copy / paste config from dev.exs / test.exs
- replace first endpoint block with the following:
config :my_awesome_app, MyAwesomeApp.Endpoint,
http: [port: 4800],
debug_errors: true,
server: true,
code_reloader: false,
cache_static_lookup: false,
check_origin: false,
watchers: []
- be sure to remove / turn off any config settings relating to live reload / code reload
Build On Server
mix edeliver build release --verbosemix edeliver deploy release to production --verbosemix edeliver start production --verbose- double check that everything is running at your-ip:4800