diff --git a/.semaphore/pipeline_2.yml b/.semaphore/pipeline_2.yml index 80e578c..86e9823 100644 --- a/.semaphore/pipeline_2.yml +++ b/.semaphore/pipeline_2.yml @@ -13,11 +13,16 @@ blocks: - checkout - git submodule update --init --recursive - 'docker pull $DOCKER_USERNAME/cloud9-ide-vdi:latest || true' + - 'cd /workspace/configuration && ./configure.py --desktop enabled' - 'docker build --cache-from=$DOCKER_USERNAME/cloud9-ide-vdi:latest -t devindice/cloud9-ide-vdi .' - '# Login to Dockerhub' - 'echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin' - '# Create a version' - 'docker image tag devindice/cloud9-ide-vdi:latest devindice/cloud9-ide-vdi:testing' - 'docker push $DOCKER_USERNAME/cloud9-ide-vdi:testing' + - 'cd /workspace/configuration && ./configure.py --desktop disabled' + - 'docker build --cache-from=$DOCKER_USERNAME/cloud9-ide-vdi:latest -t devindice/cloud9-ide-vdi .' + - 'docker image tag devindice/cloud9-ide-vdi:latest devindice/cloud9-ide-vdi:no-desktop-testing' + - 'docker push $DOCKER_USERNAME/cloud9-ide-vdi:no-desktop-testing' secrets: - name: Dockerhub diff --git a/Dockerfile.j2 b/Dockerfile.j2 deleted file mode 100644 index 7b339d0..0000000 --- a/Dockerfile.j2 +++ /dev/null @@ -1,137 +0,0 @@ -# Built with arch: {{ arch }} flavor: {{ flavor }} image: {{ image }} -# -################################################################################ -# base system -################################################################################ -{%if arch == "amd64"%} -FROM {{image}} as system -{%elif arch == "armhf"%} -# qemu helper for arm build -FROM {{image}} as amd64 -RUN apt update && apt install -y qemu-user-static -FROM arm32v7/{{image}} as system -COPY --from=amd64 /usr/bin/qemu-arm-static /usr/bin/ -{%endif%} - -RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list; - -# built-in packages -ENV DEBIAN_FRONTEND noninteractive -RUN apt update \ - && apt install -y --no-install-recommends software-properties-common curl apache2-utils \ - && apt update \ - && apt install -y --no-install-recommends --allow-unauthenticated \ - supervisor nginx sudo net-tools zenity xz-utils \ - dbus-x11 x11-utils alsa-utils \ - mesa-utils libgl1-mesa-dri \ - && apt autoclean -y \ - && apt autoremove -y \ - && rm -rf /var/lib/apt/lists/* -# install debs error if combine together -RUN apt update \ - && apt install -y --no-install-recommends --allow-unauthenticated \ - xvfb x11vnc \ - vim-tiny firefox ttf-ubuntu-font-family ttf-wqy-zenhei \ - && apt autoclean -y \ - && apt autoremove -y \ - && rm -rf /var/lib/apt/lists/* -RUN apt update \ - && apt install -y gpg-agent \ - && curl -LO https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ - && (dpkg -i ./google-chrome-stable_current_amd64.deb || apt-get install -fy) \ - && curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add \ - && rm google-chrome-stable_current_amd64.deb \ - && rm -rf /var/lib/apt/lists/* -{%if desktop == "lxde" %} -{%endif%} -{%if desktop == "lxqt" %} -{%endif%} -{%if desktop == "xfce4" %} -{%endif%} -RUN apt update \ - && apt install -y --no-install-recommends --allow-unauthenticated \ - lxde gtk2-engines-murrine gnome-themes-standard gtk2-engines-pixbuf gtk2-engines-murrine arc-theme \ - && apt autoclean -y \ - && apt autoremove -y \ - && rm -rf /var/lib/apt/lists/* -# Additional packages require ~600MB -# libreoffice pinta language-pack-zh-hant language-pack-gnome-zh-hant firefox-locale-zh-hant libreoffice-l10n-zh-tw - -# tini to fix subreap -ARG TINI_VERSION=v0.18.0 -ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /bin/tini -RUN chmod +x /bin/tini - -# ffmpeg -RUN apt update \ - && apt install -y --no-install-recommends --allow-unauthenticated \ - ffmpeg \ - && rm -rf /var/lib/apt/lists/* \ - && mkdir /usr/local/ffmpeg \ - && ln -s /usr/bin/ffmpeg /usr/local/ffmpeg/ffmpeg - -# python library -COPY rootfs/usr/local/lib/web/backend/requirements.txt /tmp/ -RUN apt-get update \ - && dpkg-query -W -f='${Package}\n' > /tmp/a.txt \ - && apt-get install -y python3-pip python3-dev build-essential \ - && pip3 install setuptools wheel && pip3 install -r /tmp/requirements.txt \ - && ln -s /usr/bin/python3 /usr/local/bin/python \ - && dpkg-query -W -f='${Package}\n' > /tmp/b.txt \ - && apt-get remove -y `diff --changed-group-format='%>' --unchanged-group-format='' /tmp/a.txt /tmp/b.txt | xargs` \ - && apt-get autoclean -y \ - && apt-get autoremove -y \ - && rm -rf /var/lib/apt/lists/* \ - && rm -rf /var/cache/apt/* /tmp/a.txt /tmp/b.txt - - -################################################################################ -# builder -################################################################################ -FROM {{image}} as builder - -{% if localbuild == 1 %} -RUN sed -i 's#http://archive.ubuntu.com/ubuntu/#mirror://mirrors.ubuntu.com/mirrors.txt#' /etc/apt/sources.list; -{% endif %} - -RUN apt-get update \ - && apt-get install -y --no-install-recommends curl ca-certificates gnupg patch - -# nodejs -RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \ - && apt-get install -y nodejs - -# yarn -RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ - && apt-get update \ - && apt-get install -y yarn - -# build frontend -COPY web /src/web -RUN cd /src/web \ - && yarn \ - && yarn build -RUN sed -i 's#app/locale/#novnc/app/locale/#' /src/web/dist/static/novnc/app/ui.js - -{%if arch == "armhf"%} -RUN cd /src/web/dist/static/novnc && patch -p0 < /src/web/novnc-armhf-1.patch -{%endif%} - -################################################################################ -# merge -################################################################################ -FROM system -LABEL maintainer="fcwu.tw@gmail.com" - -COPY --from=builder /src/web/dist/ /usr/local/lib/web/frontend/ -COPY rootfs / -RUN ln -sf /usr/local/lib/web/frontend/static/websockify /usr/local/lib/web/frontend/static/novnc/utils/websockify && \ - chmod +x /usr/local/lib/web/frontend/static/websockify/run - -EXPOSE 80 -WORKDIR /root -ENV HOME=/home/ubuntu \ - SHELL=/bin/bash -HEALTHCHECK --interval=30s --timeout=5s CMD curl --fail http://127.0.0.1:6079/api/health -ENTRYPOINT ["/startup.sh"] diff --git a/rootfs/etc/nginx/sites-enabled/default b/rootfs/etc/nginx/sites-enabled/default index d687d5f..9e4c971 100644 --- a/rootfs/etc/nginx/sites-enabled/default +++ b/rootfs/etc/nginx/sites-enabled/default @@ -1,52 +1,7 @@ server { listen 6080 default_server; - # listen [::]:80 default_server ipv6only=on; - - #_SSL_PORT_#listen 443 ssl default_server; - #_SSL_PORT_#listen [::]:443 ssl default_server ipv6only=on; - #_SSL_PORT_#ssl_certificate /etc/nginx/ssl/nginx.crt; - #_SSL_PORT_#ssl_certificate_key /etc/nginx/ssl/nginx.key; - #_HTTP_PASSWORD_#auth_basic "Private Property"; - #_HTTP_PASSWORD_#auth_basic_user_file /etc/nginx/.htpasswd; - - root /usr/local/lib/web/frontend/; + root /usr/local/lib/web/disabled/; index index.html index.htm; - - #_RELATIVE_URL_ROOT_location /_RELATIVE_URL_ROOT_/ { - #_RELATIVE_URL_ROOT_ rewrite /_RELATIVE_URL_ROOT_/(.*) /$1 break; - #_RELATIVE_URL_ROOT_ root /usr/local/lib/web/frontend/; - #_RELATIVE_URL_ROOT_} - - location ~ .*/(api/.*|websockify) { - try_files $uri @api$http_upgrade; - } - - location / { - rewrite /approot/(.*) /$1 break; - root /usr/local/lib/web/frontend/; - } - - location @apiwebsocket { - #_RELATIVE_URL_ROOT_rewrite /_RELATIVE_URL_ROOT_/(.*) $1 break; - proxy_connect_timeout 7d; - proxy_send_timeout 7d; - proxy_read_timeout 7d; - proxy_buffering off; - - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_pass http://127.0.0.1:6081; - } - - location @api { - #_RELATIVE_URL_ROOT_rewrite /_RELATIVE_URL_ROOT_/(.*) $1 break; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $host; - max_ranges 0; - proxy_pass http://127.0.0.1:6079; - } -} - + +} \ No newline at end of file diff --git a/rootfs/etc/supervisor/conf.d/supervisord.conf b/rootfs/etc/supervisor/conf.d/supervisord.conf index 392cfbc..bea2dc8 100644 --- a/rootfs/etc/supervisor/conf.d/supervisord.conf +++ b/rootfs/etc/supervisor/conf.d/supervisord.conf @@ -8,17 +8,10 @@ directory=/root priority=10 command=nginx -c /etc/nginx/nginx.conf -g 'daemon off;' -[program:web] -priority=10 -directory=/usr/local/lib/web/backend -command=/usr/local/lib/web/backend/run.py -stdout_logfile=/dev/fd/1 -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/fd/1 -stderr_logfile_maxbytes=0 [group:x] -programs=xfce4,xvfb,x11vnc,novnc,cloud9 +programs=cloud9 + [program:xfce4] priority=15 @@ -53,3 +46,9 @@ priority=30 directory=/home/%USER%/.dynamic-background/active user=%USER% command=bash /usr/share/backgrounds/dynamic.sh + +[program:desktop] +priority=25 +directory=/cloud9/c9sdk +user=%USER% +command=bash -c 'while ps aux | grep user-install.sh | grep -v grep 2>&1> /dev/null; do sleep 1; done; node server.js -l 0.0.0.0 -p 9999 -a : -w /workspace' diff --git a/rootfs/etc/supervisor/conf.d/supervisord.conf.j2 b/rootfs/etc/supervisor/conf.d/supervisord.conf.j2 deleted file mode 100644 index 36befd5..0000000 --- a/rootfs/etc/supervisor/conf.d/supervisord.conf.j2 +++ /dev/null @@ -1,86 +0,0 @@ -[supervisord] -redirect_stderr=true -stopsignal=QUIT -autorestart=true -directory=/root - -[program:nginx] -priority=10 -command=nginx -c /etc/nginx/nginx.conf -g 'daemon off;' - -[program:web] -priority=10 -directory=/usr/local/lib/web/backend -command=/usr/local/lib/web/backend/run.py -stdout_logfile=/dev/fd/1 -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/fd/1 -stderr_logfile_maxbytes=0 - -{% if desktop == "lxde" %} -[group:x] -programs=xvfb,wm,lxpanel,pcmanfm,x11vnc,novnc - -[program:wm] -priority=15 -command=/usr/bin/openbox -environment=DISPLAY=":1",HOME="/root",USER="root" - -[program:lxpanel] -priority=15 -directory=%HOME% -command=/usr/bin/lxpanel --profile LXDE -user=%USER% -environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%" - -[program:pcmanfm] -priority=15 -directory=%HOME% -command=/usr/bin/pcmanfm --desktop --profile LXDE -user=%USER% -environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%" -{% endif %} - -{% if desktop == "lxqt" %} -[group:x] -programs=xvfb,wm,lxpanel,x11vnc,novnc - -[program:wm] -priority=15 -command=/usr/bin/openbox -environment=DISPLAY=":1",HOME="/root",USER="root" - -[program:lxpanel] -priority=15 -directory=%HOME% -command=/usr/bin/startlxqt -user=%USER% -environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%" -{% endif %} - -{% if desktop == "xfce4" %} -[group:x] -programs=xvfb,lxpanel,x11vnc,novnc - -[program:lxpanel] -priority=15 -directory=%HOME% -command=/usr/bin/startxfce4 -user=%USER% -environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%" -{% endif %} - -[program:xvfb] -priority=10 -command=/usr/local/bin/xvfb.sh -stopsignal=KILL - -[program:x11vnc] -priority=20 -command=x11vnc -display :1 -xkb -forever -shared -repeat -capslock - -[program:novnc] -priority=25 -directory=/usr/local/lib/web/frontend/static/novnc -command=bash /usr/local/lib/web/frontend/static/novnc/utils/launch.sh --listen 6081 -stopasgroup=true diff --git a/rootfs/etc/supervisor/conf.d/supervisord.conf.old b/rootfs/etc/supervisor/conf.d/supervisord.conf.old new file mode 100644 index 0000000..71368eb --- /dev/null +++ b/rootfs/etc/supervisor/conf.d/supervisord.conf.old @@ -0,0 +1,63 @@ +[supervisord] +redirect_stderr=true +stopsignal=QUIT +autorestart=true +directory=/root + +[program:nginx] +priority=10 +command=nginx -c /etc/nginx/nginx.conf -g 'daemon off;' + + +[program:web] +priority=10 +directory=/usr/local/lib/web/backend +command=/usr/local/lib/web/backend/run.py +stdout_logfile=/dev/fd/1 +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/fd/1 +stderr_logfile_maxbytes=0 + +[group:x] +programs=xfce4,xvfb,x11vnc,novnc,cloud9,desktop + + +[program:xfce4] +priority=15 +directory=%HOME% +command=/usr/bin/startxfce4 +user=%USER% +environment=DISPLAY=":1",HOME="%HOME%",USER="%USER%" + +[program:xvfb] +priority=10 +command=/usr/local/bin/xvfb.sh +stopsignal=KILL + +[program:x11vnc] +priority=20 +command=bash -c 'x11vnc -display :1 -xkb -forever -shared -repeat -capslock || rm /tmp/.X11-unix/X1 /tmp/.X1-lockfb' + +[program:novnc] +priority=25 +directory=/usr/local/lib/web/frontend/static/novnc +command=bash /usr/local/lib/web/frontend/static/novnc/utils/launch.sh --listen 6081 +stopasgroup=true + +[program:cloud9] +priority=25 +directory=/cloud9/c9sdk +user=%USER% +command=bash -c 'while ps aux | grep user-install.sh | grep -v grep 2>&1> /dev/null; do sleep 1; done; node server.js -l 0.0.0.0 -p 9999 -a : -w /workspace' + +[program:desktop] +priority=30 +directory=/home/%USER%/.dynamic-background/active +user=%USER% +command=bash /usr/share/backgrounds/dynamic.sh + +[program:desktop] +priority=25 +directory=/cloud9/c9sdk +user=%USER% +command=bash -c 'while ps aux | grep user-install.sh | grep -v grep 2>&1> /dev/null; do sleep 1; done; node server.js -l 0.0.0.0 -p 9999 -a : -w /workspace' diff --git a/rootfs/usr/local/lib/web/disabled/ecolane_web.svg b/rootfs/usr/local/lib/web/disabled/ecolane_web.svg new file mode 100644 index 0000000..2cb1958 --- /dev/null +++ b/rootfs/usr/local/lib/web/disabled/ecolane_web.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/rootfs/usr/local/lib/web/disabled/index.html b/rootfs/usr/local/lib/web/disabled/index.html new file mode 100644 index 0000000..91cd6a5 --- /dev/null +++ b/rootfs/usr/local/lib/web/disabled/index.html @@ -0,0 +1,34 @@ + + + Cloud9 Desktop + + + +
+ +

Desktop is disabled for your account.

+
This instance does not have the desktop enabled. If you do need access, please reach out to IT.
+
+ + \ No newline at end of file