-
Notifications
You must be signed in to change notification settings - Fork 17
/
droneci.sh
executable file
·59 lines (44 loc) · 1.47 KB
/
droneci.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env bash
while true;do ls | grep -q dockerbunker.sh;if [[ $? == 0 ]];then BASE_DIR=$PWD;break;else cd ../;fi;done
PROPER_NAME="Drone CI"
SERVICE_NAME="$(echo -e "${PROPER_NAME,,}" | tr -cd '[:alnum:]')"
PROMPT_SSL=1
declare -a environment=( "data/env/dockerbunker.env" "data/include/init.sh" )
for env in "${environment[@]}";do
[[ -f "${BASE_DIR}"/$env ]] && source "${BASE_DIR}"/$env
done
declare -A WEB_SERVICES
declare -a containers=( "${SERVICE_NAME}-service-dockerbunker" )
declare -a add_to_network=( "${SERVICE_NAME}-service-dockerbunker" )
declare -A IMAGES=( [service]="drone/drone:1" )
declare -A volumes=( [${SERVICE_NAME}-data-vol-1]="/data" )
declare -a networks=( )
[[ -z $1 ]] && options_menu
configure() {
pre_configure_routine
echo -e "# \e[4mDrone CI Settings\e[0m"
set_domain
read -p "Gogs server address: " -ei "https://" DRONE_GOGS_SERVER
read -p "Gogs username: " -ei "" GOGS_USER
cat <<-EOF >> "${SERVICE_ENV}"
PROPER_NAME="${PROPER_NAME}"
SERVICE_NAME=${SERVICE_NAME}
SSL_CHOICE=${SSL_CHOICE}
LE_EMAIL=${LE_EMAIL}
DRONE_GOGS_SERVER=${DRONE_GOGS_SERVER}
DRONE_SERVER_HOST=${SERVICE_DOMAIN}
DRONE_SERVER_PROTO=https
DRONE_RUNNER_CAPACITY=2
DRONE_TLS_AUTOCERT=false
DRONE_GIT_ALWAYS_AUTH=false
DRONE_USER_CREATE=username:${GOGS_USER},admin:true
DRONE_DATABASE_SECRET=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 32)
SERVICE_DOMAIN=${SERVICE_DOMAIN}
EOF
post_configure_routine
}
if [[ $1 == "letsencrypt" ]];then
$1 $*
else
$1
fi