feat(sharkey): add ansible role for deployment

This commit is contained in:
2025-06-27 23:25:43 +02:00
parent cce1ed58d4
commit da3797c621
16 changed files with 309 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
---
sharkey_compose_state: "{{ sharkey_state }}"
sharkey_compose_project_name: "sharkey"
sharkey_compose_project_src: "{{ sharkey_config_dir }}"
sharkey_compose_upstream_file: "{{ sharkey_compose_project_src }}/compose.upstream.yml"
sharkey_compose_file: "{{ sharkey_compose_project_src }}/compose.yml"
sharkey_compose_build: >-2
{{ (sharkey_container_image_source == 'pull') | ternary('never', 'policy') }}
sharkey_compose_redis_dir: "{{ sharkey_data_dir }}/redis"
sharkey_compose_database_dir: "{{ sharkey_data_dir }}/postgres"
sharkey_repo_server: "https://activitypub.software"
sharkey_repo_path: "Transfem-org/Sharkey"
sharkey_repo_tag: "{{ sharkey_version }}"
sharkey_compose_file_url: >-2
{{ sharkey_repo_server }}/{{ sharkey_repo_path }}/-/raw/{{ sharkey_version }}/compose_example.yml?ref_type=tags
sharkey_compose_file_overrides:
services:
web:
image: "{{ sharkey_container_image }}"
volumes:
- "{{ sharkey_file_dir }}:/sharkey/files:rw"
- "{{ sharkey_config_file }}:/sharkey/.config/default.yaml:ro"
- "{{ sharkey_container_env_file }}:/sharkey/.config/docker.env:ro"
db:
env_file: "{{ sharkey_container_env_file }}"
volumes:
- "{{ sharkey_compose_database_dir }}:/var/lib/postgresql/data:rw"
redis:
volumes:
- "{{ sharkey_compose_redis_dir }}:/data:rw"
# override net segment?
sharkey_compose_file_contents: >-2
{{
(sharkey_compose_upstream_file_contents['content'] | b64decode | from_yaml)
| combine(sharkey_compose_file_overrides, recursive=True)
| to_nice_yaml(indent=4)
}}

View File

@@ -0,0 +1,30 @@
---
sharkey_config_url: ~
sharkey_config_setup_password: ~
sharkey_config_postgres_user: misskey
sharkey_config_postgres_password: "insecure_please_change_me!"
sharkey_config_postgres_db: misskey
sharkey_config_postgres_host: db
sharkey_config_postgres_port: 5432
sharkey_config_postgres_db_url: >-2
postgres://{{ sharkey_config_postgres_user }}:{{ sharkey_config_postgres_password }}@{{ sharkey_config_postgres_host }}:{{ sharkey_config_postgres_port }}/{{ sharkey_config_postgres_db }}
sharkey_config: ~
sharkey_config_file_overrides:
url: "{{ sharkey_config_url }}"
db:
host: "{{ sharkey_config_postgres_host }}"
db: "{{ sharkey_config_postgres_db }}"
user: "{{ sharkey_config_postgres_user }}"
pass: "{{ sharkey_config_postgres_password }}"
sharkey_config_file_contents: >-2
{{
(sharkey_config_upstream_file_contents['content'] | b64decode | from_yaml)
| combine(sharkey_config_file_overrides, recursive=True)
| combine(sharkey_config | default({}, true), recursive=True)
| to_nice_yaml(indent=4)
}}
sharkey_config_upstream_file: "{{ sharkey_config_dir }}/config.upstream.yaml"
sharkey_config_file: "{{ sharkey_config_dir }}/default.yaml"
sharkey_config_upstream_file_url: >-2
{{ sharkey_repo_server }}/{{ sharkey_repo_path }}/-/raw/{{ sharkey_version }}/.config/docker_example.yml?ref=tags

View File

@@ -0,0 +1,47 @@
---
sharkey_container_name: sharkey
sharkey_container_image_registry: "registry.activitypub.software"
sharkey_container_iamge_namespace: "transfem-org"
sharkey_container_image_name: "sharkey"
sharkey_container_image_repository: >-2
{{
[
sharkey_container_image_registry | default([], true),
sharkey_container_iamge_namespace | default([], true),
sharkey_container_image_name
] | flatten | join('/')
}}
sharkey_container_image_tag: ~
sharkey_container_image_source: pull
sharkey_container_image_force_source: >-2
{{ sharkey_container_image_tag | default(false, true) | bool }}
sharkey_container_image: >-2
{{
[
sharkey_container_image_repository,
sharkey_container_image_tag | default(sharkey_version, true)
] | join(':')
}}
sharkey_container_default_env:
MISSKEY_URL: "{{ sharkey_config_url }}"
POSTGRES_USER: "{{ sharkey_config_postgres_user }}"
POSTGRES_PASSWORD: "{{ sharkey_config_postgres_password }}"
POSTGRES_DB: "{{ sharkey_config_postgres_db }}"
DATABASE_URL: >-2
{{
(sharkey_config_postgres_user | default(false, true))
| ternary(sharkey_config_postgres_db_url, '')
}}
sharkey_container_env: ~
sharkey_container_merged_env: >-2
{{
sharkey_container_default_env | default({}, true)
| combine(sharkey_container_env | default({}, true), recursive=True)
}}
sharkey_container_env_file_contents: |2
{% for entry in sharkey_container_merged_env | dict2items %}
{% if entry['value'] is string and entry['value'] | length > 0 %}
{{ entry['key'] }}={{ entry['value'] }}
{% endif %}
{% endfor %}
sharkey_container_env_file: "{{ sharkey_config_dir }}/docker.env"

View File

@@ -0,0 +1,9 @@
---
sharkey_user: sharkey
sharkey_version: "2025.4.3"
sharkey_config_dir: "/etc/sharkey"
sharkey_data_dir: "/var/lib/sharkey"
sharkey_file_dir: "{{ sharkey_data_dir }}/files"
sharkey_state: present
sharkey_deployment_method: "docker-compose"

View File

@@ -0,0 +1,10 @@
---
sharkey_user_system: true
sharkey_user_create_home: false
sharkey_user_groups: ~
sharkey_user_append_groups: >-2
{{ sharkey_user_groups | default(omit, true) }}
sharkey_user_uid: >-2
{{ sharkey_user_info.uid | default(sharkey_user) }}
sharkey_user_gid: >-2
{{ sharkey_user_info.group | default(sharkey_user) }}