-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunonce-odoo.sh
executable file
·54 lines (43 loc) · 1.24 KB
/
runonce-odoo.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
#!/bin/sh
progress() {
current_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
local action="$1"
echo "🟩 $current_date $action"
}
# Perform tasks ths should run as odoo user at pod startup
progress "Runonce started";
cd /mnt/extra-addons;
# Seems that this is first run in devel instance
# Intialize persistant storage
if [ ! "$(ls -A /mnt/extra-addons)" ]; then
progress "Pulling code";
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;
# Configure the SQLTools VSCode extension
# TODO: How to update these if env changes?
cat > /mnt/extra-addons/.vscode/settings.json << EOL
{
"sqltools.connections": [
{
"previewLimit": 50,
"server": "$POSTGRES_HOST",
"port": $POSTGRES_PORT,
"driver": "PostgreSQL",
"name": "PostgreSQL",
"database": "$POSTGRES_DB",
"username": "$POSTGRES_USER",
"password": "$POSTGRES_PASSWORD",
}
]
}
EOL
fi
# Wait for database and initialize odoo and set admin password on first run
progress "Initializing Odoo";
python3 /odoo-init.py;
progress "Runonce done";
exit 0;