summaryrefslogtreecommitdiffstats
path: root/bin/deploy.sh
blob: 3a0116732e7d4c0a9817a7a8d8ff7dd1d1630590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env sh
#
# deploy.sh
#
# Deploy both services using Docker swarm.
#
# The registry domain is set in dotenv file but docker stack cannot read it.
# So a custom deploy script is required to load .env first.
# See: https://github.com/moby/moby/issues/29133

loadenvs() {
  set -a && . ./.env && set +a
}

error() {
  printf "Error: stack name not defined.\n"
  printf "Usage: sh deploy.sh your-stack-name [OPTIONS]\n"
  printf "You can display more information about usage with -h or --help.\n"
  exit 1
}

help() {
  cat <<EOF
# USAGE
sh deploy.sh [your-stack-name] [OPTIONS]

# DESCRIPTION
The version command allows Dotig to print its version and to check for a new release.

# OPTIONS
If [your-stack-name] is not provided:
-h, --help          Print this help.

If [your-stack-name] is provided:
--orchestrator string    Orchestrator to use (swarm|kubernetes|all)
--prune                  Prune services that are no longer referenced
--resolve-image string   Query the registry to resolve image digest and
                          supported platforms
                          ("always"|"changed"|"never") (default "always")
--with-registry-auth     Send registry authentication details to Swarm agents

# BUGS
If you find any bug, you can report it on https://github.com/ArmandPhilippot/apcom/issues.
EOF

  exit
}

deploy() {
  [ $# -eq 0 ] && error
  [ "$1" = "-h" ] || [ "$1" = "--help" ] && help

  _stack_name="$1"
  shift

  loadenvs
  docker stack deploy -c docker-compose.yml "$@" "$_stack_name"
}

deploy "$@"
ss="w"> auto; } *::-webkit-scrollbar { width: fun.convert-px(12); height: fun.convert-px(12); } *::-webkit-scrollbar-track { background: var(--color-bg-tertiary); } *::-webkit-scrollbar-thumb { background-color: var(--color-primary); border-radius: fun.convert-px(6); border: fun.convert-px(3) solid var(--color-bg-tertiary); } *::selection { background: var(--color-primary-opacity); color: var(--color-fg); text-shadow: none; } body { display: flex; flex-flow: column nowrap; min-height: 100vh; background: var(--color-bg); border-top: max(0.4vw, fun.convert-px(6)) solid; border-bottom: max(0.4vw, fun.convert-px(6)) solid; border-image: radial-gradient( ellipse at center, var(--color-primary-lighter) 20%, var(--color-primary) 100% ) 1; color: var(--color-fg); font-family: var(--font-family-primary); font-size: var(--font-size-md); line-height: var(--line-height); } #__next { flex: 1; display: flex; flex-flow: column nowrap; height: 100%; }