Fixed nginx crashes and added email
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
[0.1.3]
|
||||
* Changed log location of nginx due to backup crashes
|
||||
|
||||
[0.1.2]
|
||||
* Updated logo (transparent)
|
||||
* Enabled email settings
|
||||
|
||||
[0.1.1]
|
||||
* Removed the Riot part of the installation due to security
|
||||
* Changed from Sqlite to Postgres
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
"addons": {
|
||||
"localstorage": {},
|
||||
"ldap": {},
|
||||
"postgresql": {}
|
||||
"postgresql": {},
|
||||
"sendmail": {}
|
||||
},
|
||||
"manifestVersion": 1,
|
||||
"website": "https://matrix.org",
|
||||
|
||||
13
Dockerfile
13
Dockerfile
@@ -3,6 +3,8 @@ MAINTAINER Authors name <support@cloudron.io>
|
||||
|
||||
RUN mkdir -p /app/code
|
||||
RUN mkdir -p /app/data
|
||||
RUN mkdir -p /app/data/templates
|
||||
|
||||
WORKDIR /app/code
|
||||
|
||||
EXPOSE 8000
|
||||
@@ -11,18 +13,18 @@ EXPOSE 8000
|
||||
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
|
||||
|
||||
RUN rm -rf /var/log/nginx && ln -sf /run/nginx_log /var/log/nginx
|
||||
|
||||
# TURN
|
||||
RUN apt update && apt-get install -y coturn
|
||||
|
||||
RUN sed -e 's,#TURNSERVER_ENABLED=1,TURNSERVER_ENABLED=1,' -i /etc/default/coturn \
|
||||
&& rm /etc/turnserver.conf \
|
||||
&& ln -s /app/data/turnserver.conf /etc/turnserver.conf
|
||||
|
||||
|
||||
# Synapse
|
||||
# a local copy is needed because of the mail templates, else the pip installation would suffice
|
||||
RUN git clone https://github.com/matrix-org/synapse.git
|
||||
|
||||
RUN apt-get install -y build-essential python2.7-dev libffi-dev \
|
||||
python-pip python-setuptools sqlite3 \
|
||||
libssl-dev libjpeg-dev libxslt1-dev
|
||||
@@ -31,6 +33,9 @@ RUN pip install --upgrade setuptools
|
||||
RUN pip install psycopg2-binary py-bcrypt
|
||||
RUN pip install https://github.com/matrix-org/synapse/tarball/master
|
||||
|
||||
# Identity Server
|
||||
# fix! RUN pip install https://github.com/matrix-org/sydent/tarball/master
|
||||
|
||||
|
||||
# copy index.html
|
||||
COPY index.html /app/code
|
||||
|
||||
@@ -8,10 +8,12 @@ if [[ ! -d /app/data/synapse ]]; then
|
||||
# copy turn config
|
||||
cp /usr/share/coturn/examples/etc/turnserver.conf /app/data/turnserver.conf
|
||||
|
||||
# copy email templates for matrix
|
||||
cp -r /app/code/synapse/res/templates /app/data/templates
|
||||
|
||||
#set default TURN listening port
|
||||
if [ -z ${TURN_TLS_PORT+x} ]; then TURN_TLS_PORT="5349"; else echo "TURN_TLS_PORT is set to '$TURN_TLS_PORT'"; fi
|
||||
|
||||
|
||||
mkdir -p /app/data/synapse
|
||||
cd /app/data/synapse
|
||||
python -m synapse.app.homeserver \
|
||||
@@ -20,6 +22,10 @@ if [[ ! -d /app/data/synapse ]]; then
|
||||
--report-stats=no \
|
||||
--generate-config
|
||||
|
||||
# python -m sydent.sydent \
|
||||
# --config-path sydent.yaml \
|
||||
# --generate-config
|
||||
|
||||
# synapse config
|
||||
sed -i "s/server_name:.*/server_name: ${APP_DOMAIN}/" homeserver.yaml
|
||||
sed -i "s/web_client:.*/web_client: False/" homeserver.yaml
|
||||
@@ -48,6 +54,7 @@ if [[ ! -d /app/data/synapse ]]; then
|
||||
sed -i "s/enable_group_creation:.*/enable_group_creation: True/" homeserver.yaml
|
||||
sed -i "s/#user_directory:/user_directory:/" homeserver.yaml
|
||||
sed -i "s/# search_all_users:.*/ search_all_users: True/" homeserver.yaml
|
||||
sed -i "s/log_file: .*/log_file: \"\/app\/data\/synapse\/homeserver.log\"/" homeserver.yaml
|
||||
|
||||
|
||||
# coturn
|
||||
@@ -61,7 +68,7 @@ if [[ ! -d /app/data/synapse ]]; then
|
||||
sed -i "s/turn_uris: .*/turn_uris: [\"turn:${APP_DOMAIN}:${TURN_TLS_PORT}?transport=udp\", \"turn:${APP_DOMAIN}:${TURN_TLS_PORT}?transport=tcp\"]/" homeserver.yaml
|
||||
sed -i "s/turn_shared_secret: .*/turn_shared_secret: \"${TURNPWD}\"/" homeserver.yaml
|
||||
sed -i "s/#cipher-list=.*/cipher-list=\"HIGH\"/" /app/data/turnserver.conf
|
||||
sed -i "s/#log-file=.*/log-file=\/app\/data\/turn_log\/turn.log/" /app/data/turnserver.conf
|
||||
sed -i "s/#log-file=.*/log-file=\/run\/\/turn_log\/turn.log/" /app/data/turnserver.conf
|
||||
|
||||
|
||||
# get cert names from synapse
|
||||
@@ -72,12 +79,27 @@ if [[ ! -d /app/data/synapse ]]; then
|
||||
sed -i "s,#pkey=.*,pkey=/app/data/synapse/${TLS_KEY}," /app/data/turnserver.conf
|
||||
sed -i "s,#dh-file=.*,dh-file=/app/data/synapse/${TLS_DH}," /app/data/turnserver.conf
|
||||
|
||||
# set up email
|
||||
sed -i 's/#email:/email:/' homeserver.yaml
|
||||
sed -i 's/# enable_notifs: false/ enable_notifs: false/' homeserver.yaml
|
||||
sed -i "s/# smtp_host: "localhost"/ smtp_host: \"${MAIL_SMTP_SERVER}\"/" homeserver.yaml
|
||||
sed -i "s/# smtp_port: 25/ smtp_port: ${MAIL_SMTP_PORT}/" homeserver.yaml
|
||||
sed -i "s/# smtp_user: "exampleusername"/ smtp_user: \"${MAIL_SMTP_USERNAME}\"/" homeserver.yaml
|
||||
sed -i "s/# smtp_pass: "examplepassword"/ smtp_pass: \"${MAIL_SMTP_PASSWORD}\"/" homeserver.yaml
|
||||
sed -i 's/# require_transport_security: False/ require_transport_security: True/' homeserver.yaml
|
||||
sed -i "s/# notif_from: .*/ notif_from: \"Your Friendly Matrix Home Server <${MAIL_FROM}>\"/" homeserver.yaml
|
||||
sed -i 's/# app_name: Matrix/ app_name: Matrix/' homeserver.yaml
|
||||
sed -i 's/# template_dir: res\/templates/ template_dir: \/app\/data\/templates/' homeserver.yaml
|
||||
sed -i 's/# notif_template_html: notif_mail.html/ notif_template_html: notif_mail.html/' homeserver.yaml
|
||||
sed -i 's/# notif_template_text: notif_mail.txt/ notif_template_text: notif_mail.txt/' homeserver.yaml
|
||||
sed -i 's/# notif_for_new_users: True/ notif_for_new_users: True/' homeserver.yaml
|
||||
|
||||
fi
|
||||
|
||||
|
||||
mkdir -p /app/data/nginx
|
||||
mkdir -p /app/data/nginx_log
|
||||
mkdir -p /app/data/turn_log
|
||||
mkdir -p /run/nginx
|
||||
mkdir -p /run/nginx_log
|
||||
mkdir -p /run/turn_log
|
||||
|
||||
chown -R www-data.www-data /app/data
|
||||
|
||||
@@ -100,6 +122,11 @@ sed -i "s/ password: .*/ password: ${POSTGRESQL_PASSWORD}/" homeserver.yaml
|
||||
sed -i "s/ database: .*/ database: ${POSTGRESQL_DATABASE}/" homeserver.yaml
|
||||
sed -i "s, uri: .*, uri: \"${LDAP_URL}\"," homeserver.yaml
|
||||
|
||||
#update email settings in case they changed
|
||||
sed -i "s/ smtp_host:.*/ smtp_host: \"${MAIL_SMTP_SERVER}\"/" homeserver.yaml
|
||||
sed -i "s/ smtp_port:.*/ smtp_port: ${MAIL_SMTP_PORT}/" homeserver.yaml
|
||||
sed -i "s/ smtp_user:.*/ smtp_user: \"${MAIL_SMTP_USERNAME}\"/" homeserver.yaml
|
||||
sed -i "s/ smtp_pass:.*/ smtp_pass: \"${MAIL_SMTP_PASSWORD}\"/" homeserver.yaml
|
||||
|
||||
gosu www-data python -m synapse.app.homeserver --config-path homeserver.yaml &> /dev/null &
|
||||
|
||||
|
||||
Reference in New Issue
Block a user