-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·72 lines (56 loc) · 2.91 KB
/
install
File metadata and controls
executable file
·72 lines (56 loc) · 2.91 KB
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
#!/bin/bash
source ./bits/bootstrap/logging
#-----------
# Configurations
#-----------
LAUNCHER_OWNER=${LAUNCHER_OWNER-$USER}
export LAUNCHER_DIR=${LAUNCHER_DIR-/var/local}
export NGINX_LAUNCHER_DIR=${NGINX_LAUNCHER_DIR-$LAUNCHER_DIR/nginx}
NGINX_INCLUDE_RELOAD=${NGINX_INCLUDE_RELOAD-true}
NGINX_INCLUDE_PHP=${NGINX_INCLUDE_PHP-true}
NGINX_INCLUDE_MYSQL=${NGINX_INCLUDE_MYSQL-true}
NGINX_INCLUDE_POSTGRES=${NGINX_INCLUDE_POSTGRES-true}
export NGINX_APPS_DIR=${NGINX_APPS_DIR-$LAUNCHER_DIR/apps}
export NGINX_SITES_ENABLED_DIR=${NGINX_SITES_ENABLED_DIR-/etc/nginx/sites-enabled}
export NGINX_SITES_AVAILABLE_DIR=${NGINX_SITES_AVAILABLE_DIR-/etc/nginx/sites-available}
export LOG_DIR=${LOG_DIR-/var/log}
export NGINX_LOG_DIR=${NGINX_LOG_DIR-$LOG_DIR/nginx}
export NGINX_HTTP_PORT=${NGINX_HTTP_PORT-80}
export NGINX_SSL_PORT=${NGINX_SSL_PORT-443}
#-----------
# Install Script
#-----------
notify "Install nginx..."
OWNER=$LAUNCHER_OWNER ./bits/bootstrap/mkdir LAUNCHER_DIR NGINX_LAUNCHER_DIR $NGINX_LAUNCHER_DIR/startup.d $NGINX_LAUNCHER_DIR/files
OWNER=$LAUNCHER_OWNER:www-data ./bits/bootstrap/mkdir NGINX_SITES_ENABLED_DIR NGINX_SITES_AVAILABLE_DIR
TEMPLATE=./bits/nginx/files/nginx.dockerfile LOCATION=$NGINX_LAUNCHER_DIR/Dockerfile ./bits/docker/copyif
TEMPLATE=./bits/nginx/files/postgres_host LOCATION=$NGINX_LAUNCHER_DIR/files/postgres_host ./bits/docker/copyif
TEMPLATE=./bits/nginx/files/php5_fpm LOCATION=$NGINX_LAUNCHER_DIR/files/php5_fpm ./bits/docker/copyif
if [[ ! -e $NGINX_LAUNCHER_DIR/files/do_nothing ]]; then
printf '#!/bin/bash\n# Do nothing\n' > $NGINX_LAUNCHER_DIR/files/do_nothing
chmod 755 $NGINX_LAUNCHER_DIR/files/do_nothing
fi
if [[ "$NGINX_INCLUDE_PHP" = true ]]; then
notify " -- enabling php"
sed -i 's|# @PHP_INSTALL@|cat ./bits/nginx/files/php_partial.dockerfile|e' $NGINX_LAUNCHER_DIR/Dockerfile
fi
if [[ "$NGINX_INCLUDE_MYSQL" = true ]]; then
notify " -- enabling mysql"
sed -i 's|# @MYSQL_INSTALL@|cat ./bits/nginx/files/mysql_partial.dockerfile|e' $NGINX_LAUNCHER_DIR/Dockerfile
fi
if [[ "$NGINX_INCLUDE_RELOAD" = true ]]; then
TEMPLATE=./bits/nginx/files/nginx_touch LOCATION=$NGINX_LAUNCHER_DIR/files/nginx_touch ./bits/docker/copyif
TEMPLATE=./bits/nginx/files/touchandgo LOCATION=$NGINX_LAUNCHER_DIR/files/touchandgo ./bits/docker/copyif
TEMPLATE=./bits/nginx/files/nginx_reload LOCATION=$NGINX_LAUNCHER_DIR/files/nginx_reload ./bits/docker/copyif
sed -i 's|# @RELOAD_INSTALL@|cat ./bits/nginx/files/reload_partial.dockerfile|e' $NGINX_LAUNCHER_DIR/Dockerfile
fi
if [[ "$NGINX_INCLUDE_POSTGRES" == true ]]; then
debug " -- enabling postgres"
sed -i 's|# @POSTGRES_INSTALL@|cat ./bits/nginx/files/postgres_partial.dockerfile|e' $NGINX_LAUNCHER_DIR/Dockerfile
NGINX_LINK_CMD="--link postgres:psqldb \\"
else
NGINX_LINK_CMD=""
fi
LAUNCHER_DIR=$NGINX_LAUNCHER_DIR NAME=nginx ./bits/docker/build
NAME=nginx DIR=$NGINX_LAUNCHER_DIR BIT=nginx ./bits/docker/helpers
notify "DONE, Install nginx."