Browse Source

Install Party 1.0

Brendan Abolivier 5 years ago
parent
commit
38af38754e
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623

+ 226
- 0
content/install-party-1.0.md View File

@@ -0,0 +1,226 @@
1
+---
2
+title: "Install Party 1.0"
3
+description: "A few weeks ago, I attended Ubucon Europe in Sintra with two of my colleagues from the Matrix core team. One of the workshops we hosted there was about getting the attendees to install their own Matrix homeserver. While trying to figure out how to set it up so that everyone ends up with a working and federating homeserver, we had the idea of an automated tool to create servers dedicated to these kinds of events. This is how my last personal project, Install Party, was born, and it's now getting its 1.0 release!"
4
+tags: [ 'free', 'software', 'decentralisation', 'federation', 'matrix', 'workshops', 'install', 'party' ]
5
+publishDate: 2019-11-01T00:00:00+02:00
6
+draft: false
7
+thumbnail: /install-party-1.0/domain.jpg
8
+---
9
+
10
+A few weeks ago, I
11
+[attended](https://twitter.com/BrenAbolivier/status/1182224154784874496) [Ubucon
12
+Europe](https://sintra2019.ubucon.org/) in Sintra with two of my colleagues from
13
+the [Matrix](https://matrix.org) core team (oh, yes, if you didn't know already,
14
+I [joined New
15
+Vector](https://twitter.com/BrenAbolivier/status/1057656744497811457) around a
16
+year ago, and I've been working on Matrix as my full-time job since then). We
17
+had a few chats with very nice people, and also hosted two Matrix-related
18
+workshops.
19
+
20
+One of these workshops, which happened on the morning of the last day, was about
21
+installing [Synapse](https://github.com/matrix-org/synapse), the reference
22
+Matrix homeserver implementation. The goal was to give attendees a presentation
23
+about what Matrix is, get them to install their own server, and, if possible, to
24
+get everyone's server to federate with everyone else's.
25
+
26
+This is not a trivial thing to do, especially when the technical expertise of
27
+the attendence looks quite diverse. After a quick brainstorm on how to do that,
28
+[Ben](https://twitter.com/benparsons) suggested that we give everyone access to
29
+a VPS that is accessible from the Internet, with SSH access and a domain name.
30
+
31
+This would make things much easier than trying to get attendees to install a
32
+server on their own machine (no need to setup a custom CA, or a local DNS
33
+server), but I know well enough how making a workshop or a talk rely on Internet
34
+connectivity can really jinx it. The connectivity seemed good enough there
35
+though, so I figured I'd give a try at automating the provisioning of such
36
+servers. This evolved into a project I've kept working on afterwards named
37
+"Install Party".
38
+
39
+## Install Party v1.0.0
40
+
41
+[Install Party](https://github.com/babolivier/install-party) is a Python module
42
+that allows users to provision a server by creating an instance (a physical or
43
+virtual machine), attaching a DNS A record to it, and running a script that
44
+installs and configures [Riot](https://about.riot.im) and
45
+[Caddy](https://caddyserver.com/) on that instance.
46
+
47
+This can be done by simply running `python -m install_party create -N x`, with
48
+the number of servers to create as `x`:
49
+
50
+```
51
+$ python install_party create -N 3
52
+INFO - Provisioning server coogl (expected domain name coogl.ubucon.abolivier.bzh)
53
+INFO - Creating instance...
54
+INFO - Waiting for instance to become active...
55
+INFO - Host is active, IPv4 address is 54.38.70.225
56
+INFO - Creating DNS record...
57
+INFO - Created DNS record coogl.ubucon.abolivier.bzh
58
+INFO - Waiting for post-creation script to finish...
59
+INFO - Done!
60
+INFO - Provisioning server czxcx (expected domain name czxcx.ubucon.abolivier.bzh)
61
+INFO - Creating instance...
62
+INFO - Waiting for instance to become active...
63
+INFO - Host is active, IPv4 address is 54.38.70.93
64
+INFO - Creating DNS record...
65
+INFO - Created DNS record czxcx.ubucon.abolivier.bzh
66
+INFO - Waiting for post-creation script to finish...
67
+INFO - Done!
68
+INFO - Provisioning server jswho (expected domain name jswho.ubucon.abolivier.bzh)
69
+INFO - Creating instance...
70
+INFO - Waiting for instance to become active...
71
+INFO - Host is active, IPv4 address is 54.38.71.74
72
+INFO - Creating DNS record...
73
+INFO - Created DNS record jswho.ubucon.abolivier.bzh
74
+INFO - Waiting for post-creation script to finish...
75
+INFO - Done!
76
+
77
+All servers have been created:
78
+	- coogl.ubucon.abolivier.bzh
79
+	- czxcx.ubucon.abolivier.bzh
80
+	- jswho.ubucon.abolivier.bzh
81
+$
82
+```
83
+
84
+(I've trimmed the log lines' length here, it's usually longer and feature the
85
+date and the name of the module sending the line, but that would have been
86
+unreadable in this post. This will also be the case for other similar sections
87
+of the post.)
88
+
89
+The workshop's host can then hand out the domain name attached to a server to
90
+each attendee, who can then log in via SSH to the server and install and
91
+configure a Matrix homeserver (including, if applicable, its built-in ACME
92
+support for automatic provisioning of the certificate needed for federation).
93
+
94
+![](/images/install-party-1.0/domain.jpg)
95
+*One of the domains I handed out during our workshop at Ubucon*
96
+
97
+From there, the attendee can use the instance of Riot to register on their new
98
+homeserver, and federate with every other attendee's homeserver, but also every
99
+other homeserver on the Internet.
100
+
101
+![](/images/install-party-1.0/federating.png)
102
+*The servers federating between themselves but also with some from the wider
103
+Internet*
104
+
105
+Once the workshop is done, the host can then delete every server with `python -m
106
+install_party delete --all`:
107
+
108
+```
109
+$ python -m install_party delete --all
110
+INFO - Deleting instance for name jswho...
111
+INFO - Deleting domain name for name jswho...
112
+INFO - Deleting instance for name czxcx...
113
+INFO - Deleting domain name for name czxcx...
114
+INFO - Deleting instance for name coogl...
115
+INFO - Deleting domain name for name coogl...
116
+INFO - Applying the instances deletion...
117
+INFO - Applying the DNS changes...
118
+INFO - Done!
119
+$
120
+```
121
+
122
+They can also delete specific servers with `-s foo -s bar` (which would only
123
+delete the servers `foo` and `bar`), or delete every server except one or more
124
+with `-a -e foo -e bar` (which would delete every server but `foo` and `bar`).
125
+This became very handy when one person arrived late to the workshop, and didn't
126
+get the time to finish it, so I could just give them some extra time to work on
127
+it and exclude their server's domain from the deletion I performed shortly
128
+afterwards.
129
+
130
+At any time, the host can also list every server that is still active with
131
+`python -m install_party list`:
132
+
133
+```
134
+$ python -m install_party list
135
++--------+-----------------+------------------+----------+-------+
136
+| Name   | Instance name   | Domain           | Status   | IPv4  |
137
+|--------+-----------------+------------------+----------+-------|
138
+| jswho  | ubucon-jswho    | jswho.ubucon.... | ACTIVE   | ...   |
139
+| czxcx  | ubucon-czxcx    | czxcx.ubucon.... | ACTIVE   | ...   |
140
+| coogl  | ubucon-coogl    | coogl.ubucon.... | ACTIVE   | ...   |
141
++--------+-----------------+------------------+----------+-------+
142
+$
143
+```
144
+
145
+This mode can also detect orphaned domain names (i.e. domain names which target
146
+IP address isn't a known instance) and orphaned instances (i.e. instances that
147
+don't have a domain name targetting their IP address):
148
+
149
+```
150
+$ python -m install_party list
151
++--------+-----------------+------------------+----------+-------+
152
+| Name   | Instance name   | Domain           | Status   | IPv4  |
153
+|--------+-----------------+------------------+----------+-------|
154
+| jswho  | ubucon-jswho    | jswho.ubucon.... | ACTIVE   | ...   |
155
++--------+-----------------+------------------+----------+-------+
156
+
157
+ORPHANED INSTANCES
158
++--------+-----------------+----------+-------------+
159
+| Name   | Instance name   | Status   | IPv4        |
160
+|--------+-----------------+----------+-------------|
161
+| czxcx  | ubucon-czxcx    | ACTIVE   | 54.38.70.93 |
162
++--------+-----------------+----------+-------------+
163
+
164
+ORPHANED DOMAINS
165
++--------+----------------------------+--------------+
166
+| Name   | Domain                     | Target       |
167
+|--------+----------------------------+--------------|
168
+| coogl  | coogl.ubucon.abolivier.bzh | 54.38.70.225 |
169
++--------+----------------------------+--------------+
170
+$
171
+```
172
+
173
+### Why 1.0?
174
+
175
+A short while after Ubucon, I finished a basic implementation the three modes
176
+I've described above (I had already implemented the creation and was halfway
177
+done implementing the listing when the workshop happened), and released
178
+[v0.3.0](https://github.com/babolivier/install-party/releases/tag/v0.3.0) with
179
+these.
180
+
181
+Since then, I've been iterating on improving the codebase, adding new features
182
+to the modes, and polishing the whole thing in order to make it easier to use
183
+and contribute to. All of the improvements I'll describe here are documented in
184
+the project's
185
+[README](https://github.com/babolivier/install-party/blob/v1.0.0/README.md).
186
+
187
+A major change is that I've added the ability for users to use their favourite
188
+DNS provider, as well as their favourite instances provider (i.e. the API to use
189
+to create instances), instead of the hardcoded OVH and OpenStack (which are the
190
+ones I personally use). These providers are still available, but users can now
191
+add their own providers by creating a Python class that implements the correct
192
+API, dropping it as a file in the correct location, and start using it right
193
+away.
194
+
195
+The creation mode also got two main improvements. The first one is the ability
196
+for multiple instances to be created in the same run with the `-N/--number`
197
+command-line argument. This is already something I've described above, but
198
+didn't exist in previous versions of Install Party (indeed, for the Ubucon
199
+workshop, I had to run Install party multiple times in multiple terminals in
200
+order to genenerate the number of instances I was going for).
201
+
202
+Another new feature of the creation mode is the ability to provide a
203
+post-install script with the `-s/--post-install-script`. This script will be
204
+run on the new server(s) after the installation of Riot and Caddy.
205
+
206
+The rest of the work was mostly about cleaning up the codebase (e.g. getting rid
207
+of some inconsistencies in the name of some variables of classes), adding some
208
+proper logging, adding docstrings to (almost) every function of the project, and
209
+improving and updating the user-facing documentation in the
210
+[README](https://github.com/babolivier/install-party/blob/v1.0.0/README.md).
211
+
212
+## That's all folks!
213
+
214
+If you're interested in following along further developments of Install Party
215
+(though I expect it to become much calmer now), want to report an issue when
216
+using it, or want to ask a question about it, feel free to join the project's
217
+Matrix room
218
+[#install-party:abolivier.bzh](https://matrix.to/#/#install-party:abolivier.bzh),
219
+or to check out its [Github repo](https://github.com/babolivier/install-party)!
220
+
221
+When I'm writing this post, the video of the workshop Install Party was born for
222
+hasn't been released yet. However, I've noticed the staff are starting to
223
+publish videos of the event's talks, so I should update this post in a few
224
+days/weeks when the video is released.
225
+
226
+I hope you enjoyed reading through this post, see you next time!

BIN
static/images/install-party-1.0/domain.jpg View File


BIN
static/images/install-party-1.0/federating.png View File