-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·51 lines (39 loc) · 1.68 KB
/
install
File metadata and controls
executable file
·51 lines (39 loc) · 1.68 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
#!/bin/bash
source ./submodules/bootstrap/logging
#-----------
# Configurations
#-----------
PHPAPP_NAME=${PHPAPP_NAME-samplephp}
PHPAPP_SERVER_NAME=${PHPAPP_SERVER_NAME-samplephp.vm}
PHPAPP_PUBLIC_PATH=${PHPAPP_PUBLIC_PATH-/public}
PHPAPP_MODE=${PHPAPP_MODE-git}
PHPAPP_SERVER=${PHPAPP_SERVER-nginx}
PHPAPP_LOGS=${PHPAPP_LOGS-/var/log/$PHPAPP_SERVER}
GIT_URL=${GIT_URL-git@github.com:aforward/samplephp.git}
TARBALL_FILENAME=${TARBALL_FILENAME-./assets/myapp.tar.gz}
#-----------
# Install Script
#-----------
notify "Installing PHP app $PHPAPP_NAME..."
if [[ "$PHPAPP_MODE" == "git" ]]; then
debug " -- Installing via git"
GIT_URL=$GIT_URL GIT_REPO_NAME=$PHPAPP_NAME ./submodules/git/install
elif [[ "$PHPAPP_MODE" == "zip" ]]; then
debug " -- Installing via zip"
TARBALL_NAME=$PHPAPP_NAME TARBALL_MODE=zip TARBALL_FILENAME=$TARBALL_FILENAME ./submodules/tarball/install
elif [[ "$PHPAPP_MODE" == "targz" ]]; then
TARBALL_NAME=$PHPAPP_NAME TARBALL_MODE=targz TARBALL_FILENAME=$TARBALL_FILENAME ./submodules/tarball/install
fi
if [[ "$PHPAPP_SERVER" == "nginx" ]]; then
debug " -- Configuring for NGINX"
CONF_FILENAME=/etc/$PHPAPP_SERVER/sites-enabled/${PHPAPP_NAME}
elif [[ "$PHPAPP_SERVER" == "apache2" ]]; then
debug " -- Configuring for APACH2"
CONF_FILENAME=/etc/$PHPAPP_SERVER/sites-enabled/${PHPAPP_NAME}.conf
fi
cp ./submodules/phpapp/files/${PHPAPP_SERVER}_conf $CONF_FILENAME
sed -i "s|@APP_NAME@|$PHPAPP_NAME|g" $CONF_FILENAME
sed -i "s|@SERVER_NAME@|$PHPAPP_SERVER_NAME|g" $CONF_FILENAME
sed -i "s|@SERVER_ROOT@|/data/${PHPAPP_NAME}${PHPAPP_PUBLIC_PATH}|g" $CONF_FILENAME
sed -i "s|@SERVER_LOGS@|$PHPAPP_LOGS|g" $CONF_FILENAME
notify "DONE, Installing PHP app $PHPAPP_NAME."