-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunonce.sh
44 lines (31 loc) · 1.09 KB
/
runonce.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
#!/bin/sh
# Perform tasks at controller pod startup
echo "Runonce started";
# Insert accepted ssh key(s)
cat /etc/ssh/internal_ssh_host_rsa.pub >> /root/.ssh/authorized_keys;
# Update internal ca certificate
update-ca-certificates
# Make all special env variables available in ssh also (ssh will wipe out env by default)
env >> /etc/environment
cd /app;
# Seems that this is first run in devel instance
# Intialize persistant storage
if [ ! "$(ls -A /app)" ]; then
echo "Empty /app, assuming development instance setup was intended"
#tar zxf /var/lib/diploi-app.tar.gz -C /
mkdir -p /root-persist/.vscode-server;
touch /root-persist/.bash_history;
touch /root-persist/.gitconfig;
git config init.defaultBranch main
git init;
git config credential.helper '!diploi-credential-helper';
git remote add --fetch origin $REPOSITORY_URL;
git checkout -f $REPOSITORY_BRANCH;
git remote set-url origin "$REPOSITORY_URL";
git config --unset credential.helper;
npm install;
fi
# Now that everything is initialized, start all services
supervisorctl start app
echo "Runonce done";
exit 0;