-
-
Save dctremblay/dcb38ed832d2ade4c561984c73a51028 to your computer and use it in GitHub Desktop.
docker-compose rc script
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
#!/bin/bash | |
HOST=srv001.example.com | |
USER=compose | |
PATH=~/some-project | |
migrate() { :; } | |
psql() { dc exec postgres psql --user postgres; } | |
################# | |
start() { dc up -d $@; } | |
stop() { dc stop $@; } | |
restart() { stop $1; start $1; } | |
sh() { dc exec $@ bash; } | |
ps() { dc ps; } | |
entry() { dc run -u root --entrypoint=bash $@; } | |
build() { dc up -d --build $@; } | |
refresh() { build $@; migrate; restart; } | |
deploy() { pull; refresh; } | |
logs() { dc logs --timestamps -f $@; } | |
tail() { dc logs --timestamps -f --tail 20 $@; } | |
pull() { git pull --recurse-submodules; } | |
init() { git submodule update --init --recursive; } | |
prod() { ssh -tt $HOST sudo -u $USER "sh -c 'cd $PATH; ./rc $@'"; } | |
dc() { docker compose $@; } | |
help() { grep '()' rc; } | |
set -e | |
${@:-help} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment