UNMAINTAINED

This commit is contained in:
hoellen
2018-01-22 22:30:12 +01:00
parent 792ab407e1
commit afd3d476fd
49 changed files with 0 additions and 192 deletions

View File

@ -0,0 +1,93 @@
FROM alpine:3.6
ARG VERSION=master
ARG REPOSITORY=tootsuite/mastodon
ARG LIBICONV_VERSION=1.15
ENV UID=991 GID=991 \
RUN_DB_MIGRATIONS=true \
SIDEKIQ_WORKERS=5 \
RAILS_SERVE_STATIC_FILES=true \
RAILS_ENV=production \
NODE_ENV=production \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mastodon/bin
WORKDIR /mastodon
# Install dependencies
RUN apk -U upgrade \
&& apk add \
ca-certificates \
ffmpeg \
file \
git \
icu-libs \
imagemagick \
libidn \
libpq \
libressl \
nodejs-current-npm \
nodejs-current \
protobuf \
ruby \
ruby-bigdecimal \
ruby-io-console \
ruby-irb \
ruby-json \
s6 \
su-exec \
# Install build dependencies
&& apk add -t build-dependencies \
build-base \
icu-dev \
libffi-dev \
libidn-dev \
libtool \
postgresql-dev \
protobuf-dev \
python \
ruby-dev \
ruby-rdoc \
tar \
yarn \
# Update CA certificates
&& update-ca-certificates \
# Install GNU Libiconv
&& wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz -O /tmp/libiconv-${LIBICONV_VERSION}.tar.gz \
&& mkdir /tmp/src && tar xzf /tmp/libiconv-${LIBICONV_VERSION}.tar.gz -C /tmp/src \
&& cd /tmp/src/libiconv-${LIBICONV_VERSION} \
&& ./configure --prefix=/usr/local \
&& make -j$(getconf _NPROCESSORS_ONLN) && make install && libtool --finish /usr/local/lib \
# Install Mastodon
&& cd /mastodon \
&& wget -qO- https://github.com/${REPOSITORY}/archive/${VERSION}.tar.gz | tar xz --strip 1 \
&& gem install bundler \
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --clean --no-cache --without test development \
&& yarn --ignore-optional --pure-lockfile \
# Precompile Mastodon assets
&& SECRET_KEY_BASE=$(rake secret) SMTP_FROM_ADDRESS= rake assets:precompile \
&& mv public/assets /tmp/assets && mv public/packs /tmp/packs \
# Clean
&& npm -g cache clean && yarn cache clean \
&& apk del build-dependencies \
&& rm -rf /var/cache/apk/* /tmp/src
COPY rootfs /
RUN chmod +x /usr/local/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/*
VOLUME /mastodon/public/system /mastodon/public/assets /mastodon/public/packs /mastodon/log
EXPOSE 3000 4000
LABEL maintainer="Wonderfall <wonderfall@targaryen.house>" \
description="A GNU Social-compatible microblogging server"
ENTRYPOINT ["/usr/local/bin/run"]
CMD ["/bin/s6-svscan", "/etc/s6.d"]

View File

@ -0,0 +1,93 @@
FROM alpine:3.6
ARG VERSION=v1.6.0
ARG REPOSITORY=tootsuite/mastodon
ARG LIBICONV_VERSION=1.15
ENV UID=991 GID=991 \
RUN_DB_MIGRATIONS=true \
SIDEKIQ_WORKERS=5 \
RAILS_SERVE_STATIC_FILES=true \
RAILS_ENV=production \
NODE_ENV=production \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mastodon/bin
WORKDIR /mastodon
# Install dependencies
RUN apk -U upgrade \
&& apk add \
ca-certificates \
ffmpeg \
file \
git \
icu-libs \
imagemagick \
libidn \
libpq \
libressl \
nodejs-current-npm \
nodejs-current \
protobuf \
ruby \
ruby-bigdecimal \
ruby-io-console \
ruby-irb \
ruby-json \
s6 \
su-exec \
# Install build dependencies
&& apk add -t build-dependencies \
build-base \
icu-dev \
libffi-dev \
libidn-dev \
libtool \
postgresql-dev \
protobuf-dev \
python \
ruby-dev \
ruby-rdoc \
tar \
yarn \
# Update CA certificates
&& update-ca-certificates \
# Install GNU Libiconv
&& wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz -O /tmp/libiconv-${LIBICONV_VERSION}.tar.gz \
&& mkdir /tmp/src && tar xzf /tmp/libiconv-${LIBICONV_VERSION}.tar.gz -C /tmp/src \
&& cd /tmp/src/libiconv-${LIBICONV_VERSION} \
&& ./configure --prefix=/usr/local \
&& make -j$(getconf _NPROCESSORS_ONLN) && make install && libtool --finish /usr/local/lib \
# Install Mastodon
&& cd /mastodon \
&& wget -qO- https://github.com/${REPOSITORY}/archive/${VERSION}.tar.gz | tar xz --strip 1 \
&& gem install bundler \
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --clean --no-cache --without test development \
&& yarn --ignore-optional --pure-lockfile \
# Precompile Mastodon assets
&& SECRET_KEY_BASE=$(rake secret) SMTP_FROM_ADDRESS= rake assets:precompile \
&& mv public/assets /tmp/assets && mv public/packs /tmp/packs \
# Clean
&& npm -g cache clean && yarn cache clean \
&& apk del build-dependencies \
&& rm -rf /var/cache/apk/* /tmp/src
COPY rootfs /
RUN chmod +x /usr/local/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/*
VOLUME /mastodon/public/system /mastodon/public/assets /mastodon/public/packs /mastodon/log
EXPOSE 3000 4000
LABEL maintainer="Wonderfall <wonderfall@targaryen.house>" \
description="A GNU Social-compatible microblogging server"
ENTRYPOINT ["/usr/local/bin/run"]
CMD ["/bin/s6-svscan", "/etc/s6.d"]

View File

@ -0,0 +1,96 @@
FROM alpine:3.6
ARG VERSION=v1.6.0
ARG REPOSITORY=tootsuite/mastodon
ARG LIBICONV_VERSION=1.15
ENV UID=991 GID=991 \
RUN_DB_MIGRATIONS=true \
SIDEKIQ_WORKERS=5 \
RAILS_SERVE_STATIC_FILES=true \
RAILS_ENV=production \
NODE_ENV=production \
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mastodon/bin
WORKDIR /mastodon
COPY targaryen /tmp/targaryen
# Install dependencies
RUN apk -U upgrade \
&& apk add \
ca-certificates \
ffmpeg \
file \
git \
icu-libs \
imagemagick \
libidn \
libpq \
libressl \
nodejs-current-npm \
nodejs-current \
protobuf \
ruby \
ruby-bigdecimal \
ruby-io-console \
ruby-irb \
ruby-json \
s6 \
su-exec \
# Install build dependencies
&& apk add -t build-dependencies \
build-base \
icu-dev \
libffi-dev \
libidn-dev \
libtool \
postgresql-dev \
protobuf-dev \
python \
ruby-dev \
ruby-rdoc \
tar \
yarn \
# Update CA certificates
&& update-ca-certificates \
# Install GNU Libiconv
&& wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${LIBICONV_VERSION}.tar.gz -O /tmp/libiconv-${LIBICONV_VERSION}.tar.gz \
&& mkdir /tmp/src && tar xzf /tmp/libiconv-${LIBICONV_VERSION}.tar.gz -C /tmp/src \
&& cd /tmp/src/libiconv-${LIBICONV_VERSION} \
&& ./configure --prefix=/usr/local \
&& make -j$(getconf _NPROCESSORS_ONLN) && make install && libtool --finish /usr/local/lib \
# Install Mastodon
&& cd /mastodon \
&& wget -qO- https://github.com/${REPOSITORY}/archive/${VERSION}.tar.gz | tar xz --strip 1 \
&& cp -R /tmp/targaryen/* . && chmod +x targaryen.sh && ./targaryen.sh \
&& gem install bundler \
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --clean --no-cache --without test development \
&& yarn --ignore-optional --pure-lockfile \
# Precompile Mastodon assets
&& SECRET_KEY_BASE=$(rake secret) SMTP_FROM_ADDRESS= rake assets:precompile \
&& mv public/assets /tmp/assets && mv public/packs /tmp/packs \
# Clean
&& npm -g cache clean --force && yarn cache clean \
&& apk del build-dependencies \
&& rm -rf /var/cache/apk/* /tmp/src
COPY rootfs /
RUN chmod +x /usr/local/bin/* /etc/s6.d/*/* /etc/s6.d/.s6-svscan/*
VOLUME /mastodon/public/system /mastodon/public/assets /mastodon/public/packs /mastodon/log
EXPOSE 3000 4000
LABEL maintainer="Wonderfall <wonderfall@targaryen.house>" \
description="A GNU Social-compatible microblogging server"
ENTRYPOINT ["/usr/local/bin/run"]
CMD ["/bin/s6-svscan", "/etc/s6.d"]

View File

@ -0,0 +1,65 @@
## wonderfall/mastodon
![Mastodon](https://github.com/tootsuite/mastodon/blob/master/app/javascript/images/mastodon-getting-started.png?raw=true)
A GNU Social-compatible microblogging server : https://github.com/tootsuite/mastodon
#### Why this image?
This image is not the official one. The main difference you can notice is that all processes (web, streaming, sidekiq) are running in a single container, thanks to s6 (a supervision suite). Therefore it's easier to deploy, but not recommended for scaling on more than one machine.
#### Features
- Based on Alpine Linux 3.6.
- As lightweight as possible.
- All-in-one container (s6).
- Assets are precompiled.
- Database migrations can be run at startup.
- No root processes.
#### Docker Hub tags
- **master** : latest code for adventurers (builds daily on Docker Hub)
- **stable** : latest stable version (builds weekly on Docker Hub)
- **targaryen** : Targaryen-themed stable version (builds weekly on Docker Hub)
#### Build-time variables
- **VERSION** : version of Mastodon, can be `v1.4.1` or `master`. *(default : master)*
- **REPOSITORY** : location of the code *(default : tootsuite/mastodon)*
#### Environment variables you should change
- **UID** : mastodon user id *(default : 991)*
- **GID** : mastodon group id *(default : 991)*
- **RUN_DB_MIGRATIONS** : run `rake db:migrate` at startup *(default : true)*
- **SIDEKIQ_WORKERS** : number of Sidekiq workers *(default : 5)*
- Other environment variables : https://github.com/tootsuite/mastodon/blob/master/.env.production.sample
#### Volumes
- **/mastodon/public/system** : shit like media attachments, avatars, etc.
- **/mastodon/public/assets** : Mastodon assets
- **/mastodon/public/packs** : Mastodon assets
- **/mastodon/log** : Mastodon logfiles (mount if you prefer to)
#### Ports
- **3000** : Mastodon web
- **4000** : Mastodon streaming
#### docker-compose sample
```
mastodon:
image: wonderfall/mastodon:stable
restart: always
container_name: mastodon
env_file: /home/docker/mastodon/.env.production
environment:
- WEB_CONCURRENCY=16
- MAX_THREADS=20
- SIDEKIQ_WORKERS=25
- RUN_DB_MIGRATIONS=true
links:
- mastodon-pgb
- mastodon-redis
volumes:
- /home/docker/mastodon/public/system:/mastodon/public/system
- /home/docker/mastodon/public/assets:/mastodon/public/assets
- /home/docker/mastodon/public/packs:/mastodon/public/packs
```

View File

@ -0,0 +1,2 @@
#!/bin/sh
exit 0

View File

@ -0,0 +1,3 @@
#!/bin/sh
cd /mastodon
exec bundle exec sidekiq -c $SIDEKIQ_WORKERS -q default -q push -q pull -q mailers > ./log/sidekiq.log 2>&1

View File

@ -0,0 +1,3 @@
#!/bin/sh
cd /mastodon
exec npm run start > ./log/streaming.log 2>&1

View File

@ -0,0 +1,3 @@
#!/bin/sh
cd /mastodon
exec bundle exec puma -C config/puma.rb > ./log/web.log 2>&1

View File

@ -0,0 +1,56 @@
#!/bin/sh
### 1. Adds local user (UID and GID are provided from environment variables).
### 2. Moves precompiled assets into them.
### 3. Updates permissions, except for ./public/system (should be chown on previous installations).
### NOTE : this can take a long time if overlay2 is the storage-driver (issue #3194).
### 4. If $RUN_DB_MIGRATIONS is set to true, runs the database migrations task.
### 5. Executes the command as that user.
echo "
---------------------------------------------
_____ _ _
| |___ ___| |_ ___ _| |___ ___
| | | | .'|_ -| _| . | . | . | |
|_|_|_|__,|___|_| |___|___|___|_|_|
A GNU Social-compatible microblogging server
https://github.com/tootsuite/mastodon
17j2g7vpgHhLuXhN4bueZFCvdxxieyRVWd
---------------------------------------------
UID/GID settings
---------------------------------------------
User ID : ${UID}
Group ID : ${GID}
---------------------------------------------
Logs location
---------------------------------------------
Sidekiq : /mastodon/log/sidekiq.log
Streaming : /mastodon/log/streaming.log
Web : /mastodon/log/web.log
---------------------------------------------
"
echo "Creating mastodon user..."
addgroup -g ${GID} mastodon &>/dev/null
adduser -h /mastodon -s /bin/sh -D -G mastodon -u ${UID} mastodon &>/dev/null
echo "Moving assets to volumes..."
cp -r /tmp/assets/* public/assets &>/dev/null
cp -r /tmp/packs/* public/packs &>/dev/null
echo "Updating permissions, this can take a while..."
find /mastodon -path /mastodon/public/system -prune -o -not -user mastodon -not -group mastodon -print0 | xargs -0 chown -f mastodon:mastodon
chown -R mastodon:mastodon /etc/s6.d
if [ "$RUN_DB_MIGRATIONS" == "true" ]; then
echo "Running database migrations task..."
su-exec mastodon:mastodon rake db:migrate
fi
echo "Executing process(es)..."
if [ '$@' == '' ]; then
exec su-exec mastodon:mastodon /bin/s6-svscan /etc/s6.d
else
exec su-exec mastodon:mastodon "$@"
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 306 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 306 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,29 @@
// Commonly used web colors
$black: #000000; // Black
$white: #ffffff; // White
$success-green: #79bd9a; // Padua
$error-red: #df405a; // Cerise
$warning-red: #ff5050; // Sunset Orange
$gold-star: #ca8f04; // Dark Goldenrod
// Values from the classic Mastodon UI
$classic-base-color: #282828; // Midnight Grey
$classic-primary-color: #c89b9b; // Echo Red
$classic-secondary-color: #e8d9d9; // Pattens Red
$classic-highlight-color: #d92b2b; // Summer RedSky
// Variables for defaults in UI
$base-shadow-color: $black !default;
$base-overlay-background: $black !default;
$base-border-color: $white !default;
$simple-background-color: $white !default;
$primary-text-color: $white !default;
$valid-value-color: $success-green !default;
$error-value-color: $error-red !default;
// Tell UI to use selected colors
$ui-base-color: $classic-base-color !default; // Darkest
$ui-base-lighter-color: lighten($ui-base-color, 26%) !default; // Lighter darkest
$ui-primary-color: $classic-primary-color !default; // Lighter
$ui-secondary-color: $classic-secondary-color !default; // Lightest
$ui-highlight-color: $classic-highlight-color !default; // Vibrant

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@ -0,0 +1,18 @@
#!/bin/sh
### Increase number of characters / toot
sed -i -e 's/500/800/g' \
app/javascript/mastodon/features/compose/components/compose_form.js \
app/validators/status_length_validator.rb \
storybook/stories/character_counter.story.js \
config/locales/*.yml
### Increase bio length
sed -i -e 's/160/400/g' \
app/javascript/packs/public.js \
app/models/account.rb \
app/views/settings/profiles/show.html.haml
### Dragon emoji
sed -i -e 's/1f602/1f432/g' \
app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js