Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase to 3.18, migrate to s6v3 (develop) #57

Merged
merged 5 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.15
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.18

ARG BUILD_DATE
ARG VERSION
Expand All @@ -10,15 +10,16 @@ LABEL maintainer="TheSpad"

ENV RAILS_ENV="production" \
NODE_ENV="production" \
PATH="${PATH}:/app/www/bin"
NODE_OPTIONS="--openssl-legacy-provider" \
PATH="${PATH}:/app/www/bin" \
S6_STAGE2_HOOK="/init-hook"

RUN \
apk add -U --upgrade --no-cache \
apk add --no-cache \
ffmpeg \
file \
icu-libs \
imagemagick \
jq \
libpq \
libidn \
nodejs \
Expand All @@ -43,7 +44,7 @@ RUN \
fi && \
curl -s -o \
/tmp/mastodon.tar.gz -L \
"https://github.com/mastodon/mastodon/archive/refs/tags/${MASTODON_VERSION}.tar.gz" && \
"https://github.com/mastodon/mastodon/archive/${MASTODON_VERSION}.tar.gz" && \
tar xf \
/tmp/mastodon.tar.gz -C \
/app/www/ --strip-components=1 && \
Expand All @@ -52,7 +53,7 @@ RUN \
bundle config set --local without 'development test' && \
bundle config set silence_root_warning true && \
bundle install -j"$(nproc)" && \
yarn install --pure-lockfile && \
yarn install --pure-lockfile --production && \
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder rails assets:precompile && \
echo "**** cleanup ****" && \
apk del --purge \
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.15
FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.18

ARG BUILD_DATE
ARG VERSION
Expand All @@ -10,15 +10,16 @@ LABEL maintainer="TheSpad"

ENV RAILS_ENV="production" \
NODE_ENV="production" \
PATH="${PATH}:/app/www/bin"
NODE_OPTIONS="--openssl-legacy-provider" \
PATH="${PATH}:/app/www/bin" \
S6_STAGE2_HOOK="/init-hook"

RUN \
apk add -U --upgrade --no-cache \
apk add --no-cache \
ffmpeg \
file \
icu-libs \
imagemagick \
jq \
libpq \
libidn \
nodejs \
Expand All @@ -45,7 +46,7 @@ RUN \
fi && \
curl -s -o \
/tmp/mastodon.tar.gz -L \
"https://github.com/mastodon/mastodon/archive/refs/tags/${MASTODON_VERSION}.tar.gz" && \
"https://github.com/mastodon/mastodon/archive/${MASTODON_VERSION}.tar.gz" && \
tar xf \
/tmp/mastodon.tar.gz -C \
/app/www/ --strip-components=1 && \
Expand All @@ -55,7 +56,7 @@ RUN \
bundle config set silence_root_warning true && \
bundle config set force_ruby_platform true && \
bundle install -j"$(nproc)" && \
yarn install --pure-lockfile && \
yarn install --pure-lockfile --production && \
OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder rails assets:precompile && \
echo "**** cleanup ****" && \
apk del --purge \
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64

## Versions

* **30.05.23:** - Rebase to Alpine 3.18, migrate to s6v3
* **09.02.23:** - Add Glitch branch.
* **26.01.23:** - Add aliases for key generation & tootctl to better support secrets.
* **19.12.22:** - Support separate sidekiq queue instances.
Expand Down
1 change: 1 addition & 0 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ app_setup_block: |

# changelog
changelogs:
- { date: "08.08.23:", desc: "Rebase to Alpine 3.18, migrate to s6v3" }
- { date: "09.02.23:", desc: "Add Glitch branch." }
- { date: "26.01.23:", desc: "Add aliases for key generation & tootctl to better support secrets." }
- { date: "19.12.22:", desc: "Support separate sidekiq queue instances." }
Expand Down
4 changes: 3 additions & 1 deletion root/defaults/nginx/site-confs/default.conf.sample
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Version 2022/11/07 - Changelog: https://github.com/linuxserver/docker-mastodon/commits/main/root/defaults/nginx/site-confs/default.conf.sample
## Version 2023/04/13 - Changelog: https://github.com/linuxserver/docker-mastodon/commits/develop/root/defaults/nginx/site-confs/default.conf.sample

map $http_upgrade $connection_upgrade {
default upgrade;
Expand All @@ -24,6 +24,8 @@ server {

server_name _;

include /config/nginx/ssl.conf;

root /app/www/public;

gzip on;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
#!/usr/bin/with-contenv bash
# shellcheck shell=bash

# Disable php-fpm service as Mastodon doesn't use it
touch /etc/services.d/php-fpm/down

# Disable other services if this is a sidekiq-only container
if [[ ${SIDEKIQ_ONLY,,} == "true" ]]; then
touch /etc/services.d/mastodon/down
touch /etc/services.d/streaming/down
touch /etc/services.d/nginx/down
fi

mkdir -p \
/app/www/tmp \
/config/mastodon/public/system

chown -R abc:abc \
lsiown -R abc:abc \
/app/www/tmp

# Remove old pid in the event of an unclean shutdown
Expand All @@ -35,5 +25,5 @@ if [[ ${SIDEKIQ_ONLY,,} != "true" ]]; then
s6-setuidgid abc /usr/bin/bundle exec rails db:prepare
fi

chown abc:abc \
lsiown abc:abc \
/config/mastodon/public/system
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-mastodon-config/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oneshot
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-mastodon-config/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-mastodon-config/run
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export RAILS_SERVE_STATIC_FILES=false

exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 3000" \
cd /app/www s6-setuidgid abc /usr/bin/bundle exec rails s -p 3000
cd /app/www s6-setuidgid abc /usr/bin/bundle exec rails s -p 3000
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-mastodon/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ cd /app/www || exit 1
if [[ ${SIDEKIQ_ONLY,,} == "true" ]] && [[ -n ${SIDEKIQ_QUEUE} ]]; then
echo "*** Starting sidekiq handling ${SIDEKIQ_QUEUE} queue with ${SIDEKIQ_THREADS} threads ***"
exec \
s6-setuidgid abc /usr/bin/bundle exec sidekiq -q "${SIDEKIQ_QUEUE}" -c ${SIDEKIQ_THREADS}
s6-setuidgid abc /usr/bin/bundle exec "sidekiq -q ${SIDEKIQ_QUEUE} -c ${SIDEKIQ_THREADS}"
elif [[ ${SIDEKIQ_ONLY,,} == "true" ]] && [[ -z ${SIDEKIQ_QUEUE} ]]; then
echo "*** No sidekiq queue specified, aborting ***"
sleep infinity
elif [[ ${SIDEKIQ_DEFAULT,,} == "true" ]]; then
elif [[ ${SIDEKIQ_DEFAULT,,} == "true" ]]; then
echo "*** Starting sidekiq handling default queue with ${SIDEKIQ_THREADS} threads ***"
exec \
s6-setuidgid abc /usr/bin/bundle exec sidekiq -q default -c ${SIDEKIQ_THREADS}
s6-setuidgid abc /usr/bin/bundle exec "sidekiq -q default -c ${SIDEKIQ_THREADS}"
else
echo "*** Starting sidekiq handling all queues with ${SIDEKIQ_THREADS} threads ***"
exec \
s6-setuidgid abc /usr/bin/bundle exec sidekiq -c ${SIDEKIQ_THREADS}
s6-setuidgid abc /usr/bin/bundle exec "sidekiq -c ${SIDEKIQ_THREADS}"
fi
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-sidekiq/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export PATH="${PATH}:/app/www/bin"

exec \
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z localhost 4000" \
cd /app/www s6-setuidgid abc node ./streaming
cd /app/www s6-setuidgid abc node ./streaming
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-streaming/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
Empty file.
Empty file.
Empty file.
12 changes: 12 additions & 0 deletions root/init-hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/command/with-contenv bash

# Disable the php-fpm service as the container doesn't use it
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-php-fpm

if [[ ${SIDEKIQ_ONLY,,} == "true" ]]; then
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-mastodon
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-nginx
rm /etc/s6-overlay/s6-rc.d/user/contents.d/svc-streaming
fi

exec /docker-mods