Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Commands to hot deploy with distillery
git clone https://github.com/wmnnd/distillery-demo.git
cd distillery-demo
# Add distillery as dependency in mix.exs
mix deps.get
# To create the initial release
MIX_ENV=prod mix release.init
MIX_ENV=prod mix release
# Create a deployment directory
mkdir ~/deploy
# Copy the 0.1.0 (default) release into the deployment directory
tar -xvzf _build/prod/rel/clock/releases/0.1.0/clock.tar.gz --directory ~/deploy
# Start running the clock server in a separate tab / window
~/deploy/bin/clock foreground
# Create an upgrade release 0.2.0.
# Change version to 0.2.0 in mix.exs
MIX_ENV=prod mix release --upgrade
# To hot deploy the server while the earlier clock is still running - create a new dir for
# the new release version & copy the release archive
mkdir ~/deploy/releases/0.2.0
cp _build/prod/rel/clock/releases/0.2.0/clock.tar.gz ~/deploy/releases/0.2.0/clock.tar.gz
~/deploy/bin/clock upgrade 0.2.0
# Follow same steps for higher version 0.4.0, 0.5.0, ...
# Create an upgrade release 0.3.0.
# Change version to 0.3.0 in mix.exs
MIX_ENV=prod mix release --upgrade
# To hot deploy the server while the earlier clock is still running - create a new dir for
# the new release version & copy the release archive
mkdir ~/deploy/releases/0.3.0
cp _build/prod/rel/clock/releases/0.3.0/clock.tar.gz ~/deploy/releases/0.3.0/clock.tar.gz
~/deploy/bin/clock upgrade 0.3.0
# To downgrade running server from 0.2.0 to 0.1.0 (You cannot skip an in between version while downgrade or upgrade)
~/deploy/bin/clock downgrade 0.2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment