Created
April 18, 2017 04:50
-
-
Save luizamboni/d2e14a394ea0acdb4671b6b4bcfbeac9 to your computer and use it in GitHub Desktop.
phoenix very simple deploy in digitalOcean
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USER="root" # default digitalOcean user | |
APP_NAME="xxx" | |
DEPLOY_DIR="/var/www/${APP_NAME}/" | |
HOST="xxx.xxx.xxx.xxx" | |
echo -e "1) update project" | |
CMD="cd ${DEPLOY_DIR} && git pull" | |
echo $CMD | |
ssh ${USER}@${HOST} $CMD | |
echo -e "2) mix deps.get --only prod" | |
CMD="cd ${DEPLOY_DIR} && mix deps.get --only prod" | |
echo $CMD | |
ssh ${USER}@${HOST} $CMD | |
echo -e "3) MIX_ENV=prod mix compile" | |
CMD="cd ${DEPLOY_DIR} && MIX_ENV=prod mix compile" | |
echo $CMD | |
ssh ${USER}@${HOST} $CMD | |
echo -e "4) get a pid by server.pid" | |
CMD="cat ${DEPLOY_DIR}server.pid" | |
echo $CMD | |
PID=$(ssh ${USER}@${HOST} $CMD ) | |
echo -e "5) kill by server.pid" | |
CMD="kill -9 ${PID}" | |
echo $CMD | |
ssh ${USER}@${HOST} $CMD | |
echo -e "6) run server" | |
CMD="cd ${DEPLOY_DIR} && MIX_ENV=prod PORT=80 elixir \ | |
--detached \ | |
-e \"File.write! 'server.pid', :os.getpid\" \ | |
-pa _build/prod/consolidated -S mix phoenix.server" | |
echo $CMD | |
ssh ${USER}@${HOST} $CMD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment