Skip to content

Commit

Permalink
refactor: clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
fcwu committed Feb 26, 2017
1 parent 0c04c5e commit 0f153bc
Show file tree
Hide file tree
Showing 1,266 changed files with 15 additions and 264,743 deletions.
14 changes: 5 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ MAINTAINER Doro Wu <[email protected]>
ENV DEBIAN_FRONTEND noninteractive
ENV HOME /home/ubuntu

RUN sed -i 's#http://archive.ubuntu.com/#http://tw.archive.ubuntu.com/#' /etc/apt/sources.list

# built-in packages
RUN apt-get update \
&& apt-get install -y --force-yes --no-install-recommends software-properties-common curl \
Expand All @@ -28,21 +30,15 @@ RUN apt-get update \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*

ADD web /web/
RUN pip install setuptools wheel && pip install -r /web/requirements.txt

# tini for subreap
ENV TINI_VERSION v0.9.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /bin/tini
RUN chmod +x /bin/tini

ADD noVNC /noVNC/
ADD nginx.conf /etc/nginx/sites-enabled/default
ADD startup.sh /
ADD supervisord.conf /etc/supervisor/conf.d/
ADD doro-lxde-wallpapers /usr/share/doro-lxde-wallpapers/
ADD gtkrc-2.0 /home/ubuntu/.gtkrc-2.0
ADD image /
RUN pip install setuptools wheel && pip install -r /usr/lib/web/requirements.txt

EXPOSE 6080
EXPOSE 80
WORKDIR /root
ENTRYPOINT ["/startup.sh"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ docker build --rm -t dorowu/ubuntu-desktop-lxde-vnc docker-ubuntu-vnc-desktop

Run
```
docker run -i -t -p 6080:6080 dorowu/ubuntu-desktop-lxde-vnc
docker run -it --rm -p 6080:80 dorowu/ubuntu-desktop-lxde-vnc
```

Browse http://127.0.0.1:6080/vnc.html
Browse http://127.0.0.1:6080/

<img src="https://raw.github.com/fcwu/docker-ubuntu-vnc-desktop/master/screenshots/lxde.png" width=400/>

Expand All @@ -34,4 +34,4 @@ Troubleshooting
License
==================

desktop-mirror is under the Apache 2.0 license. See the LICENSE file for details.
See the LICENSE file for details.
2 changes: 1 addition & 1 deletion nginx.conf → image/etc/nginx/sites-enabled/default
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
listen 6080 default_server;
listen 80 default_server;
#listen [::]:6080 default_server ipv6only=on;

root /usr/share/nginx/html;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ redirect_stderr=true
[program:x11vnc]
priority=20
directory=/
command=x11vnc -display :1 -xkb -forever
command=x11vnc -display :1 -xkb -forever -shared
user=root
autostart=true
autorestart=true
Expand All @@ -34,8 +34,8 @@ redirect_stderr=true

[program:novnc]
priority=25
directory=/noVNC
command=/noVNC/utils/launch.sh --listen 6081
directory=/usr/lib/noVNC/
command=/usr/lib/noVNC/utils/launch.sh --listen 6081
user=root
autostart=true
autorestart=true
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion startup.sh → image/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ PASS=ubuntu
# echo "Username: ubuntu Password: $PASS"
id -u ubuntu &>/dev/null || useradd --create-home --shell /bin/bash --user-group --groups adm,sudo ubuntu
echo "ubuntu:$PASS" | chpasswd
chown -R ubuntu:ubuntu /home/ubuntu
sudo -u ubuntu -i bash -c "mkdir -p /home/ubuntu/.config/pcmanfm/LXDE/ \
&& cp /usr/share/doro-lxde-wallpapers/desktop-items-0.conf /home/ubuntu/.config/pcmanfm/LXDE/"

cd /web && ./run.py > /var/log/web.log 2>&1 &
cd /usr/lib/web && ./run.py > /var/log/web.log 2>&1 &
nginx -c /etc/nginx/nginx.conf
exec /bin/tini -- /usr/bin/supervisord -n
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ fi

echo "Starting webserver and WebSockets proxy on port ${PORT}"
#${HERE}/websockify --web ${WEB} ${CERT:+--cert ${CERT}} ${PORT} ${VNC_DEST} &
${WEBSOCKIFY} ${SSLONLY} --web ${WEB} ${CERT:+--cert ${CERT}} ${PORT} ${VNC_DEST} &
exec ${WEBSOCKIFY} ${SSLONLY} --web ${WEB} ${CERT:+--cert ${CERT}} ${PORT} ${VNC_DEST}
proxy_pid="$!"
sleep 1
if ! ps -p ${proxy_pid} >/dev/null; then
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
CONFIG = os.environ.get('CONFIG') or 'config.Development'
app.config.from_object('config.Default')
app.config.from_object(CONFIG)
app.config.from_pyfile('application.cfg')

# logging
import logging
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 0 additions & 25 deletions web/run.py → image/usr/lib/web/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,7 @@ def killpg(pgid, send_signal=signal.SIGKILL):
pass


def create_instance_config():
if not os.path.exists('instance'):
os.makedirs('instance')

with open(os.path.join('instance', 'application.cfg'), 'wb+') as f:
f.write('SECRET_KEY = \'')
f.write("".join("\\x{:02x}".format(ord(c)) for c in os.urandom(24)))
f.write('\'\n')
f.write('VERSION = \'')
if os.path.exists('version'):
with open('version') as fv:
version = fv.read().strip()
f.write(version)
else:
f.write('unknown')
f.write('\'\n')
if '--debug' not in sys.argv:
os.chmod(os.path.join('instance', 'application.cfg'), 0600)


def main():
create_instance_config()

def run_server():
import socket

Expand Down Expand Up @@ -124,9 +102,6 @@ def run_server():
CONFIG = 'config.Staging' if STAGING else CONFIG
PORT = 6079
PROGRAMS = tuple()
#PROGRAMS = (('sudo nginx -c ${PWD}/nginx.conf'),)
#PROGRAMS = ('python lxc-monitor.py',
# 'python docker-monitor.py')
signal.signal(signal.SIGCHLD, signal.SIG_IGN)

if DEBUG or STAGING:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
1 change: 0 additions & 1 deletion repositories

This file was deleted.

1 change: 0 additions & 1 deletion tty.js/node_modules/.bin/tty.js

This file was deleted.

11 changes: 0 additions & 11 deletions tty.js/node_modules/tty.js/.npmignore

This file was deleted.

19 changes: 0 additions & 19 deletions tty.js/node_modules/tty.js/LICENSE

This file was deleted.

170 changes: 0 additions & 170 deletions tty.js/node_modules/tty.js/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions tty.js/node_modules/tty.js/bin/tty.js

This file was deleted.

1 change: 0 additions & 1 deletion tty.js/node_modules/tty.js/index.js

This file was deleted.

Loading

0 comments on commit 0f153bc

Please sign in to comment.