-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-docker.sh
executable file
·37 lines (31 loc) · 1.29 KB
/
run-docker.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
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
JETBRAINS_USER_NAME=jetbrains
JETBRAINS_USER_ID=2000
# create user if not exist
if [ $(getent passwd ${JETBRAINS_USER_NAME}) ]; then
echo "user ${JETBRAINS_USER_NAME} already exists"
else
echo "creating user ${JETBRAINS_USER_NAME}"
groupadd --gid ${JETBRAINS_USER_ID} ${JETBRAINS_USER_NAME}
useradd --system --uid ${JETBRAINS_USER_ID} --gid ${JETBRAINS_USER_NAME} ${JETBRAINS_USER_NAME}
fi
# create directories if not exist
if [ -d postgres/data ]; then
echo "directory postgres/data already exist"
else
mkdir --mode 770 --verbose --parents postgres
fi
if [ -d teamcity/.BuildServer ]; then
echo "directory teamcity/.BuildServer already exist"
else
mkdir --mode 770 --verbose --parents teamcity/.BuildServer/lib/jdbc
mkdir --mode 770 --verbose --parents teamcity/.BuildServer/config
cp -R database.properties teamcity/.BuildServer/config/database.properties
curl "https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar" -o teamcity/.BuildServer/lib/jdbc/postgresql-9.4.1212.jar
fi
chmod --recursive 770 teamcity
chmod --recursive 770 postgres
chown --changes --verbose --recursive ${JETBRAINS_USER_NAME}:pojo teamcity
chown --changes --verbose --recursive ${JETBRAINS_USER_NAME}:pojo postgres
#run docker
docker-compose up -d --force-recreate