geminabox
This commit is contained in:
parent
a2e27c5316
commit
bb87782f9b
5 changed files with 72 additions and 1 deletions
33
Dockerfile
33
Dockerfile
|
@ -1,2 +1,33 @@
|
||||||
FROM sutty/monit:latest
|
FROM sutty/sdk-ruby:latest AS build
|
||||||
MAINTAINER "f <f@sutty.nl>"
|
MAINTAINER "f <f@sutty.nl>"
|
||||||
|
|
||||||
|
RUN install -dm 2750 -o app -g www-data /srv/http
|
||||||
|
|
||||||
|
USER app
|
||||||
|
WORKDIR /srv/http
|
||||||
|
COPY --chown=app:www-data ./Gemfile .
|
||||||
|
COPY --chown=app:www-data ./config.ru .
|
||||||
|
RUN bundle install --path=./vendor
|
||||||
|
RUN find ./vendor -name '*.so' | xargs -r strip --strip-unneeded
|
||||||
|
|
||||||
|
FROM sutty/daemonize:latest AS daemonize
|
||||||
|
|
||||||
|
RUN echo /home/builder/packages/home > /etc/apk/repositories
|
||||||
|
RUN apk add --no-cache daemonize
|
||||||
|
|
||||||
|
FROM sutty/monit
|
||||||
|
ENV RACK_ENV=production
|
||||||
|
|
||||||
|
RUN addgroup -g 82 -S www-data
|
||||||
|
RUN adduser -s /bin/sh -G www-data -h /srv/http -D app
|
||||||
|
|
||||||
|
RUN apk add --no-cache ruby ruby-bundler ruby-json
|
||||||
|
COPY --from=daemonize /usr/sbin/daemonize /usr/sbin/daemonize
|
||||||
|
COPY ./monit.conf /etc/monit.d/geminabox.conf
|
||||||
|
COPY ./geminabox.sh /usr/local/bin/geminabox
|
||||||
|
COPY --from=build /srv/http /srv/http
|
||||||
|
RUN install -dm 2750 -o app -g www-data /srv/http/geminabox
|
||||||
|
RUN chmod 755 /usr/local/bin/geminabox
|
||||||
|
|
||||||
|
EXPOSE 9292
|
||||||
|
VOLUME /srv/http/geminabox
|
||||||
|
|
7
Gemfile
Normal file
7
Gemfile
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
gem 'redis-rack'
|
||||||
|
gem 'hiredis'
|
||||||
|
gem 'redis', require: %w[redis redis/connection/hiredis]
|
||||||
|
gem 'geminabox'
|
||||||
|
gem 'puma'
|
11
config.ru
Normal file
11
config.ru
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
require 'geminabox'
|
||||||
|
require 'rack/session/redis'
|
||||||
|
|
||||||
|
Geminabox.data = '/srv/http'
|
||||||
|
Geminabox.rubygems_proxy = true
|
||||||
|
Geminabox.allow_remote_failure = true
|
||||||
|
|
||||||
|
use Rack::Session::Redis, redis_server: 'redis://redis:6379/2'
|
||||||
|
use Rack::Protection
|
||||||
|
|
||||||
|
run Geminabox::Server
|
18
geminabox.sh
Normal file
18
geminabox.sh
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
dir=/srv/http/geminabox
|
||||||
|
pid=/tmp/geminabox.pid
|
||||||
|
|
||||||
|
chown -R app:www-data /srv/http
|
||||||
|
cd ${dir}
|
||||||
|
|
||||||
|
for link in Gemfile Gemfile.lock .bundle config.ru vendor; do
|
||||||
|
test -e ${link} && continue
|
||||||
|
ln -s ../${link} .
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -f ${pid}
|
||||||
|
daemonize -p ${pid} -l ${pid} -o ${dir}/access.log -e ${dir}/error.log \
|
||||||
|
-c ${dir} -a -u app \
|
||||||
|
`which bundle` exec rackup
|
4
monit.conf
Normal file
4
monit.conf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
check process geminabox with pidfile /tmp/geminabox.pid
|
||||||
|
start program = "/usr/local/bin/geminabox"
|
||||||
|
stop program = "/bin/sh -c 'cat /tmp/geminabox.pid | xargs kill'"
|
||||||
|
if failed port 9292 protocol http for 3 times within 5 cycles then restart
|
Loading…
Reference in a new issue