-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
73 lines (56 loc) · 2.6 KB
/
install.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
. "services/sh/libs/colors.sh"
. "services/sh/libs/functions.sh"
ENV_FILE="$(pwd)/services/database/.env";
if [ -f "$ENV_FILE" ]; then
echo "Sorry, DockLAMP is already installed.";
exit 0;
fi
docker network create nginx-proxy > /dev/null 2>&1
docker network create mysql > /dev/null 2>&1
docker network create postgres > /dev/null 2>&1
export MYSQL_ROOT_PASSWORD=$(getRandStr) MYSQL_PASSWORD=$(getRandStr) PG_PASSWORD=$(getRandStr) PGADMIN_DEFAULT_PASS=$(getRandStr);
envsubst '${MYSQL_ROOT_PASSWORD} ${MYSQL_PASSWORD} ${PG_PASSWORD} ${PGADMIN_DEFAULT_PASS}' <"./services/database/env.dist" >"$ENV_FILE"
make start
PHPMYADMIN_VIRTUAL_HOST=$(grep 'PHPMYADMIN_VIRTUAL_HOST' $ENV_FILE | cut -d '=' -f2);
PG_ADMIN_VIRTUAL_HOST=$(grep 'PG_ADMIN_VIRTUAL_HOST' $ENV_FILE | cut -d '=' -f2);
addHost "$PHPMYADMIN_VIRTUAL_HOST" "127.0.0.1\t$PHPMYADMIN_VIRTUAL_HOST"
addHost "$PG_ADMIN_VIRTUAL_HOST" "127.0.0.1\t$PG_ADMIN_VIRTUAL_HOST"
echo -e "MySQL Server:";
echo '';
echo -e "\tAddess: "$(grep 'MYSQL_HOST' $ENV_FILE | cut -d '=' -f2);
echo -e "\tphpMyAdmin: http://$PHPMYADMIN_VIRTUAL_HOST";
echo '';
echo -e "\tMySQL Root User:"
echo -e "\tLogin: "$(grep 'MYSQL_ROOT_USER' $ENV_FILE | cut -d '=' -f2);
echo -e "\tPassword: "$(grep 'MYSQL_ROOT_PASSWORD' $ENV_FILE | cut -d '=' -f2);
echo '';
echo -e "\tMySQL Default User:"
echo -e "\t\tDatabase: "$(grep 'MYSQL_DATABASE' $ENV_FILE | cut -d '=' -f2);
echo -e "\t\tLogin: "$(grep 'MYSQL_USER' $ENV_FILE | cut -d '=' -f2);
echo -e "\t\tPassword: "$(grep 'MYSQL_PASSWORD' $ENV_FILE | cut -d '=' -f2);
echo '';
echo -e "PostgreSQL Server:"
echo '';
echo -e "\tAddess: "$(grep 'PG_HOST' $ENV_FILE | cut -d '=' -f2);
echo -e "\tPgAdmin: http://$PG_ADMIN_VIRTUAL_HOST";
echo '';
echo -e "\tPostgreSQL Database User:"
echo -e "\t\tLogin: "$(grep 'MYSQL_USER' $ENV_FILE | cut -d '=' -f2);
echo -e "\t\tPassword: "$(grep 'PG_PASSWORD' $ENV_FILE | cut -d '=' -f2);
echo '';
echo -e "\tPgAdmin user:"
echo -e "\t\tDatabase: "$(grep 'PG_DATABASE' $ENV_FILE | cut -d '=' -f2);
echo -e "\t\tLogin: "$(grep 'PGADMIN_DEFAULT_EMAIL' $ENV_FILE | cut -d '=' -f2);
echo -e "\t\tPassword: "$(grep 'PGADMIN_DEFAULT_PASS' $ENV_FILE | cut -d '=' -f2);
echo '';
echo -e "\tDockLAMP Copyright (C) 2020 Yevgen Shevchenko";
echo -e "\tThis program comes with ABSOLUTELY NO WARRANTY;";
echo -e "\tThis is free software, and you are welcome to redistribute it";
echo -e "\tunder certain conditions; type \"make about\" for details.";
echo '';
echo -e "You can always find root db creadentials are in $ENV_FILE";
echo '';
echo 'Installation complite! Run "make" for help';
echo '';
#rm -f install.sh