Skip to content

Instantly share code, notes, and snippets.

@AlecTaylor
Created March 24, 2016 09:31
Show Gist options
  • Save AlecTaylor/9e98d3ffc75b0878ae78 to your computer and use it in GitHub Desktop.
Save AlecTaylor/9e98d3ffc75b0878ae78 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
first_run=${first_run:-false}
host=${host:-domain.com}
conf=${conf:-'static_sites.conf'}
ssh_cmd=${ssh_cmd:-'ssh}'
curr_user=${curr_user:-'dokku'}
new_user=${new_user:-'static'}
if [ ! -z "$new_pass" ]; then
new_pass=":$new_pass"
fi
function first_run_f () {
# eval "$ssh_cmd $curr_user@$host \"sudo adduser $new_user\""
eval "$ssh_cmd $curr_user@$host 'sudo touch /etc/nginx/conf.d/static_sites.conf && sudo chown static:static /etc/nginx/conf.d/static_sites.conf'"
rsync -e "$ssh_cmd" -azP "$conf" "${new_user}${new_pass}@${host}":/etc/nginx/conf.d/static_sites.conf
eval "$ssh_cmd $host sudo service nginx restart"
}
if $first_run; then
first_run_f
fi
rsync -e "$ssh_cmd" -azP web-frontend "${new_user}${new_pass}@${host}":/tmp
#/home/static/sites/web-frontend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment