-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrockcraft.yaml
More file actions
191 lines (190 loc) · 6.82 KB
/
Copy pathrockcraft.yaml
File metadata and controls
191 lines (190 loc) · 6.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.
name: synapse
summary: Synapse rock
description: Synapse OCI image for the Synapse charm
version: "4.0"
base: ubuntu@24.04
build-base: ubuntu@24.04
license: Apache-2.0
platforms:
amd64:
parts:
scripts:
plugin: dump
source: scripts
organize:
"*": usr/local/bin/
override-prime: |
craftctl default
chmod -R +x usr/local/bin/*
cron:
after:
- scripts
stage-packages:
- cron
plugin: dump
source: cron
organize:
"cron.hourly/*": /etc/cron.hourly
"cron.daily/*": /etc/cron.daily
"cron.weekly/*": /etc/cron.weekly
"cron.monthly/*": /etc/cron.monthly
override-prime: |
craftctl default
chmod -R +x etc/cron.*
add-user:
plugin: nil
overlay-script: |
groupadd -R $CRAFT_OVERLAY --gid 991 synapse
useradd -R $CRAFT_OVERLAY --system --gid 991 --uid 991 --home /srv/synapse -m synapse
chmod 755 $CRAFT_OVERLAY/etc
groupadd -R $CRAFT_OVERLAY --gid 2000 nginx
useradd -R $CRAFT_OVERLAY --system --gid 2000 --uid 2000 --no-create-home nginx
nginx-conf:
plugin: dump
source: etc
organize:
nginx.conf: etc/nginx/nginx.conf
worker_location.conf: etc/nginx/worker_location.conf
abuse_report_location.conf.template: etc/nginx/abuse_report_location.conf.template
abuse_report_location.conf: etc/nginx/abuse_report_location.conf
main_location.conf.template: etc/nginx/main_location.conf.template
main_location.conf: etc/nginx/main_location.conf
nginx:
stage-packages:
- logrotate
- nginx
- sed
plugin: nil
override-build: |
craftctl default
rm $CRAFT_PART_INSTALL/etc/nginx/nginx.conf
override-prime: |
craftctl default
mkdir run
synapse:
build-packages:
- build-essential
- curl
- git
- libffi-dev
- libicu-dev
- libjpeg-dev
- libpq-dev
- libssl-dev
- libwebp-dev
- libxml++2.6-dev
- libxslt1-dev
- openssl
- pkg-config
- python3-dev
- python3-pip
- python3-setuptools
- python3-venv
- zlib1g-dev
stage-packages:
- coreutils
- curl
- gosu
- gpg
- gpg-agent
- libffi-dev
- libicu74
- libjemalloc2
- libjpeg-turbo8
- libpq5
- libssl-dev
- libwebp7
- openssl
- python3
- python3-pip
- xmlsec1
stage-snaps:
- aws-cli
- mjolnir/latest/edge
plugin: nil
source: https://github.com/element-hq/synapse/
source-type: git
source-tag: v1.146.0
build-environment:
- RUST_VERSION: "1.82.0"
- POETRY_VERSION: "2.1.1"
override-build: |
craftctl default
export RUSTUP_HOME=/rust
export CARGO_HOME=/cargo
export PATH=/cargo/bin:/rust/bin:$PATH
export CARGO_NET_GIT_FETCH_WITH_CLI=false
mkdir -p /rust /cargo /synapse /install
curl -m 30 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain=$RUST_VERSION --profile minimal
/rust/toolchains/$RUST_VERSION-x86_64-unknown-linux-gnu/bin/rustc -V > $CRAFT_PART_INSTALL/rust-version
#
# install synapse requirements
pip3 install --break-system-packages --root-user-action=ignore "poetry==$POETRY_VERSION"
cp pyproject.toml poetry.lock /synapse/
$CRAFT_PART_INSTALL/usr/local/bin/poetry self add poetry-plugin-export
$CRAFT_PART_INSTALL/usr/local/bin/poetry export --extras all -o /synapse/requirements.txt
pip3 install --break-system-packages --prefix="/install" --no-deps --no-warn-script-location -r /synapse/requirements.txt
#
# install synapse stats exporter
git clone https://github.com/canonical/synapse_stats_exporter.git
cd synapse_stats_exporter
pip3 --python=/usr/bin/python3 install --break-system-packages --prefix="/install" --no-warn-script-location -U .
cd ..
#
# install s3 storage provider
git clone --branch v1.6.0 --depth 1 https://github.com/matrix-org/synapse-s3-storage-provider
cd synapse-s3-storage-provider
pip3 install --break-system-packages --prefix="/install" --no-warn-script-location -U .
cd ..
#
# install synapse invite checker
git clone https://github.com/nbuechner/synapse-invite-checker.git
cd synapse-invite-checker
git checkout ab6c8b78d78c4cbf31e1a30981ae45c09285b34a
pip3 install --break-system-packages --prefix="/install" --no-deps --no-warn-script-location -U .
cd ..
#
# install synapse
cp -r synapse /synapse/
cp -r rust /synapse/
cp pyproject.toml README.rst build_rust.py Cargo.toml Cargo.lock /synapse/
pip3 install --break-system-packages --prefix="/install" --no-deps --no-warn-script-location /synapse[all];
# https://github.com/element-hq/synapse/issues/19375
pip3 install --break-system-packages --ignore-installed --prefix="/install" --force-reinstall -v --no-cache-dir "prometheus-client==0.23.1"
cp docker/start.py $CRAFT_PART_INSTALL/
chmod 755 $CRAFT_PART_INSTALL/start.py
cp -r docker/conf $CRAFT_PART_INSTALL/
cp -r /install/local/* $CRAFT_PART_INSTALL/usr/local/
mkdir -p $CRAFT_PART_INSTALL/usr/local/attributemaps
chmod 755 $CRAFT_PART_INSTALL/usr/local/attributemaps
rm -rf $CRAFT_PART_INSTALL/aws/dist/awscli/examples/
overlay-packages:
- libjemalloc2
add-ca-certificates:
plugin: nil
build-packages:
- ca-certificates
override-build: |-
mkdir -p $CRAFT_PART_INSTALL/etc/ssl/certs/
cp /etc/ssl/certs/ca-certificates.crt $CRAFT_PART_INSTALL/etc/ssl/certs/ca-certificates.crt
patches:
plugin: dump
after: [synapse]
source: patches
organize:
"*": srv/patches/
patch-start:
after:
- patches
plugin: nil
build-packages:
- git
override-stage: |
patch -f -u ./start.py -i srv/patches/start.patch
synapse-conf:
plugin: dump
source: attributemaps
organize:
login_ubuntu.py: /usr/local/attributemaps/login_ubuntu.py