diff --git a/.env.production.sample b/.env.production.sample index 7bcce0f7e5..bd72ee0b41 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -14,7 +14,7 @@ # ---------- # This identifies your server and cannot be changed safely later # ---------- -LOCAL_DOMAIN=example.com +LOCAL_DOMAIN=localhost # Use this only if you need to run mastodon on a different domain than the one used for federation. # You can read more about this option on https://docs.joinmastodon.org/admin/config/#web-domain @@ -25,6 +25,7 @@ LOCAL_DOMAIN=example.com # handler@example2.com etc. for the same user. LOCAL_DOMAIN should not # be added. Comma separated values # ALTERNATE_DOMAINS=example1.com,example2.com +ALTERNATE_DOMAINS=mastodon.internal # Use HTTP proxy for outgoing request (optional) # http_proxy=http://gateway.local:8118 @@ -43,14 +44,14 @@ LOCAL_DOMAIN=example.com # Redis # ----- -REDIS_HOST=localhost +REDIS_HOST=redis REDIS_PORT=6379 # PostgreSQL # ---------- -DB_HOST=/var/run/postgresql -DB_USER=mastodon +DB_HOST=db +DB_USER=postgres DB_NAME=mastodon_production DB_PASS= DB_PORT=5432 diff --git a/.woodpecker.yml b/.woodpecker.yml index 651e9d7997..9f70f5cef5 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,19 +1,38 @@ +variables: + docker-step: &docker-step + image: docker:rc-git + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + NAME: gitea.treehouse.systems/treehouse/mastodon pipeline: build: - image: docker:rc-git - volumes: - - /var/run/docker.sock:/var/run/docker.sock + <<: *docker-step commands: - docker version - - docker image build -f Dockerfile . -t gitea.treehouse.systems/treehouse/mastodon:latest + - docker image build -f Dockerfile --build-arg SOURCE_TAG=$CI_COMMIT_SHA . -t $NAME:latest + - docker tag $NAME:latest $NAME:$CI_COMMIT_SHA + + tag-nightly: + <<: *docker-step + commands: + - docker tag $NAME:latest $NAME:$(date -Idate -u) + + # maybe we can use tags someday,,, + # tag-tag: + # image: *docker-git + # volumes: + # - /var/run/docker.sock:/var/run/docker.sock + # commands: + # - docker tag $NAME:latest $NAME:$CI_COMMIT_TAG + # when: + # event: tag push: - image: docker:rc-git - volumes: - - /var/run/docker.sock:/var/run/docker.sock + <<: *docker-step commands: - echo $REGISTRY_SECRET | docker login -u ariadne --password-stdin gitea.treehouse.systems - - docker image push --all-tags gitea.treehouse.systems/treehouse/mastodon + - docker image push --all-tags $NAME when: event: [push, tag] branch: main diff --git a/Dockerfile b/Dockerfile index 26a4b34f96..6c07a60a3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1.4 # This needs to be bullseye-slim because the Ruby image is built on bullseye-slim -ARG NODE_VERSION="16.19-bullseye-slim" +ARG NODE_VERSION="18.15-bullseye-slim" FROM ghcr.io/moritzheiber/ruby-jemalloc:3.2.1-slim as ruby FROM node:${NODE_VERSION} as build @@ -8,7 +8,8 @@ FROM node:${NODE_VERSION} as build COPY --link --from=ruby /opt/ruby /opt/ruby ENV DEBIAN_FRONTEND="noninteractive" \ - PATH="${PATH}:/opt/ruby/bin" + PATH="${PATH}:/opt/ruby/bin" \ + NODE_OPTIONS=--openssl-legacy-provider SHELL ["/bin/bash", "-o", "pipefail", "-c"] @@ -50,15 +51,17 @@ ENV RAILS_ENV="production" \ # Precompile assets # TODO(kouhai): we're currently patching node_modules because of emoji-mart. # we should integrate our own fork instead. -COPY ./emoji_data/all.json ./node_modules/emoji-mart/data/all.json +COPY --link . /opt/mastodon ENV OTP_SECRET=precompile_placeholder \ SECRET_KEY_BASE=precompile_placeholder \ RAKE_NO_YARN_INSTALL_HACK=1 -RUN bundle exec rails assets:precompile +RUN mv ./emoji_data/all.json ./node_modules/emoji-mart/data/all.json && \ + bundle exec rails assets:precompile FROM node:${NODE_VERSION} +ARG SOURCE_TAG='' ARG UID="991" ARG GID="991" @@ -96,13 +99,13 @@ RUN apt-get update && \ # Note: no, cleaning here since Debian does this automatically # See the file /etc/apt/apt.conf.d/docker-clean within the Docker image's filesystem -COPY --link --chown=mastodon:mastodon . /opt/mastodon COPY --link --chown=mastodon:mastodon --from=build /opt/mastodon /opt/mastodon ENV RAILS_ENV="production" \ NODE_ENV="production" \ RAILS_SERVE_STATIC_FILES="true" \ - BIND="0.0.0.0" + BIND="0.0.0.0" \ + SOURCE_TAG="${SOURCE_TAG}" # Set the run user USER mastodon diff --git a/Gemfile.lock b/Gemfile.lock index 752d202b15..09f6608e7b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -910,4 +910,4 @@ RUBY VERSION ruby 3.0.5p211 BUNDLED WITH - 2.3.26 + 2.4.6 diff --git a/docker-compose.yml b/docker-compose.yml index 9d0f7e4751..01ccab7e14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,16 +2,17 @@ version: '3' services: db: restart: always - image: postgres:14-alpine + image: postgres:15-alpine shm_size: 256mb networks: - internal_network healthcheck: test: ['CMD', 'pg_isready', '-U', 'postgres'] volumes: - - ./postgres14:/var/lib/postgresql/data + - ./data/postgres.15:/var/lib/postgresql/data environment: - 'POSTGRES_HOST_AUTH_METHOD=trust' + - 'POSTGRES_USER=mastodon' redis: restart: always @@ -21,7 +22,7 @@ services: healthcheck: test: ['CMD', 'redis-cli', 'ping'] volumes: - - ./redis:/data + - ./data/redis:/data # es: # restart: always @@ -56,7 +57,7 @@ services: web: build: . - image: tootsuite/mastodon + image: gitea.treehouse.systems/treehouse/mastodon:latest restart: always env_file: .env.production command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000" @@ -68,6 +69,8 @@ services: test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1'] expose: - 3000 + ports: + - 3000:3000 labels: - traefik.enable=true - traefik.http.routers.web.rule=Host(`social-dev.treehouse.systems`) @@ -82,10 +85,11 @@ services: # - es volumes: - ./public/system:/mastodon/public/system + # - ./data/postgres:/var/lib/postgresql/data streaming: build: . - image: tootsuite/mastodon + image: gitea.treehouse.systems/treehouse/mastodon:latest restart: always env_file: .env.production command: node ./streaming @@ -111,7 +115,7 @@ services: sidekiq: build: . - image: tootsuite/mastodon + image: gitea.treehouse.systems/treehouse/mastodon:latest restart: always env_file: .env.production command: bundle exec sidekiq diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index d25d1dd3f9..da07a398ec 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -21,7 +21,7 @@ module Mastodon end def suffix - '+glitch+th' + '+glitch.th' end def to_a @@ -42,7 +42,9 @@ module Mastodon # specify git tag or commit hash here def source_tag - ENV.fetch('SOURCE_TAG', nil) + tag = ENV.fetch('SOURCE_TAG', nil) + return if tag.nil? || tag.empty? + tag end def source_url diff --git a/package.json b/package.json index 4fabcaf2eb..99bd993833 100644 --- a/package.json +++ b/package.json @@ -165,7 +165,8 @@ "yargs": "^17.7.0" }, "resolutions": { - "kind-of": "^6.0.3" + "kind-of": "^6.0.3", + "@babel/types": "^7.21.3" }, "optionalDependencies": { "bufferutil": "^4.0.7", diff --git a/yarn.lock b/yarn.lock index 5a8176fb43..07864feb6c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1505,25 +1505,14 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.0.0-beta.49, @babel/types@npm:^7.18.10, @babel/types@npm:^7.18.6, @babel/types@npm:^7.18.9, @babel/types@npm:^7.19.0, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.2, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.0, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4": - version: 7.21.0 - resolution: "@babel/types@npm:7.21.0" +"@babel/types@npm:^7.21.3": + version: 7.21.3 + resolution: "@babel/types@npm:7.21.3" dependencies: "@babel/helper-string-parser": ^7.19.4 "@babel/helper-validator-identifier": ^7.19.1 to-fast-properties: ^2.0.0 - checksum: dbcdda202b3a2bfd59e4de880ce38652f1f8957893a9751be069ac86e47ad751222070fe6cd92220214d77973f1474e4e1111c16dc48199dfca1489c0ee8c0c5 - languageName: node - linkType: hard - -"@babel/types@npm:^7.8.3": - version: 7.21.2 - resolution: "@babel/types@npm:7.21.2" - dependencies: - "@babel/helper-string-parser": ^7.19.4 - "@babel/helper-validator-identifier": ^7.19.1 - to-fast-properties: ^2.0.0 - checksum: a45a52acde139e575502c6de42c994bdbe262bafcb92ae9381fb54cdf1a3672149086843fda655c7683ce9806e998fd002bbe878fa44984498d0fdc7935ce7ff + checksum: b750274718ba9cefd0b81836c464009bb6ba339fccce51b9baff497a0a2d96c044c61dc90cf203cec0adc770454b53a9681c3f7716883c802b85ab84c365ba35 languageName: node linkType: hard