commit faba1547cefa13b4ea5030700e51b3f556807442 Author: Joey Date: Mon Mar 13 07:59:00 2017 +0000 Initial version diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c7688ce --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +.gitignore +.dockerignore +node_modules + diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..0b6ac06 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,2 @@ +[0.1.0] +* Initial version diff --git a/CloudronManifest.json b/CloudronManifest.json new file mode 100644 index 0000000..2242089 --- /dev/null +++ b/CloudronManifest.json @@ -0,0 +1,29 @@ +{ + "id": "org.matrix.synapse_riot", + "title": "Matrix synapse with Riot", + "author": "Matrix synapse & Riot authors", + "description": "file://DESCRIPTION.md", + "changelog": "file://CHANGELOG", + "tagline": "matrix server and web client", + "version": "0.1.0", + "healthCheckPath": "/", + "httpPort": 8000, + "tcpPorts": { + "FEDERATION_PORT": { + "title": "Federation Port", + "description": "Federation Port", + "defaultValue": 8448 + } + }, + "addons": { + "localstorage": {} + }, + "manifestVersion": 1, + "website": "https://matrix.org", + "contactEmail": "support@cloudron.io", + "icon": "logo.png", + "tags": [ + "im", "collaboration" + ], + "mediaLinks": [ ] +} diff --git a/DESCRIPTION.md b/DESCRIPTION.md new file mode 100644 index 0000000..ee63036 --- /dev/null +++ b/DESCRIPTION.md @@ -0,0 +1 @@ +Please add the appstore description in markdown format here. \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..da17acc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM cloudron/base:0.10.0 +MAINTAINER Authors name + +RUN mkdir -p /app/code +WORKDIR /app/code + +EXPOSE 8000 + +# Riot web +RUN curl -L https://github.com/vector-im/riot-web/releases/download/v0.9.7/vector-v0.9.7.tar.gz | tar -xz --strip-components 1 -f - +RUN ln -sf /app/data/riot_config.json /app/code/config.json + +# Nginx +RUN rm /etc/nginx/sites-enabled/* +ADD nginx_matrix.conf /etc/nginx/sites-enabled/ +RUN rm -rf /var/lib/nginx && ln -sf /app/data/nginx /var/lib/nginx +RUN rm -rf /var/log/nginx && ln -sf /app/data/nginx_log /var/log/nginx + +# Synapse +RUN apt update && apt-get install -y build-essential python2.7-dev libffi-dev \ + python-wheel python-pip python-setuptools sqlite3 \ + libssl-dev libjpeg-dev libxslt1-dev +RUN pip install --upgrade setuptools +RUN pip install https://github.com/matrix-org/synapse/tarball/master + +RUN chown -R www-data.www-data /app/code + +ADD start_matrix.sh /app/ + +CMD [ "/app/start_matrix.sh" ] diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..da6bb32 Binary files /dev/null and b/logo.png differ diff --git a/nginx_matrix.conf b/nginx_matrix.conf new file mode 100644 index 0000000..9b1332b --- /dev/null +++ b/nginx_matrix.conf @@ -0,0 +1,16 @@ +server { + listen 8000; + listen [::]:8000; + + server_name _; + + location /_matrix { + proxy_pass http://localhost:8008; + proxy_set_header X-Forwarded-For $remote_addr; + } + + location / { + root /app/code; + index index.html; + } +} diff --git a/start_matrix.sh b/start_matrix.sh new file mode 100755 index 0000000..a5a2e48 --- /dev/null +++ b/start_matrix.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -eux + +if [[ ! -d /app/data/synapse ]]; then + echo "=> Detected first run" + mkdir -p /app/data/synapse + cd /app/data/synapse + python -m synapse.app.homeserver \ + --server-name ${APP_DOMAIN#*.} \ + --config-path homeserver.yaml \ + --report-stats=no \ + --generate-config +fi + +if [[ ! -e /app/data/riot_config.json ]]; then + cp /app/code/config.sample.json /app/data/riot_config.json + sed -i "s#https://matrix.org#https://$APP_DOMAIN#" /app/data/riot_config.json +fi + +mkdir -p /app/data/nginx +mkdir -p /app/data/nginx_log + +chown -R www-data.www-data /app/data + +cd /app/data/synapse +gosu www-data python -m synapse.app.homeserver --config-path homeserver.yaml &> /dev/null & + +exec /usr/sbin/nginx -g 'daemon off;'