| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Shell deploy - KISS, multi-stage, multi-host, muti-role deployment suitable for preparations of nodes used for Docker Swarm.
The example is demonstrated using:
Install only on your management node:
git clone git@github.com:brablc/sheploy /usr/local/lib/sheploy
ln -s /usr/local/lib/sheploy/bin/sheploy /usr/local/sbin/
# Create basic directory structure:
sheploy init
# Assing 'any' role to management node.
sheploy link-role swarm-mng anyPlease watch the comments:
▼ deploys # base dir with deploys
▼ hosts # list of hosts accessible via ssh command (resolvable or using ~/.ssh/config)
▼ swarm-mng
▼ files/etc # each host can have its own `files` dir or it can symlink role
▼ cron.d
- backup.example
▼ postfix
- generic.example
▼ tasks
~ 090-lazydocker
~ 090-lazygit
~ 090-postfix-generic
▶ tasks-any # to use role's task symlink the folder, keep `tasks-` prefix
▼ swarm-wrk1
▶ files-wrk
▶ tasks-any
▶ tasks-wrk
▼ roles # if you have multiple hosts with same deployment use roles
▼ any/tasks-any # host can have multiple roles
~ 010-apt-update
~ 011-apt-install
~ 020-postfix
~ 020-sysstat
~ 020-zellij
▼ wrk/tasks-wrk
~ 030-postfix-relay
▼ tasks # all the tasks above can be symlinked to a common folder or they may have script directly
- apt-install
- apt-update
- postfix
- postfix-relay
- sysstat
- zellij
Tip
The host name should actually be alias from ~/.ssh/config. You may use backup@swarm-wrk1 as host name to connect as different user to the same machine.
Tip
Watch the numeric prefixes of tasks, they can be used to execute tasks in stages, or to run specific task. Tasks from host and its roles are merged and sorted by name and executed in that order.
Having the deploys directory ready, this is the recommended way of running:
# Deploy files, that are different on other hosts, owner and permissions are kept
sheploy --dry-run --config-type=files
# prepare all hosts - run tasks starting with 0
sheploy --dry-run --prefix=0
# additional phases - like copying libraries gathered in step 0 on manager host
sheploy --dry-run --prefix=1
# install new packages only on worker nodes
sheploy --dry-run --host-filter=swarm-wrk --prefix=011
# create a new worker host - would run full suit on one node
rsync deploys/hosts/{swarm-wrk3,swarm-wrk4}/
sheploy --dry-run --host-filter=swarm-wrk[34]| Back | FazBrowse Home | New Git URL |