-
Notifications
You must be signed in to change notification settings - Fork 0
/
iaw-run
executable file
·135 lines (112 loc) · 2.93 KB
/
iaw-run
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
sudo su - vagrant
MYSQL_N=2
PMA_N=3
LP_N=1
WP_N=4
HOME=/home/vagrant
dc_file=docker-compose.yml
DATA_DIR=$HOME/data
IAW_LOCAL_DIR=$DATA_DIR
export WP_DIR=$DATA_DIR/wp
export LANDING_PAGE_DIR=$IAW_LOCAL_DIR/landing
export SSL_DIR=$IAW_LOCAL_DIR/ssl
export COMPOSE_PROJECT_NAME=io.iaw
export MYSQL_HOST=db.iaw.io
export BA_SSH_PASSWORD=webapp
export DOMAIN=iaw.io
export LANDING_PAGE_SSH_PORT=222${LP_N}
export LANDING_PAGE_SHELLINABOX_PORT=910${LP_N}
export LANDING_PAGE_SUPERVISOR_PORT=900${LP_N}
export MYSQL_DOMAIN=db.iaw.io
export MYSQL_ROOT_PASSWORD=mariadb
export MYSQL_DATABASE_NC=nextcloud
export MYSQL_USER_NC=ncuser
export MYSQL_PASSWORD_NC=nextcloud
export MYSQL_DATABASE_PMA=phpmyadmin
export MYSQL_USER_PMA=pmauser
export MYSQL_PASSWORD_PMA=phpmyadmin
export MYSQL_DATABASE_WP=wp
export MYSQL_USER_WP=wpuser
export MYSQL_PASSWORD_WP=wordpress
export MYSQL_DB_PORT=3306
export MYSQL_SSH_PORT=222${MYSQL_N}
export MYSQL_SHELLINABOX_PORT=910${MYSQL_N}
export MYSQL_SUPERVISOR_PORT=900${MYSQL_N}
export NEXTCLOUD_DOMAIN=nc.iaw.io
export NEXTCLOUD_HTTPS_PORT=444
export NEXTCLOUD_HTTP_PORT=8084
export PMA_DOMAIN=pma.iaw.io
export PMA_HTTPS_PORT=4443
export PMA_HTTP_PORT=8080
export PMA_SSH_PORT=222${PMA_N}
export PMA_SHELLINABOX_PORT=910${PMA_N}
export PMA_SUPERVISOR_PORT=900${PMA_N}
export COLLABORA_DOMAIN=col.iaw.io
export COLLABORA_PORT=9980
export LPC9_DOMAIN=lpc9.iaw.io
export WPC9_DOMAIN=wpc9.iaw.io
export WP_DOMAIN=wp.iaw.io
export WP_HTTPS_PORT=442
export WP_HTTP_PORT=82
export WP_SSH_PORT=222${WP_N}
export WP_SHELLINABOX_PORT=910${WP_N}
export WP_SUPERVISOR_PORT=900${WP_N}
export DOCKERUI_PORT=9990
export DUI_DOMAIN=dui.iaw.io
export SUBNET="172.25.0.0/24"
function download_wp {
mkdir -p $WP_DIR && cd $DATA_DIR
sudo wget https://wordpress.org/latest.tar.gz -O ./latest.tar.gz
sudo chown vagrant:vagrant ./latest.tar.gz
}
function init_wpconfig {
mkdir -p $WP_DIR && cd $DATA_DIR
rm $WP_DIR/wp-config*.php
mv ./wp-config.php $WP_DIR
}
function init_wp {
mkdir -p $WP_DIR && cd $DATA_DIR
docker cp wp.iaw.io:/var/www/html/wp-config.php ./
tar -xzvf latest.tar.gz > /dev/null
if [[ -d "$WP_DIR/wp-content" ]]; then
cp -r $WP_DIR/wp-content ./
fi
rm -rf $WP_DIR/*
cp -r wordpress/* $WP_DIR/
rm -rf wordpress
if [[ -d "./wp-content" ]]; then
rm -rf $WP_DIR/wp-content
cp -r ./wp-content $WP_DIR/
rm -rf ./wp-content
fi
init_wpconfig
}
function wp_config_init {
mkdir -p $WP_DIR && cd $DATA_DIR
if [ ! -f ./latest.tar.gz ]; then
echo "Downloading latest wordpress..."
download_wp
fi
if [ ! -f "www/html/wp-config.php" ]; then
init_wp
fi
}
function run_containers {
mkdir -p $DATA_DIR && cd $DATA_DIR
if [ ! -f "${IAW_LOCAL_DIR}/${dc_file}" ]; then
git clone https://github.com/orboan/iaw-local.git
fi
if [ -d "$DATA_DIR/iaw-local" ]; then
yes | cp -rf $DATA_DIR/iaw-local/* $DATA_DIR/
rm -rf $DATA_DIR/iaw-local
fi
cd $IAW_LOCAL_DIR
if [ -f "${dc_file}" ]; then
docker-compose up -d
fi
}
run_containers
wait
wp_config_init
exit 0