1 Commits

3 changed files with 19 additions and 37 deletions

View File

@ -13,30 +13,17 @@ mastodon_config_env_file: "{{ mastodon_config_path }}/env.production"
mastodon_container_name: mastodon
mastodon_container_name_sidekiq: "{{ mastodon_container_name }}_sidekiq"
mastodon_container_name_streaming: "{{ mastodon_container_name }}_streaming"
mastodon_container_name_streaming: "{{ mastodon_container_name }}_streaming }}"
mastodon_container_image_name: "tootsuite/mastodon"
mastodon_container_image_tag: "v{{ mastodon_version }}"
mastodon_container_image_ref: "{{ mastodon_container_image_name }}:{{ mastodon_container_image_tag }}"
mastodon_container_networks:
- name: "{{ mastodon_container_network_name }}"
mastodon_container_base_volumes_streaming: []
mastodon_container_extra_volumes_streaming: "{{ mastodon_container_extra_volumes }}"
mastodon_container_volumes_streaming: >-
{{ mastodon_container_base_volumes_streaming + mastodon_container_extra_volumes_streaming }}
mastodon_container_base_volumes_sidekiq:
mastodon_container_volumes_streaming: []
mastodon_container_volumes_sidekiq:
- "{{ mastodon_repo_path }}/public/system:/mastodon/public/system:ro"
mastodon_container_extra_volumes_sidekiq: "{{ mastodon_container_extra_volumes }}"
mastodon_container_volumes_sidekiq: >-
{{ mastodon_container_base_volumes_sidekiq + mastodon_container_extra_volumes_sidekiq }}
mastodon_container_base_volumes:
- "{{ mastodon_repo_path }}/public/system:/mastodon/public/system:z"
mastodon_container_extra_volumes: []
mastodon_container_volumes: >-
{{ mastodon_container_base_volumes + mastodon_container_extra_volumes }}
mastodon_container_volumes:
- "{{ mastodon_repo_path }}/public/system:/mastodon/public/system:x"
mastodon_container_ports_streaming:
- "127.0.0.1:4000:4000"
mastodon_container_ports:
@ -52,7 +39,7 @@ mastodon_vapid_private_key: ~
mastodon_redis_host: ~
mastodon_redis_port: ~
mastodon_redis_password: ~
mastodon_redis_pass: ~
mastodon_redis_db_index: ~
mastodon_database_host: localhost

View File

@ -48,6 +48,14 @@
name: "{{ mastodon_container_network_name }}"
state: present
- name: Ensure environment file is templated
template:
src: env.j2
dest: "{{ mastodon_config_env_file }}"
owner: "{{ mastodon_user_info.uid | default(mastodon_user) }}"
group: "{{ mastodon_user_info.group | default(mastodon_user) }}"
mode: "0640"
- name: Ensure mastodon docker image is built
docker_image:
name: "{{ mastodon_container_image_name }}"
@ -61,19 +69,6 @@
GID: "{{ mastodon_user_info.group }}"
when: git_repo_info.before != git_repo_info.after
- name: Ensure database is seeded
docker_container:
name: "{{ mastodon_container_name }}_setup_db"
image: "{{ mastodon_container_image_ref }}"
networks: "{{ mastodon_container_networks }}"
volumes: "{{ mastodon_container_volumes }}"
env_file: "{{ mastodon_config_env_file }}"
command: "bash -c \"bundle exec rails db:setup\""
tty: yes
interactive: yes
detach: no
cleanup: yes
- name: Ensure mastodon sidekiq container '{{ mastodon_container_name_sidekiq }}' is running
docker_container:
name: "{{ mastodon_container_name_sidekiq }}"
@ -81,7 +76,7 @@
networks: "{{ mastodon_container_networks }}"
volumes: "{{ mastodon_container_volumes_sidekiq }}"
env_file: "{{ mastodon_config_env_file }}"
command: "bundle exec sidekiq"
command: "bundle exex sidekiq"
restart_policy: "{{ mastodon_container_restart_policy }}"
healthcheck:
test: ["CMD-SHELL", "ps aux | grep '[s]idekiq\ 6' || false"]
@ -107,9 +102,9 @@
start_period: 0s
timeout: 5s
- name: Ensure mastodon container '{{ mastodon_container_name }}' is running
- name: Ensure mastodon streaming container '{{ mastodon_container_name_streaming }}' is running
docker_container:
name: "{{ mastodon_container_name }}"
name: "{{ mastodon_container_name_streaming }}"
image: "{{ mastodon_container_image_ref }}"
networks: "{{ mastodon_container_networks }}"
volumes: "{{ mastodon_container_volumes }}"

View File

@ -21,10 +21,10 @@ LOCAL_DOMAIN={{ mastodon_domain }}
REDIS_HOST={{ mastodon_redis_host }}
REDIS_PORT={{ mastodon_redis_port }}
{% if mastodon_redis_password %}
REDIS_PASSWORD={{ mastodon_redis_password }}
REDIS_PASSWORD={{ mastodon_redis_password }
{% endif %}
{% if mastodon_redis_db_index %}
REDIS_PASSWORD={{ mastodon_redis_db_index }}
REDIS_PASSWORD={{ mastodon_redis_db_index }
{% endif %}
# PostgreSQL