Merge pull request 'fun, image tagging, and SOURCE_TAG' (#53) from kouhai/tagging into main
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
Reviewed-on: #53
commit
9a600c0028
|
@ -14,7 +14,7 @@
|
||||||
# ----------
|
# ----------
|
||||||
# This identifies your server and cannot be changed safely later
|
# 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.
|
# 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
|
# 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
|
# handler@example2.com etc. for the same user. LOCAL_DOMAIN should not
|
||||||
# be added. Comma separated values
|
# be added. Comma separated values
|
||||||
# ALTERNATE_DOMAINS=example1.com,example2.com
|
# ALTERNATE_DOMAINS=example1.com,example2.com
|
||||||
|
ALTERNATE_DOMAINS=mastodon.internal
|
||||||
|
|
||||||
# Use HTTP proxy for outgoing request (optional)
|
# Use HTTP proxy for outgoing request (optional)
|
||||||
# http_proxy=http://gateway.local:8118
|
# http_proxy=http://gateway.local:8118
|
||||||
|
@ -43,14 +44,14 @@ LOCAL_DOMAIN=example.com
|
||||||
|
|
||||||
# Redis
|
# Redis
|
||||||
# -----
|
# -----
|
||||||
REDIS_HOST=localhost
|
REDIS_HOST=redis
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
|
||||||
# PostgreSQL
|
# PostgreSQL
|
||||||
# ----------
|
# ----------
|
||||||
DB_HOST=/var/run/postgresql
|
DB_HOST=db
|
||||||
DB_USER=mastodon
|
DB_USER=postgres
|
||||||
DB_NAME=mastodon_production
|
DB_NAME=mastodon_production
|
||||||
DB_PASS=
|
DB_PASS=
|
||||||
DB_PORT=5432
|
DB_PORT=5432
|
||||||
|
|
|
@ -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:
|
pipeline:
|
||||||
build:
|
build:
|
||||||
image: docker:rc-git
|
<<: *docker-step
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
commands:
|
commands:
|
||||||
- docker version
|
- 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:
|
push:
|
||||||
image: docker:rc-git
|
<<: *docker-step
|
||||||
volumes:
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
|
||||||
commands:
|
commands:
|
||||||
- echo $REGISTRY_SECRET | docker login -u ariadne --password-stdin gitea.treehouse.systems
|
- 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:
|
when:
|
||||||
event: [push, tag]
|
event: [push, tag]
|
||||||
branch: main
|
branch: main
|
||||||
|
|
15
Dockerfile
15
Dockerfile
|
@ -1,6 +1,6 @@
|
||||||
# syntax=docker/dockerfile:1.4
|
# syntax=docker/dockerfile:1.4
|
||||||
# This needs to be bullseye-slim because the Ruby image is built on bullseye-slim
|
# 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 ghcr.io/moritzheiber/ruby-jemalloc:3.2.1-slim as ruby
|
||||||
FROM node:${NODE_VERSION} as build
|
FROM node:${NODE_VERSION} as build
|
||||||
|
@ -8,7 +8,8 @@ FROM node:${NODE_VERSION} as build
|
||||||
COPY --link --from=ruby /opt/ruby /opt/ruby
|
COPY --link --from=ruby /opt/ruby /opt/ruby
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND="noninteractive" \
|
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"]
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
|
|
||||||
|
@ -50,15 +51,17 @@ ENV RAILS_ENV="production" \
|
||||||
# Precompile assets
|
# Precompile assets
|
||||||
# TODO(kouhai): we're currently patching node_modules because of emoji-mart.
|
# TODO(kouhai): we're currently patching node_modules because of emoji-mart.
|
||||||
# we should integrate our own fork instead.
|
# 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 \
|
ENV OTP_SECRET=precompile_placeholder \
|
||||||
SECRET_KEY_BASE=precompile_placeholder \
|
SECRET_KEY_BASE=precompile_placeholder \
|
||||||
RAKE_NO_YARN_INSTALL_HACK=1
|
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}
|
FROM node:${NODE_VERSION}
|
||||||
|
|
||||||
|
ARG SOURCE_TAG=''
|
||||||
ARG UID="991"
|
ARG UID="991"
|
||||||
ARG GID="991"
|
ARG GID="991"
|
||||||
|
|
||||||
|
@ -96,13 +99,13 @@ RUN apt-get update && \
|
||||||
# Note: no, cleaning here since Debian does this automatically
|
# 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
|
# 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
|
COPY --link --chown=mastodon:mastodon --from=build /opt/mastodon /opt/mastodon
|
||||||
|
|
||||||
ENV RAILS_ENV="production" \
|
ENV RAILS_ENV="production" \
|
||||||
NODE_ENV="production" \
|
NODE_ENV="production" \
|
||||||
RAILS_SERVE_STATIC_FILES="true" \
|
RAILS_SERVE_STATIC_FILES="true" \
|
||||||
BIND="0.0.0.0"
|
BIND="0.0.0.0" \
|
||||||
|
SOURCE_TAG="${SOURCE_TAG}"
|
||||||
|
|
||||||
# Set the run user
|
# Set the run user
|
||||||
USER mastodon
|
USER mastodon
|
||||||
|
|
|
@ -910,4 +910,4 @@ RUBY VERSION
|
||||||
ruby 3.0.5p211
|
ruby 3.0.5p211
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.3.26
|
2.4.6
|
||||||
|
|
|
@ -2,16 +2,17 @@ version: '3'
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
restart: always
|
restart: always
|
||||||
image: postgres:14-alpine
|
image: postgres:15-alpine
|
||||||
shm_size: 256mb
|
shm_size: 256mb
|
||||||
networks:
|
networks:
|
||||||
- internal_network
|
- internal_network
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'pg_isready', '-U', 'postgres']
|
test: ['CMD', 'pg_isready', '-U', 'postgres']
|
||||||
volumes:
|
volumes:
|
||||||
- ./postgres14:/var/lib/postgresql/data
|
- ./data/postgres.15:/var/lib/postgresql/data
|
||||||
environment:
|
environment:
|
||||||
- 'POSTGRES_HOST_AUTH_METHOD=trust'
|
- 'POSTGRES_HOST_AUTH_METHOD=trust'
|
||||||
|
- 'POSTGRES_USER=mastodon'
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
restart: always
|
restart: always
|
||||||
|
@ -21,7 +22,7 @@ services:
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'redis-cli', 'ping']
|
test: ['CMD', 'redis-cli', 'ping']
|
||||||
volumes:
|
volumes:
|
||||||
- ./redis:/data
|
- ./data/redis:/data
|
||||||
|
|
||||||
# es:
|
# es:
|
||||||
# restart: always
|
# restart: always
|
||||||
|
@ -56,7 +57,7 @@ services:
|
||||||
|
|
||||||
web:
|
web:
|
||||||
build: .
|
build: .
|
||||||
image: tootsuite/mastodon
|
image: gitea.treehouse.systems/treehouse/mastodon:latest
|
||||||
restart: always
|
restart: always
|
||||||
env_file: .env.production
|
env_file: .env.production
|
||||||
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
|
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']
|
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
|
||||||
expose:
|
expose:
|
||||||
- 3000
|
- 3000
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
labels:
|
labels:
|
||||||
- traefik.enable=true
|
- traefik.enable=true
|
||||||
- traefik.http.routers.web.rule=Host(`social-dev.treehouse.systems`)
|
- traefik.http.routers.web.rule=Host(`social-dev.treehouse.systems`)
|
||||||
|
@ -82,10 +85,11 @@ services:
|
||||||
# - es
|
# - es
|
||||||
volumes:
|
volumes:
|
||||||
- ./public/system:/mastodon/public/system
|
- ./public/system:/mastodon/public/system
|
||||||
|
# - ./data/postgres:/var/lib/postgresql/data
|
||||||
|
|
||||||
streaming:
|
streaming:
|
||||||
build: .
|
build: .
|
||||||
image: tootsuite/mastodon
|
image: gitea.treehouse.systems/treehouse/mastodon:latest
|
||||||
restart: always
|
restart: always
|
||||||
env_file: .env.production
|
env_file: .env.production
|
||||||
command: node ./streaming
|
command: node ./streaming
|
||||||
|
@ -111,7 +115,7 @@ services:
|
||||||
|
|
||||||
sidekiq:
|
sidekiq:
|
||||||
build: .
|
build: .
|
||||||
image: tootsuite/mastodon
|
image: gitea.treehouse.systems/treehouse/mastodon:latest
|
||||||
restart: always
|
restart: always
|
||||||
env_file: .env.production
|
env_file: .env.production
|
||||||
command: bundle exec sidekiq
|
command: bundle exec sidekiq
|
||||||
|
|
|
@ -21,7 +21,7 @@ module Mastodon
|
||||||
end
|
end
|
||||||
|
|
||||||
def suffix
|
def suffix
|
||||||
'+glitch+th'
|
'+glitch.th'
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_a
|
def to_a
|
||||||
|
@ -42,7 +42,9 @@ module Mastodon
|
||||||
|
|
||||||
# specify git tag or commit hash here
|
# specify git tag or commit hash here
|
||||||
def source_tag
|
def source_tag
|
||||||
ENV.fetch('SOURCE_TAG', nil)
|
tag = ENV.fetch('SOURCE_TAG', nil)
|
||||||
|
return if tag.nil? || tag.empty?
|
||||||
|
tag
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_url
|
def source_url
|
||||||
|
|
|
@ -165,7 +165,8 @@
|
||||||
"yargs": "^17.7.0"
|
"yargs": "^17.7.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"kind-of": "^6.0.3"
|
"kind-of": "^6.0.3",
|
||||||
|
"@babel/types": "^7.21.3"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"bufferutil": "^4.0.7",
|
"bufferutil": "^4.0.7",
|
||||||
|
|
19
yarn.lock
19
yarn.lock
|
@ -1505,25 +1505,14 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
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":
|
"@babel/types@npm:^7.21.3":
|
||||||
version: 7.21.0
|
version: 7.21.3
|
||||||
resolution: "@babel/types@npm:7.21.0"
|
resolution: "@babel/types@npm:7.21.3"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/helper-string-parser": ^7.19.4
|
"@babel/helper-string-parser": ^7.19.4
|
||||||
"@babel/helper-validator-identifier": ^7.19.1
|
"@babel/helper-validator-identifier": ^7.19.1
|
||||||
to-fast-properties: ^2.0.0
|
to-fast-properties: ^2.0.0
|
||||||
checksum: dbcdda202b3a2bfd59e4de880ce38652f1f8957893a9751be069ac86e47ad751222070fe6cd92220214d77973f1474e4e1111c16dc48199dfca1489c0ee8c0c5
|
checksum: b750274718ba9cefd0b81836c464009bb6ba339fccce51b9baff497a0a2d96c044c61dc90cf203cec0adc770454b53a9681c3f7716883c802b85ab84c365ba35
|
||||||
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
|
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue