Skip to content

Commit 7e8264f

Browse files
author
Chris Herrmann
committed
Remove the default client and use Riot instead
1 parent ea7ce5d commit 7e8264f

File tree

6 files changed

+108
-29
lines changed

6 files changed

+108
-29
lines changed

infrastructure/main.tf

+14
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ resource "openstack_networking_secgroup_v2" "synapse_homeserver" {
7474
}
7575

7676
resource "openstack_networking_secgroup_rule_v2" "http" {
77+
# Riot webclient
7778
direction = "ingress"
7879
ethertype = "IPv4"
7980
protocol = "tcp"
@@ -84,6 +85,7 @@ resource "openstack_networking_secgroup_rule_v2" "http" {
8485
}
8586

8687
resource "openstack_networking_secgroup_rule_v2" "https" {
88+
# Riot webclient
8789
direction = "ingress"
8890
ethertype = "IPv4"
8991
protocol = "tcp"
@@ -94,6 +96,7 @@ resource "openstack_networking_secgroup_rule_v2" "https" {
9496
}
9597

9698
resource "openstack_networking_secgroup_rule_v2" "synapse_federation" {
99+
# Matrix federation
97100
direction = "ingress"
98101
ethertype = "IPv4"
99102
protocol = "tcp"
@@ -103,6 +106,17 @@ resource "openstack_networking_secgroup_rule_v2" "synapse_federation" {
103106
security_group_id = "${openstack_networking_secgroup_v2.synapse_homeserver.id}"
104107
}
105108

109+
resource "openstack_networking_secgroup_rule_v2" "synapse_homeserver" {
110+
# Matrix homeserver
111+
direction = "ingress"
112+
ethertype = "IPv4"
113+
protocol = "tcp"
114+
port_range_min = 8080
115+
port_range_max = 8080
116+
remote_ip_prefix = "0.0.0.0/0"
117+
security_group_id = "${openstack_networking_secgroup_v2.synapse_homeserver.id}"
118+
}
119+
106120
resource "openstack_compute_keypair_v2" "erp_deploy" {
107121
name = "${var.public_key_name}"
108122
public_key = "${var.public_key_value}"

provisioning/host_vars/chat.python.nz

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ home: /home/ubuntu
33

44
synapse_path: "{{ home }}/synapse"
55
synapse_config_path: "{{ synapse_path }}/homeserver.yaml"
6-
logo_path: /data/_matrix/client/img
6+
synapse_release: https://github.com/matrix-org/synapse/tarball/master
7+
8+
riot_path: "{{ home }}/riot"
9+
riot_version: v0.15.5
10+
riot_release: "https://github.com/vector-im/riot-web/releases/download/{{ riot_version }}/riot-{{ riot_version }}.tar.gz"
711

12+
logo_path: /data/_matrix/client/img
813
images:
914
- favicon.ico
1015
- img/logo.png

provisioning/provision.yml

+39-14
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
raw: sudo apt-get install -y python
1515

1616
tasks:
17+
#########################
18+
# System Configuration
19+
#########################
1720
- name: Install system packages
1821
become: yes
1922
apt:
@@ -34,6 +37,9 @@
3437
- software-properties-common
3538
- sqlite3
3639

40+
#########################
41+
# Synapse Configuration
42+
#########################
3743
- name: Create Synapse directory
3844
file:
3945
path: "{{ synapse_path }}"
@@ -72,7 +78,7 @@
7278
with_items:
7379
- pip
7480
- setuptools
75-
- https://github.com/matrix-org/synapse/tarball/master
81+
- "{{ synapse_release }}"
7682

7783
- name: Register if homeserver config exists
7884
stat:
@@ -98,32 +104,51 @@
98104
dest: /etc/systemd/system/synapse.service
99105
mode: 0644
100106

101-
- name: Create static directories
107+
#########################
108+
# Riot Configuration
109+
#########################
110+
- name: Download Riot release archive
111+
get_url:
112+
url: "{{ riot_release }}"
113+
dest: "{{ riot_path }}.tar.gz"
114+
115+
- name: Extract Riot release archive
116+
unarchive:
117+
src: "{{ riot_path }}.tar.gz"
118+
dest: "{{ home }}"
119+
remote_src: yes
120+
list_files: yes
121+
register: riot_archive
122+
123+
- name: Symlink Riot src for Nginx
102124
become: yes
103125
file:
104-
path: "{{ logo_path }}"
105-
state: directory
106-
owner: "{{ remote_user }}"
107-
group: "www-data"
108-
recurse: yes
126+
src: "{{ home }}/{{ riot_archive.files[0] }}"
127+
dest: /usr/share/nginx/html
128+
state: link
109129

110-
- name: Copy logo images
111-
copy:
112-
src: "{{ item }}"
113-
dest: "/data/_matrix/client/{{ item }}"
114-
with_items: "{{ images }}"
130+
- name: Configure Riot
131+
template:
132+
src: riot/config.j2
133+
dest: "{{ home }}/{{ riot_archive.files[0] }}/config.json"
115134

116-
- name: Create Nginx config
135+
#########################
136+
# Nginx configuration
137+
#########################
138+
- name: Configure Nginx
117139
become: yes
118140
template:
119141
src: nginx/nginx.j2
120142
dest: /etc/nginx/nginx.conf
121143

144+
#########################
145+
# Load and start services
146+
#########################
122147
- name: Reloading Daemons
123148
become: yes
124149
command: systemctl daemon-reload
125150

126-
- name: Enabling service
151+
- name: Enabling Synapse service
127152
become: yes
128153
command: systemctl enable synapse
129154

provisioning/templates/nginx/nginx.j2

+13-11
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,28 @@ http {
2020
server {
2121
listen 443 ssl;
2222
listen [::]:443 ssl;
23-
server_name {{ ansible_ssh_host }};
23+
server_name {{ ansible_ssh_host }};
2424

2525
ssl_certificate /etc/letsencrypt/live/{{ ansible_host }}/fullchain.pem;
2626
ssl_certificate_key /etc/letsencrypt/live/{{ ansible_host }}/privkey.pem;
2727

2828
location / {
29-
proxy_pass http://localhost:8008;
30-
proxy_set_header X-Forwarded-For $remote_addr;
29+
root html;
30+
index index.html index.htm;
3131
}
32+
}
3233

33-
location /_matrix/client/img/logo.png {
34-
alias /data/_matrix/client/img/logo.png;
35-
}
34+
server {
35+
listen 8080 ssl;
36+
listen [::]:8080 ssl;
37+
server_name {{ ansible_ssh_host }};
3638

37-
location /_matrix/client/img/logo-small.png {
38-
alias /data/_matrix/client/img/logo-small.png;
39-
}
39+
ssl_certificate /etc/letsencrypt/live/{{ ansible_host }}/fullchain.pem;
40+
ssl_certificate_key /etc/letsencrypt/live/{{ ansible_host }}/privkey.pem;
4041

41-
location /_matrix/client/favicon.ico {
42-
alias /data/_matrix/client/favicon.ico;
42+
location / {
43+
proxy_pass http://localhost:8008;
44+
proxy_set_header X-Forwarded-For $remote_addr;
4345
}
4446
}
4547
}

provisioning/templates/riot/config.j2

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"default_hs_url": "https://{{ ansible_host }}:8080",
3+
"default_is_url": "https://matrix.org",
4+
"disable_custom_urls": false,
5+
"disable_guests": false,
6+
"disable_login_language_selector": false,
7+
"disable_3pid_login": false,
8+
"brand": "Riot",
9+
"integrations_ui_url": "https://scalar.vector.im/",
10+
"integrations_rest_url": "https://scalar.vector.im/api",
11+
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
12+
"features": {
13+
"feature_groups": "labs",
14+
"feature_pinning": "labs"
15+
},
16+
"default_federate": true,
17+
"welcomePageUrl": "home.html",
18+
"default_theme": "light",
19+
"roomDirectory": {
20+
"servers": [
21+
"chat.python.nz"
22+
]
23+
},
24+
"welcomeUserId": "@riot-bot:matrix.org",
25+
"piwik": {
26+
"url": "https://piwik.riot.im/",
27+
"whitelistedHSUrls": ["https://matrix.org"],
28+
"whitelistedISUrls": ["https://vector.im", "https://matrix.org"],
29+
"siteId": 1
30+
},
31+
"enable_presence_by_hs_url": {
32+
"https://matrix.org": false
33+
}
34+
}

provisioning/templates/synapse/homeserver.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pid_file: /home/ubuntu/synapse/homeserver.pid
7777
# cpu_affinity: 0xFFFFFFFF
7878

7979
# Whether to serve a web client from the HTTP/HTTPS root resource.
80-
web_client: True
80+
web_client: False
8181

8282
# The root directory to server for the above web client.
8383
# If left undefined, synapse will serve the matrix-angular-sdk web client.
@@ -147,7 +147,6 @@ listeners:
147147
# List of resources to host on this listener.
148148
names:
149149
- client # The client-server APIs, both v1 and v2
150-
- webclient # The bundled webclient.
151150

152151
# Should synapse compress HTTP responses to clients that support it?
153152
# This should be disabled if running synapse behind a load balancer
@@ -174,7 +173,7 @@ listeners:
174173
x_forwarded: true
175174

176175
resources:
177-
- names: [client, webclient]
176+
- names: [client]
178177
compress: true
179178
- names: [federation]
180179
compress: false

0 commit comments

Comments
 (0)