File size: 950 Bytes
0d6004f
 
 
 
47ec002
 
 
0d6004f
47ec002
 
c59f4dd
 
 
47ec002
0d6004f
 
 
 
bdb2d27
 
0d6004f
47ec002
 
 
0d6004f
 
4dc2336
 
0d6004f
b1bd7d1
 
 
 
0d6004f
9c1ef9f
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
#!/bin/bash
set -e

PHP_WWW_DIR="/home/www"
OP_DATA_DIR="/home/www/opencode"
OP_CONFIG_DIR="/root/.opencode"
OP_BACKUP_DIR="/app/defaults/opencode"

echo "--- Starting Runtime Initialization ---"

mkdir -p /run/php /var/cache/nginx /var/log/nginx
mkdir -p /tmp/nginx_body /tmp/nginx_proxy /tmp/nginx_fastcgi /tmp/nginx_uwsgi /tmp/nginx_scgi
chown -R root:root /var/cache/nginx /var/log/nginx

if [ ! -f "$PHP_WWW_DIR/ftp.php" ]; then
    mkdir -p "$PHP_WWW_DIR"
    cp -r /app/defaults/www/* "$PHP_WWW_DIR/"
fi
chown -R www-data:www-data "$PHP_WWW_DIR"
chmod -R 755 "$PHP_WWW_DIR"

mkdir -p "$OP_DATA_DIR"
if [ ! -d "$OP_DATA_DIR/.opencode" ]; then
    cp -r "$OP_BACKUP_DIR/.opencode" "$OP_DATA_DIR/"
fi

rm -rf "$OP_CONFIG_DIR"
ln -s "$OP_DATA_DIR/.opencode" "$OP_CONFIG_DIR"

echo "--- Testing Nginx Configuration ---"
nginx -t 2>&1 || true

echo "--- Starting Supervisor ---"
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf