about ready to start testingabout ready to start testing
This commit is contained in:
parent
bf6a0dc199
commit
c7b081f5b9
14
Dockerfile
14
Dockerfile
@ -3,6 +3,15 @@ FROM phusion/baseimage:0.11
|
|||||||
# Use baseimage-docker's init system.
|
# Use baseimage-docker's init system.
|
||||||
CMD ["/sbin/my_init"]
|
CMD ["/sbin/my_init"]
|
||||||
|
|
||||||
|
ENV \
|
||||||
|
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/app/bin
|
||||||
|
|
||||||
|
|
||||||
# install os prereq stuff to image
|
# install os prereq stuff to image
|
||||||
ADD prereqs.sh /tmp/prereqs.sh
|
ADD prereqs.sh /tmp/prereqs.sh
|
||||||
RUN bash /tmp/prereqs.sh
|
RUN bash /tmp/prereqs.sh
|
||||||
@ -10,6 +19,8 @@ RUN bash /tmp/prereqs.sh
|
|||||||
# install mastodon:
|
# install mastodon:
|
||||||
ADD install.sh /tmp/install.sh
|
ADD install.sh /tmp/install.sh
|
||||||
|
|
||||||
|
WORKDIR /mastodon
|
||||||
|
ENV HOME /mastodon
|
||||||
RUN chpst -u mastodon:mastodon bash /tmp/install.sh
|
RUN chpst -u mastodon:mastodon bash /tmp/install.sh
|
||||||
|
|
||||||
ADD ./rootfs /
|
ADD ./rootfs /
|
||||||
@ -19,3 +30,6 @@ RUN chmod +x /usr/local/bin/* /etc/service/*/run
|
|||||||
VOLUME /state
|
VOLUME /state
|
||||||
|
|
||||||
EXPOSE 3000 4000
|
EXPOSE 3000 4000
|
||||||
|
|
||||||
|
LABEL maintainer="Jeffrey Paul <sneak@sneak.berlin>" \
|
||||||
|
description="Your self-hosted, globally interconnected microblogging community"
|
||||||
|
7
Makefile
7
Makefile
@ -1,4 +1,9 @@
|
|||||||
|
NAME := sneak/mastodon
|
||||||
|
|
||||||
default: build
|
default: build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
docker build -t sneak/mastodon .
|
docker build -t $(NAME) .
|
||||||
|
|
||||||
|
run:
|
||||||
|
docker run -ti $(NAME)
|
||||||
|
12
install.sh
12
install.sh
@ -1,6 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
export HOME="/mastodon"
|
|
||||||
export PATH="$HOME/.rbenv/bin:$PATH"
|
export PATH="$HOME/.rbenv/bin:$PATH"
|
||||||
export RUBY_CONFIGURE_OPTS="--with-jemalloc"
|
export RUBY_CONFIGURE_OPTS="--with-jemalloc"
|
||||||
|
|
||||||
@ -10,8 +9,8 @@ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.bashrc
|
|||||||
echo 'eval "$(rbenv init -)"' >> $HOME/.bashrc
|
echo 'eval "$(rbenv init -)"' >> $HOME/.bashrc
|
||||||
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
||||||
eval "$(rbenv init -)"
|
eval "$(rbenv init -)"
|
||||||
rbenv install 2.6.1
|
rbenv install 2.6.5
|
||||||
rbenv global 2.6.1
|
rbenv global 2.6.5
|
||||||
gem update --system
|
gem update --system
|
||||||
gem install bundler --no-document
|
gem install bundler --no-document
|
||||||
|
|
||||||
@ -20,7 +19,12 @@ cd /mastodon/app
|
|||||||
# v3.0.1:
|
# v3.0.1:
|
||||||
git checkout c4118ba71ba31e408c02d289e111326ccc6f6aa2
|
git checkout c4118ba71ba31e408c02d289e111326ccc6f6aa2
|
||||||
|
|
||||||
|
bundle config build.nokogiri --use-system-libraries
|
||||||
bundle install \
|
bundle install \
|
||||||
-j$(getconf _NPROCESSORS_ONLN) \
|
-j$(getconf _NPROCESSORS_ONLN) \
|
||||||
--deployment --without development test
|
--deployment --without development test
|
||||||
yarn install --pure-lockfile
|
yarn install --pure-lockfile --ignore-engines
|
||||||
|
|
||||||
|
OTP_SECRET=precompile_placeholder \
|
||||||
|
SECRET_KEY_BASE=precompile_placeholder \
|
||||||
|
bundle exec rails assets:precompile
|
||||||
|
5
rootfs/etc/service/postfix/run
Normal file
5
rootfs/etc/service/postfix/run
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "postfix starting..."
|
||||||
|
|
||||||
|
exec /usr/lib/postfix/master
|
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "postgres starting..."
|
||||||
|
|
||||||
|
mkdir -p /state/db
|
||||||
|
chown mastodon:mastodon /state/db
|
||||||
|
exec chpst -u mastodon:mastodon /usr/lib/postgresql/bin/postmaster \
|
||||||
|
-D /state/db 2>&1
|
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
mkdir -p /state/redis
|
||||||
|
chown mastodon:mastodon /state/redis
|
||||||
|
exec chpst -u mastodon:mastodon /usr/bin/redis-server /etc/redis/redis.conf
|
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
while [[ -e /state/.starting ]]; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "sidekiq starting..."
|
||||||
|
|
||||||
|
cd /mastodon/app
|
||||||
|
exec \
|
||||||
|
envdir /state/envdir \
|
||||||
|
chpst -u mastodon:mastodon \
|
||||||
|
bash -c "bundle exec sidekiq -c $SIDEKIQ_WORKERS -q default -q push -q pull -q mailers"
|
25
rootfs/etc/service/startup/run
Normal file
25
rootfs/etc/service/startup/run
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
touch /state/.starting
|
||||||
|
echo "mastodon-startup starting up..."
|
||||||
|
|
||||||
|
if [[ ! -d /state/envdir ]]; then
|
||||||
|
mkdir -p /state/envdir
|
||||||
|
chown mastodon:mastodon /state/envdir
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -e /state/envdir/HOME ]]; then
|
||||||
|
echo "/mastodon" > /state/envdir/HOME
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd /mastodon/app
|
||||||
|
|
||||||
|
if [ "$RUN_DB_MIGRATIONS" == "true" ]; then
|
||||||
|
echo "Running database migrations..."
|
||||||
|
envdir /state/envdir chpst -u mastodon:mastodon bash -c "bundle exec rake db:migrate"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm /state/.starting
|
||||||
|
while true ; do
|
||||||
|
sleep 86400
|
||||||
|
done
|
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
while [[ -e /state/.starting ]]; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "streaming starting..."
|
||||||
|
|
||||||
|
cd /mastodon/app
|
||||||
|
exec envdir /state/envdir chpst -u mastodon:mastodon bash -c "npm run start"
|
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
while [[ -e /state/.starting ]]; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "web starting..."
|
||||||
|
|
||||||
|
cd /mastodon/app
|
||||||
|
exec envdir /state/envdir chpst -u mastodon:mastodon bash -c "bundle exec puma -C config/puma.rb"
|
Loading…
Reference in New Issue
Block a user