refactor: code structure

1. move folders from /usr/* to /usr/local/*
2. supervisord controls everything
This commit is contained in:
Doro Wu 2018-03-13 16:42:22 +08:00
parent 9e608482c8
commit f5da5d152f
232 changed files with 41 additions and 45 deletions

View file

@ -34,7 +34,11 @@ ARG TINI_VERSION=v0.9.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /bin/tini
RUN chmod +x /bin/tini
ADD image/usr/lib/web/requirements.txt /tmp/
# ffmpeg
RUN mkdir -p /usr/local/ffmpeg \
&& curl -sSL https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz | tar xJvf - -C /usr/local/ffmpeg/ --strip 1
ADD image/usr/local/lib/web/requirements.txt /tmp/
RUN pip install setuptools wheel && pip install -r /tmp/requirements.txt
ADD image /

View file

@ -1,68 +1,59 @@
[supervisord]
redirect_stderr=true
stopsignal=QUIT
autorestart=true
directory=/root
[program:nginx]
priority=10
command=nginx -c /etc/nginx/nginx.conf -g 'daemon off;'
stdout_logfile=/var/log/nginx.log
[program:web]
priority=10
directory=/usr/local/lib/web
command=/usr/local/lib/web/run.py
stdout_logfile=/var/log/web.log
[group:x]
programs=xvfb,wm,lxpanel,pcmanfm,x11vnc,novnc
[program:xvfb]
priority=10
directory=/
command=/usr/bin/Xvfb :1 -screen 0 1024x768x16
user=root
autostart=true
autorestart=true
command=/usr/local/bin/xvfb.sh
stopsignal=KILL
stdout_logfile=/var/log/xvfb.log
redirect_stderr=true
[program:wm]
priority=15
directory=/root
command=/usr/bin/openbox
user=root
autostart=true
autorestart=true
stopsignal=QUIT
environment=DISPLAY=":1",HOME="/root",USER="root"
stdout_logfile=/var/log/openbox.log
redirect_stderr=true
[program:lxpanel]
priority=15
directory=%HOME%
command=/usr/bin/lxpanel --profile LXDE
user=%USER%
autostart=true
autorestart=true
stopsignal=QUIT
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"
stdout_logfile=/var/log/lxpanel.log
redirect_stderr=true
[program:pcmanfm]
priority=15
directory=%HOME%
command=/usr/bin/pcmanfm --desktop --profile LXDE
user=%USER%
autostart=true
autorestart=true
stopsignal=QUIT
environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%"
stdout_logfile=/var/log/pcmanfm.log
[program:x11vnc]
priority=20
directory=/
command=x11vnc -display :1 -xkb -forever -shared -repeat
user=root
autostart=true
autorestart=true
stopsignal=QUIT
stdout_logfile=/var/log/x11vnc.log
redirect_stderr=true
[program:novnc]
priority=25
directory=/usr/lib/noVNC/
command=/usr/lib/noVNC/utils/launch.sh --listen 6081
user=root
autostart=true
autorestart=true
stopsignal=QUIT
directory=/usr/local/lib/novnc/
command=/usr/local/lib/novnc/utils/launch.sh --listen 6081
stdout_logfile=/var/log/novnc.log
redirect_stderr=true
stopasgroup=true

View file

@ -22,19 +22,17 @@ if [ "$USER" != "root" ]; then
fi
HOME=/home/$USER
echo "$USER:$PASSWORD" | chpasswd
cp -r /root/.gtkrc-2.0 ${HOME}
cp -r /root/.* ${HOME}
fi
sed -i "s|%USER%|$USER|" /etc/supervisor/conf.d/supervisord.conf
sed -i "s|%HOME%|$HOME|" /etc/supervisor/conf.d/supervisord.conf
# home folder
mkdir -p $HOME/.config/pcmanfm/LXDE/
ln -sf /usr/share/doro-lxde-wallpapers/desktop-items-0.conf $HOME/.config/pcmanfm/LXDE/
ln -sf /usr/local/share/doro-lxde-wallpapers/desktop-items-0.conf $HOME/.config/pcmanfm/LXDE/
chown -R $USER:$USER $HOME
# clearup
PASSWORD=
cd /usr/lib/web && ./run.py 2>&1 &
nginx -c /etc/nginx/nginx.conf
exec /bin/tini -- /usr/bin/supervisord -n

3
image/usr/local/bin/xvfb.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
exec /usr/bin/Xvfb :1 -screen 0 1024x768x16

View file

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

Before

Width:  |  Height:  |  Size: 675 B

After

Width:  |  Height:  |  Size: 675 B

View file

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View file

Before

Width:  |  Height:  |  Size: 1,000 B

After

Width:  |  Height:  |  Size: 1,000 B

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

View file

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View file

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View file

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View file

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View file

Before

Width:  |  Height:  |  Size: 3 KiB

After

Width:  |  Height:  |  Size: 3 KiB

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Some files were not shown because too many files have changed in this diff Show more