-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.sh
executable file
·26 lines (21 loc) · 977 Bytes
/
init.sh
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
#!/bin/bash
# Some fancy ansi/unicode variables
readonly RED="\e[0;31m"
readonly BOLD="\e[1m"
readonly ITALIC="\e[3m"
readonly CLEAN="\e[0m"
readonly ERROR="${RED}${BOLD} \xE2\x9C\x97${ITALIC} error${CLEAN}"
if [ ! -f .env ]; then
printf "${ERROR} The ${BOLD}.env${CLEAN} file doesn't exists, start by copying the ${BOLD}.env.dist${CLEAN} file into ${BOLD}.env${CLEAN} and update with your configuration.\n"
exit 1
fi
source .env
if [ `docker network ls | grep -c -w ${NETWORK_NAME}` -eq 0 ]; then
docker network create ${NETWORK_NAME}
fi
if [ `docker volume ls | grep -c -w ${SYNCTHING_VOLUME_NAME}` -eq 0 ]; then
docker volume create ${SYNCTHING_VOLUME_NAME}
# Fix volume owner
fi
docker run --rm -v ${SYNCTHING_VOLUME_NAME}:/syncthing alpine chown 1000:1000 /syncthing
docker run --rm -v ${SYNCTHING_VOLUME_NAME}:/syncthing alpine sh -c "mkdir -p /syncthing/traefik/ && touch /syncthing/traefik/acme.json && chmod 600 /syncthing/traefik/acme.json"