Skip to content

Commit

Permalink
not working yet
Browse files Browse the repository at this point in the history
  • Loading branch information
amandahla committed Nov 14, 2024
1 parent 81936c4 commit 890ffdf
Showing 1 changed file with 41 additions and 11 deletions.
52 changes: 41 additions & 11 deletions synapse_rock/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ parts:
- python3-dev
- python3-pip
- python3-setuptools
- python3-venv
- zlib1g-dev
stage-packages:
- bash
Expand All @@ -99,55 +100,84 @@ parts:
- 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.118.0
source-tag: v1.119.0
build-environment:
- RUST_VERSION: "1.76.0"
- POETRY_VERSION: "1.7.1"
override-build: |
craftctl default
##
# install rust
##
mkdir -p /rust /cargo
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
pip3 install --root-user-action=ignore "poetry==$POETRY_VERSION"
##
# install synapse requirements
##
mkdir -p /synapse /install
cp -pr /usr/lib/python3.12/ensurepip ${CRAFT_PART_INSTALL}/usr/lib/python3.12/
python3 -m venv synapse-env
source synapse-env/bin/activate
pip3 install "poetry==$POETRY_VERSION"
cp pyproject.toml poetry.lock /synapse/
/usr/local/bin/poetry export --extras all -o /synapse/requirements.txt
pip3 install --prefix="/install" --no-deps --no-warn-script-location -r /synapse/requirements.txt
poetry export --extras all -o /synapse/requirements.txt
python3 -m pip install --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 install --prefix="/install" --no-warn-script-location -U .
python3 -m pip install --prefix="/install" --no-warn-script-location -U .
cd ..
##
# install synapse s3 storage provider
##
git clone --branch v1.4.0 --depth 1 https://github.com/matrix-org/synapse-s3-storage-provider
cd synapse-s3-storage-provider
pip3 install --prefix="/install" --no-warn-script-location -U .
python3 -m pip install --prefix="/install" --no-warn-script-location -U .
cd ..
##
# copy files to /synapse/
##
cp -r synapse /synapse/
cp -r rust /synapse/
cp pyproject.toml README.rst build_rust.py Cargo.toml Cargo.lock /synapse/
pip3 install --prefix="/install" --no-deps --no-warn-script-location /synapse[all];
##
# install synapse-invite-checker
##
python3 -m pip install --prefix="/install" --no-deps --no-warn-script-location /synapse[all];
git clone https://git.buechner.me/nbuechner/synapse-invite-checker
cd synapse-invite-checker
git checkout ab6c8b78d78c4cbf31e1a30981ae45c09285b34a
pip3 install --prefix="/install" --no-warn-script-location -U .
##
# install synapse to /install
##
python3 -m pip install --prefix="/install" --no-warn-script-location -U .
cd ..
# fix issue while creating file
# https://github.com/element-hq/synapse/issues/17882
pip3 install --prefix="/install" --force-reinstall -v "Twisted==24.7.0"
python3 -m pip install --prefix="/install" --force-reinstall -v "Twisted==24.7.0"
##
# copy everything to craft_part_install
##
cp docker/start.py $CRAFT_PART_INSTALL/
chmod 755 $CRAFT_PART_INSTALL/start.py
cp -r docker/conf $CRAFT_PART_INSTALL/
cp -r /usr/local $CRAFT_PART_INSTALL/usr/
cp -r /install/local/* $CRAFT_PART_INSTALL/usr/local/
cp -r /install/* $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/
Expand Down

0 comments on commit 890ffdf

Please sign in to comment.