diff --git a/Dockerfile b/Dockerfile index f8f6d75af22c32619cbe39aa2b2c1938ea6b401f..65092ebc33055f8069ddeb8a7c5347fba58a251e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -147,24 +147,8 @@ RUN set -eux; \ RUN set -eux; \ cd build; \ cd node-v${NODEJS_VER}; \ -# Remove bundled dependencies that we're not using. -# ref: https://git.alpinelinux.org/aports/tree/main/nodejs/APKBUILD - # openssl.cnf is required for build. - mv deps/openssl/nodejs-openssl.cnf .; \ - \ - # Remove bundled dependencies that we're not using. - rm -rf deps/brotli \ - deps/cares \ - deps/corepack \ - deps/openssl/* \ - deps/v8/third_party/jinja2 \ - deps/zlib \ - tools/inspector_protocol/jinja2; \ - \ - mv nodejs-openssl.cnf deps/openssl/; \ # Patching patch -p1 < ../patches/nodejs-fix-build-with-system-c-ares.patch; \ -# patch -p1 < ../patches/node-v18.15.0_nodejs-disable-running-gyp-on-shared-deps.patch; \ # Compiler flags export CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"; \ export CXXFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"; \ @@ -232,7 +216,7 @@ FROM registry.conarx.tech/containers/alpine/edge as mastodon-builder LABEL maintainer="Nigel Kukard <nkukard@lbsd.net>" ARG VERSION_INFO= -ARG MASTODON_VER=4.2.13 +ARG MASTODON_VER=4.3.0 # Copy in built binaries @@ -253,7 +237,7 @@ RUN set -eux; \ # Mastodon apk add --no-cache coreutils wget procps libpq imagemagick ffmpeg jemalloc icu-libs libidn yaml file tzdata readline; \ # Mastodon build reqs - apk add --no-cache build-base git jemalloc-dev libucontext-dev libpq-dev icu-dev zlib-dev libidn-dev; \ + apk add --no-cache build-base git jemalloc-dev libucontext-dev libpq-dev icu-dev zlib-dev libidn-dev linux-headers yaml-dev vips-dev; \ npm install --global yarn; \ true "Versioning..."; \ node --version; \ @@ -265,17 +249,27 @@ RUN set -eux; \ cd mastodon-${MASTODON_VER}; \ true "Patching Mastodon..."; \ patch -p1 < ../patches/mastodon-4.0.2_reserved-usernames.patch; \ + true "Enable corepack..."; \ + corepack enable; \ + corepack prepare --activate; \ true "Build Mastodon..."; \ bundle config set --local deployment 'true'; \ bundle config set --local without 'development test'; \ bundle config set silence_root_warning true; \ bundle install -j$(nproc); \ - yarn install --pure-lockfile --network-timeout 600000; \ + true "Install Node modules..."; \ + yarn workspaces focus --production @mastodon/mastodon; \ true "Writing out version..."; \ echo "MASTODON_VER=$MASTODON_VER" > VERSION; \ true "Precompiling assets..."; \ - RAILS_ENV=production OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder \ + RAILS_ENV=production \ + ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=precompile_placeholder \ + ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=precompile_placeholder \ + ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=precompile_placeholder \ + OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder \ bin/rails assets:precompile; \ + true "Install Node modules for Streaming server..."; \ + yarn workspaces focus --production @mastodon/streaming; \ true "Cleaning up..."; \ yarn cache clean; \ true "Moving to 'mastodon'..."; \ @@ -334,7 +328,7 @@ RUN set -eux; \ # NodeJS apk add --no-cache nghttp2-libs; \ # Mastodon - apk add --no-cache coreutils wget procps libpq imagemagick ffmpeg jemalloc icu-libs libidn yaml file tzdata readline; \ + apk add --no-cache coreutils wget procps libpq imagemagick ffmpeg jemalloc icu-libs libidn yaml file tzdata readline vips; \ mkdir -p /opt/mastodon/public/system; \ mkdir -p /opt/mastodon/private; \ # Link mastodon to / that everyone else uses diff --git a/patches/node-v18.15.0_nodejs-disable-running-gyp-on-shared-deps.patch b/patches/node-v18.15.0_nodejs-disable-running-gyp-on-shared-deps.patch deleted file mode 100644 index fcef72c4dbffc963dcd80ed1b40666f25a29a517..0000000000000000000000000000000000000000 --- a/patches/node-v18.15.0_nodejs-disable-running-gyp-on-shared-deps.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --color -ru node-v18.15.0_vanilla/Makefile node-v18.15.0_nodejs-disable-running-gyp-on-shared-deps/Makefile ---- node-v18.15.0_vanilla/Makefile 2023-03-05 06:42:50.000000000 +0000 -+++ node-v18.15.0_nodejs-disable-running-gyp-on-shared-deps/Makefile 2023-03-17 04:27:36.053877725 +0000 -@@ -169,7 +169,7 @@ - $(warning '$@' target is a noop) - - out/Makefile: config.gypi common.gypi node.gyp \ -- deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \ -+ deps/uv/uv.gyp deps/llhttp/llhttp.gyp \ - deps/simdutf/simdutf.gyp \ - tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \ - tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp -Only in node-v18.15.0_nodejs-disable-running-gyp-on-shared-deps: Makefile.orig -Only in node-v18.15.0_nodejs-disable-running-gyp-on-shared-deps: Makefile.rej diff --git a/tests/docker-compose.yml.tmpl b/tests/docker-compose.yml.tmpl index 203b2f8a1868290b434bffd7c6b8cb51b6118832..a35ec5e599cc13de61aedcbb1e19846139a13107 100644 --- a/tests/docker-compose.yml.tmpl +++ b/tests/docker-compose.yml.tmpl @@ -1,5 +1,3 @@ -version: '3.9' - services: postgresql: diff --git a/tests/mastodon.env.tmpl b/tests/mastodon.env.tmpl index 968ac3cafc70ec1267499f072305580cd8ff1a05..3a98ec15ab44c84542059097b3826e7ae7b228db 100644 --- a/tests/mastodon.env.tmpl +++ b/tests/mastodon.env.tmpl @@ -16,3 +16,6 @@ REDIS_PASSWORD=mastodontest SECRET_KEY_BASE=testsecretkeyreplaceme OTP_SECRET=testsecretkeyreplaceme +ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=testsecretkeyreplaceme +ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=testsecretkeyreplaceme +ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=testsecretkeyreplaceme diff --git a/usr/local/sbin/start-mastodon b/usr/local/sbin/start-mastodon index 75bb56180655895da607300985a4518087ca4a9d..b3118ff7bcc86737194ac64bf70070dd9219afea 100644 --- a/usr/local/sbin/start-mastodon +++ b/usr/local/sbin/start-mastodon @@ -36,7 +36,7 @@ if [ "$MASTODON_MODE" = "web" ]; then exec bundle exec rails server -p 3000 -b "$BIND" elif [ "$MASTODON_MODE" = "streaming" ]; then - exec node ./streaming + exec node ./streaming/index.js elif [ "$MASTODON_MODE" = "sidekiq" ]; then exec bundle exec sidekiq diff --git a/usr/local/share/flexible-docker-containers/init.d/42-mastodon.sh b/usr/local/share/flexible-docker-containers/init.d/42-mastodon.sh index 16c48700c25776ac1a10f07ca00e58ceb59e4ee3..69a0e2844d09ae2bbacea7e95acbcd5955ba6f43 100755 --- a/usr/local/share/flexible-docker-containers/init.d/42-mastodon.sh +++ b/usr/local/share/flexible-docker-containers/init.d/42-mastodon.sh @@ -247,6 +247,10 @@ if [ "$MASTODON_MODE" = "web" ]; then fi fi + # Output keys if we don't have any + if [ -z "$ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY" ]; then + mastodon-rails db:encryption:init + fi else while ! nc -z "$MASTODON_HOST" 3000; do