-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprepare-project.sh
executable file
·32 lines (27 loc) · 1.17 KB
/
prepare-project.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
#!/bin/sh
echo "***********************************"
printf "*** prepare project script\n"
echo "---------------------------------------------------"
printf "| $(hostname -i) $DOCKER_DOMAIN | \n"
echo "---------------------------------------------------"
if [ ! -e "project-initialized.flag" ]
then
### create project dir
printf "*** creating project structure for domain ${DOCKER_DOMAIN} \n"
mkdir -p /var/www/share/${DOCKER_DOMAIN}/htdocs
mkdir -p /var/www/share/${DOCKER_DOMAIN}/repos
mv /var/www/share/info.php /var/www/share/${DOCKER_DOMAIN}/htdocs/
printf "*** setting vhost\n"
sed -i s/DOCKER_DOMAIN/${DOCKER_DOMAIN}/g /etc/apache2/sites-available/000-default.conf
### create cert
printf "*** creating ssl cert\n"
openssl req -x509 -sha256 -newkey rsa:2048 \
-keyout /etc/apache2/certs/${DOCKER_DOMAIN}.local.key \
-out /etc/apache2/certs/${DOCKER_DOMAIN}.cert.pem -days 1240 -nodes \
-subj "/C=DE/ST=NRW/L=COLOGNE/O=CTS GmbH/OU=IT/CN=${DOCKER_DOMAIN}"
printf "*** creating project initialized flag\n"
touch project-initialized.flag
else
printf "*** initialized flag found. Nothing to be done here\n"
fi
printf "\n"