forked from eduvpn/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevelopment_setup.sh
executable file
·146 lines (130 loc) · 5.74 KB
/
development_setup.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
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
136
137
138
139
140
141
142
143
144
145
146
#!/bin/sh
LC_BRANCH=v2
BASE_DIR=${HOME}/Projects/LC-${LC_BRANCH}
mkdir -p "${BASE_DIR}"
cd "${BASE_DIR}" || exit
# clone repositories (read-only)
git clone -b "${LC_BRANCH}" https://github.com/eduvpn/vpn-lib-common.git
git clone -b "${LC_BRANCH}" https://github.com/eduvpn/vpn-user-portal.git
git clone -b "${LC_BRANCH}" https://github.com/eduvpn/vpn-server-api.git
git clone -b "${LC_BRANCH}" https://github.com/eduvpn/vpn-server-node.git
git clone -b "${LC_BRANCH}" https://github.com/eduvpn/documentation.git
git clone -b master https://github.com/eduvpn/vpn-portal-artwork.git vpn-portal-artwork-eduVPN
git clone -b master https://github.com/letsconnectvpn/vpn-portal-artwork.git vpn-portal-artwork-LC
git clone -b master https://github.com/letsconnectvpn/vpn-ca.git
git clone -b master https://github.com/letsconnectvpn/vpn-daemon.git
git clone -b master https://github.com/letsconnectvpn/vpn-maint-scripts.git
## clone all repositories (read/write, my own "forks")
#git clone -b ${LC_BRANCH} [email protected]:LC/vpn-lib-common.git
#(cd vpn-lib-common && git remote add github [email protected]:eduvpn/vpn-lib-common.git)
#git clone -b ${LC_BRANCH} [email protected]:LC/vpn-user-portal.git
#(cd vpn-user-portal && git remote add github [email protected]:eduvpn/vpn-user-portal.git)
#git clone -b ${LC_BRANCH} [email protected]:LC/vpn-server-api.git
#(cd vpn-server-api && git remote add github [email protected]:eduvpn/vpn-server-api.git)
#git clone -b ${LC_BRANCH} [email protected]:LC/vpn-server-node.git
#(cd vpn-server-node && git remote add github [email protected]:eduvpn/vpn-server-node.git)
#git clone -b ${LC_BRANCH} [email protected]:LC/documentation.git
#(cd documentation && git remote add github [email protected]:eduvpn/documentation.git)
#git clone -b master [email protected]:LC/vpn-portal-artwork-eduVPN.git
#(cd vpn-portal-artwork-eduVPN && git remote add github [email protected]:eduvpn/vpn-portal-artwork.git)
#git clone -b master [email protected]:LC/vpn-portal-artwork-LC.git
#(cd vpn-portal-artwork-LC && git remote add github [email protected]:letsconnectvpn/vpn-portal-artwork.git)
#git clone -b master [email protected]:LC/vpn-ca.git
#(cd vpn-ca && git remote add github [email protected]:letsconnectvpn/vpn-ca.git)
#git clone -b master [email protected]:LC/vpn-daemon.git
#(cd vpn-daemon && git remote add github [email protected]:letsconnectvpn/vpn-daemon.git)
#git clone -b master [email protected]:LC/vpn-maint-scripts.git
#(cd vpn-daemon && git remote add github [email protected]:letsconnectvpn/vpn-maint-scripts.git)
# clone all RPM packages
mkdir -p rpm
for PACKAGE_NAME in vpn-daemon php-LC-common php-LC-openvpn-connection-manager php-fkooman-jwt php-fkooman-oauth2-server php-fkooman-otp-verifier php-saml-sp php-saml-sp-artwork-eduVPN php-fkooman-secookie php-fkooman-sqlite-migrate vpn-ca vpn-portal-artwork-LC vpn-portal-artwork-eduVPN vpn-server-api vpn-server-node vpn-user-portal vpn-maint-scripts
do
git clone -b master https://git.tuxed.net/rpm/"${PACKAGE_NAME}" rpm/"${PACKAGE_NAME}"
#git clone -b master [email protected]:rpm/${PACKAGE_NAME}.git rpm/${PACKAGE_NAME}
done
######################################
# vpn-user-portal #
######################################
cd "${BASE_DIR}/vpn-user-portal" || exit
mkdir -p data
composer update
cat << 'EOF' > config/config.php
<?php
$baseConfig = include __DIR__.'/config.php.example';
$localConfig = [
//'styleName' => 'eduVPN',
//'styleName' => 'LC',
'secureCookie' => false,
'apiUri' => 'http://localhost:8008/api.php',
];
return array_merge($baseConfig, $localConfig);
EOF
php bin/init.php
php bin/generate-oauth-key.php
php bin/add-user.php --user foo --pass bar
php bin/add-user.php --user admin --pass secret
# symlink to the official templates we have so we can easily modify and test
# them
mkdir -p web/css web/img web/fonts
for TPL in eduVPN LC
do
ln -s "${BASE_DIR}/vpn-portal-artwork-${TPL}/views" "views/${TPL}"
ln -s "${BASE_DIR}/vpn-portal-artwork-${TPL}/locale" "locale/${TPL}"
ln -s "${BASE_DIR}/vpn-portal-artwork-${TPL}/css" "web/css/${TPL}"
ln -s "${BASE_DIR}/vpn-portal-artwork-${TPL}/img" "web/img/${TPL}"
ln -s "${BASE_DIR}/vpn-portal-artwork-${TPL}/fonts" "web/fonts/${TPL}"
done
######################################
# vpn-ca #
######################################
cd "${BASE_DIR}/vpn-ca" || exit
go build -o _bin/vpn-ca vpn-ca/*.go
######################################
# vpn-daemon #
######################################
cd "${BASE_DIR}/vpn-daemon" || exit
go build -o _bin/vpn-daemon vpn-daemon/*.go
######################################
# vpn-server-api #
######################################
cd "${BASE_DIR}/vpn-server-api" || exit
mkdir -p data
composer update
cat << EOF > config/config.php
<?php
\$baseConfig = include __DIR__.'/config.php.example';
\$localConfig = [
'vpnCaPath' => '${BASE_DIR}/vpn-ca/_bin/vpn-ca',
];
return array_merge(\$baseConfig, \$localConfig);
EOF
php bin/init.php
######################################
# vpn-server-node #
######################################
cd "${BASE_DIR}/vpn-server-node" || exit
mkdir -p data openvpn-config
composer update
cat << 'EOF' > config/config.php
<?php
$baseConfig = include __DIR__.'/config.php.example';
$localConfig = [
'apiUri' => 'http://localhost:8008/api.php',
];
return array_merge($baseConfig, $localConfig);
EOF
######################################
# launch script #
######################################
cat << 'EOF' | tee "${BASE_DIR}/launch.sh" > /dev/null
#!/bin/sh
(
cd vpn-server-api || exit
php -S localhost:8008 -t web &
)
(
cd vpn-user-portal || exit
php -S localhost:8082 -t web &
)
EOF
chmod +x "${BASE_DIR}/launch.sh"