From 6eb231df35edabac3172980f33cb8f289040186f Mon Sep 17 00:00:00 2001 From: Sunoru Date: Sat, 23 Mar 2024 03:21:39 +0000 Subject: [PATCH] Update file structure. --- .gitignore | 6 +----- Dockerfile | 14 ++++++++++---- docker-compose.yml | 25 +++++++++++-------------- mastodon | 2 +- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 09db839..5e5ed25 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,3 @@ .env* -/postgres -/redis -/backups -/nginx/* -!/nginx/conf.d +/data /tmp diff --git a/Dockerfile b/Dockerfile index f6a171e..cc7e15e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,16 @@ -FROM tootsuite/mastodon:v4.1.4 +FROM ghcr.io/mastodon/mastodon:v4.2.8 USER root RUN mkdir -p /var/cache/apt/archives/partial && apt autoclean RUN apt update && apt-get install -y sudo vim htop git curl && rm -rf /var/lib/apt/lists/* -# Restore working dir -# USER mastodon -WORKDIR /opt/mastodon +VOLUME [ "/opt/my-mastodon" ] + +RUN \ + cp -r /opt/mastodon /opt/my-mastodon; \ + ln -s /opt/my-mastodon /my-mastodon + +WORKDIR /opt/my-mastodon + + # bundle exec rails assets:precompile diff --git a/docker-compose.yml b/docker-compose.yml index 3be5e7b..39dfc91 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: healthcheck: test: ['CMD', 'pg_isready', '-U', 'postgres'] volumes: - - ./postgres:/var/lib/postgresql/data + - ./data/postgres:/var/lib/postgresql/data environment: - POSTGRES_HOST_AUTH_METHOD=trust @@ -24,7 +24,7 @@ services: healthcheck: test: ['CMD', 'redis-cli', 'ping'] volumes: - - ./redis:/data + - ./data/redis:/data web: container_name: mastodon-web @@ -39,14 +39,11 @@ services: test: - CMD-SHELL - wget -q --spider --proxy=off localhost:3000/health || exit 1 - # ports: - # - 127.0.0.1:3000:3000 depends_on: - db - redis volumes: - - ./mastodon:/mastodon - # - ./mastodon/public:/mastodon/public + - ./mastodon:/my-mastodon streaming: container_name: mastodon-streaming @@ -54,8 +51,6 @@ services: restart: always env_file: .env.production command: node ./streaming - # ports: - # - 127.0.0.1:4000:4000 depends_on: - db - redis @@ -66,6 +61,8 @@ services: test: - CMD-SHELL - wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1 + volumes: + - ./mastodon:/my-mastodon sidekiq: container_name: mastodon-sidekiq @@ -84,13 +81,14 @@ services: - CMD-SHELL - ps aux | grep '[s]idekiq 6' || false volumes: - - ./mastodon:/mastodon - # - ./mastodon/public:/mastodon/public + - ./mastodon:/my-mastodon nginx: container_name: mastodon-nginx restart: always image: nginx:latest + depends_on: + - web networks: - external_network - internal_network @@ -99,10 +97,9 @@ services: - 127.0.0.1:3001:80 # - 127.0.0.1:3002:443 volumes: - - ./mastodon:/mastodon - # - ./mastodon/public:/mastodon/public - - ./nginx/cache:/var/cache/nginx + - ./mastodon/public:/mastodon/public - ./nginx/conf.d:/etc/nginx/conf.d + - ./data/nginx-cache:/var/cache/nginx duplicity: container_name: mastodon-duplicity @@ -114,7 +111,7 @@ services: - internal_network - external_network volumes: - - ./redis:/mnt/redis:ro + - ./data/redis:/mnt/redis:ro networks: external_network: diff --git a/mastodon b/mastodon index 4633bb8..47c6f5e 160000 --- a/mastodon +++ b/mastodon @@ -1 +1 @@ -Subproject commit 4633bb8ce09f216170c3f8370a8e48f3a41872cb +Subproject commit 47c6f5edc3f931d2271d4ca353e1666b10b32acd