[Git][root/services/matrixsynapse][main] feat: new image for helmrelease

MarcusVRP pushed to branch main at Root / Serviços / Matrix Synapse Commits: 7fe4ac5f by marcusvrp at 2025-08-01T05:05:19-03:00 feat: new image for helmrelease - - - - - 5 changed files: - Dockerfile - README.md - − configure.sh - − homeserver.yaml.template - − merge.py Changes: ===================================== Dockerfile ===================================== @@ -1,17 +1,7 @@ FROM matrixdotorg/synapse # Enable S3 Storage Provider Module -RUN apt-get update && apt-get install -y git python3-pip gettext-base +RUN apt-get update && apt-get install -y git python3-pip RUN git clone https://github.com/matrix-org/synapse-s3-storage-provider.git -RUN pip install --break-system-packages boto3 pyyaml +RUN pip install --break-system-packages boto3 ENV PYTHONPATH /synapse-s3-storage-provider - -# Copy files to render the synapse config later -COPY ./ /root/ - -# Then you just gotta use an initContainer that runs: -# /root/configure.sh - -# Note that for this to work you have to set the proper ENV variables expected in the template file (check it) - -ENTRYPOINT /root/configure.sh ===================================== README.md ===================================== @@ -1,7 +1,25 @@ -# C3SL Synapse Image +# Synapse Docker C3SL -Imagem customizada do C3SL para o synapse, facilitando o uso de segredos no Kubernetes e possibilitando o uso do S3. +## Problema -Mais detalhes: perguntar pro Marcus. +No [Helm ESS](https://github.com/element-hq/ess-helm), a versão community [não inclui suporte nativo para armazenamento via S3](https://github.com/element-hq/ess-helm/issues/558). Para resolver essa limitação, criamos uma imagem personalizada do Synapse que inclui o módulo de S3 Storage Provider. -TODO: element-web image will need something similar +Para atualizar a imagem basta clonar o repositório e editar a tag da imagem do synapse no Dockerfile, então buildar e dar push no harbor: + +``` +git clone git@gitlab.c3sl.ufpr.br:root/services/matrixsynapse.git + +# faz novo build da imagem +vim Dockerfile +docker build . -t harbor.c3sl.ufpr.br/root/synapse + +# login no registry +pass -c harbor.c3sl.ufpr.br/admin +docker login harbor.c3sl.ufpr.br +# user admin, senha vc sabe + +# finalmente... atualiza a imagem +docker push harbor.c3sl.ufpr.br/root/synapse +``` + +**TODO**: fazer build e push direto com commits no repositório. ===================================== configure.sh deleted ===================================== @@ -1,5 +0,0 @@ -#!/bin/bash -envsubst < /root/homeserver.yaml.template > /root/homeserver.yaml && \ -/start.py generate && \ -python3 /root/merge.py /data/homeserver.yaml /root/homeserver.yaml -o /data/homeserver.yaml && \ -/start.py ===================================== homeserver.yaml.template deleted ===================================== @@ -1,71 +0,0 @@ -server_name: "${SYNAPSE_SERVER_NAME}" - -database: - allow_unsafe_locale: true - name: "psycopg2" - args: - user: "${POSTGRES_USER}" - password: "${POSTGRES_PASSWORD}" - database: "${POSTGRES_DB}" - host: "${POSTGRES_HOST}" - cp_min: 5 - cp_max: 10 - -report_stats: false - -trusted_key_servers: - - server_name: "${SYNAPSE_SERVER_NAME}" - - server_name: "matrix.org" -public_baseurl: "https://${SYNAPSE_SERVER_NAME}" -serve_server_wellknown: true - - -oidc_providers: -- idp_id: "keycloak" - enable_registration: true - idp_name: "${OIDC_IDP_NAME}" - discover: true - issuer: "${OIDC_ISSUER}" - client_id: "${OIDC_CLIENT_ID}" - client_secret: "${OIDC_CLIENT_SECRET}" - scopes: ["openid", "profile"] - user_mapping_provider: - config: - localpart_template: "{{ user.preferred_username }}" - display_name_template: "{{ user.name }}" - -enable_registration: false - -default_identity_server: "https://${SYNAPSE_SERVER_NAME}" - -trusted_third_party_id_servers: - - "${SYNAPSE_SERVER_NAME}" - -email: - smtp_host: smtp.c3sl.ufpr.br - smtp_port: 25 - notif_from: "${SYNAPSE_SERVER_NAME}" - enable_notifs: true - notif_for_new_users: true - validation_token_lifetime: 15m - -media_storage_providers: -- module: s3_storage_provider.S3StorageProviderBackend - store_local: False - store_remote: True - store_synchronous: True - config: - bucket: "${S3_BUCKET_NAME}" - region_name: "${S3_REGION_NAME}" - endpoint_url: "${S3_ENDPOINT_URL}" - access_key_id: "${S3_ACCESS_KEY_ID}" - secret_access_key: "${S3_SECRET_ACCESS_KEY}" - -user_directory: - enabled: true - search_all_users: true - prefer_local_users: true - show_locked_users: false - -# vim:ft=yaml -# ===================================== merge.py deleted ===================================== @@ -1,45 +0,0 @@ -import yaml -import argparse -import sys - -def load_yaml_file(path): - try: - with open(path, 'r') as file: - return yaml.safe_load(file) or {} - except FileNotFoundError: - print(f"File not found: {path}") - sys.exit(1) - except yaml.YAMLError as e: - print(f"Error parsing YAML file {path}: {e}") - sys.exit(1) - -def merge_dicts(dict1, dict2): - """Recursively merge dict2 into dict1 (dict2 wins conflicts).""" - for key, value in dict2.items(): - if key in dict1 and isinstance(dict1[key], dict) and isinstance(value, dict): - merge_dicts(dict1[key], value) - else: - dict1[key] = value - return dict1 - -def write_yaml_file(data, path): - with open(path, 'w') as file: - yaml.safe_dump(data, file, default_flow_style=False) - -def main(): - parser = argparse.ArgumentParser(description="Merge two YAML files.") - parser.add_argument("file1", help="First input YAML file") - parser.add_argument("file2", help="Second input YAML file (overrides file1's values on conflict)") - parser.add_argument("-o", "--output", default="merged.yaml", help="Output YAML file (default: merged.yaml)") - - args = parser.parse_args() - - yaml1 = load_yaml_file(args.file1) - yaml2 = load_yaml_file(args.file2) - merged = merge_dicts(yaml1, yaml2) - write_yaml_file(merged, args.output) - - print(f"Merged YAML written to {args.output}") - -if __name__ == "__main__": - main() View it on GitLab: https://gitlab.c3sl.ufpr.br/root/services/matrixsynapse/-/commit/7fe4ac5fef3... -- View it on GitLab: https://gitlab.c3sl.ufpr.br/root/services/matrixsynapse/-/commit/7fe4ac5fef3... You're receiving this email because of your account on gitlab.c3sl.ufpr.br.
participantes (1)
-
MarcusVRP (@mvreisdoefer)