-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplease
executable file
·82 lines (72 loc) · 2.18 KB
/
please
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
source .env
up() {
dir=$(pwd)
if [ ! -f ./config/configuration.yml ]; then
echo "Please copy configfiguration.yml.example to configfiguration.yml and edit smtp settings"
exit 1
fi
if [ ! -f ./config/database.yml ]; then
echo "Please copy database.yml.example to database.yml and edit database settings"
exit 1
fi
if [ ! -f ./.env ]; then
echo "Please copy env_plain to .env and edit settings"
exit 1
fi
if [ ! -d ./repos ]; then
mkdir -p repos && cd repos && git clone https://github.com/docker-library/redmine
cd ${dir}
fi
if [ ! -d ./volumes ]; then
mkdir -p volumes && mkdir -p volumes/redmine && mkdir -p volumes/redmine/logs && mkdir -p volumes/redmine/files
cd ${dir}
fi
if [ -z ${1+x} ];
then
mode=${DEPLOY_MODE}
else
mode=${1}
DEPLOY_MODE=mode
fi
case ${mode} in
prod) docker-compose -f docker-compose.live.yml up -d --build;;
stage) docker-compose -f docker-compose.stage.yml up -d --build;;
dev) docker-compose -f docker-compose.dev.yml up -d --build;;
*) print_up
esac
# docker-compose up -d --build
}
down() {
docker-compose down
}
reup() {
down
up
}
backup() {
if [ ! -d ./_bak ]; then
mkdir _bak
fi
case ${1} in
restore) docker exec -i redmine-db mysql -u ${REDMINE_DB_USER} -p${REDMINE_DB_PASSWORD} ${REDMINE_DB} < _bak/${2}_redmine.sql;;
dump) docker exec -i redmine-db mysqldump -u ${REDMINE_DB_USER} -p${REDMINE_DB_PASSWORD} ${REDMINE_DB} > _bak/${2}_redmine.sql;;
*) ""
esac
}
print_help() {
echo "please script for handling the vca api docker"
echo "Syntax: please [command]"
echo "commands:"
echo " up [mode] Set up redmine"
echo " down Shutdown redmine"
echo " reup Shutdown and re up redmine"
echo " backup [dump/restore] prefix Create redmine.sql in folder _bak or restore from redmine.sql"
}
case $1 in
up) up;;
reup) reup;;
down) down;;
backup) backup $2 $3;;
*) print_help
esac