mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 14:16:23 +00:00
Merge branch 'rails' into panel.sutty.nl
This commit is contained in:
commit
563085654f
3 changed files with 11 additions and 69 deletions
|
@ -1,10 +1,4 @@
|
||||||
# Excluir todo
|
# Excluir todo
|
||||||
*
|
*
|
||||||
# Solo agregar lo que usamos en COPY
|
# Solo agregar lo que usamos en COPY
|
||||||
!./.git/
|
# !./archivo
|
||||||
!./rubygems-platform-musl.patch
|
|
||||||
!./Gemfile
|
|
||||||
!./Gemfile.lock
|
|
||||||
!./config/credentials.yml.enc
|
|
||||||
!./public/assets/
|
|
||||||
!./public/packs/
|
|
||||||
|
|
58
Dockerfile
58
Dockerfile
|
@ -1,67 +1,21 @@
|
||||||
FROM registry.nulo.in/sutty/rails:3.13.6-2.7.5 AS build
|
|
||||||
MAINTAINER "f <f@sutty.nl>"
|
|
||||||
|
|
||||||
ARG BRANCH
|
|
||||||
ENV BRANCH=$BRANCH
|
|
||||||
|
|
||||||
RUN apk add --no-cache libxslt libxml2 tzdata postgresql-libs git yarn brotli libssh2 python3 findutils
|
|
||||||
|
|
||||||
USER rails
|
|
||||||
WORKDIR /srv/gems
|
|
||||||
|
|
||||||
COPY --chown=rails:www-data ./Gemfile .
|
|
||||||
COPY --chown=rails:www-data ./Gemfile.lock .
|
|
||||||
|
|
||||||
RUN bundle config set no-cache true
|
|
||||||
RUN bundle config set specific_platform true
|
|
||||||
RUN bundle install --path=./vendor --without='test development'
|
|
||||||
|
|
||||||
COPY --chown=rails:www-data ./.git/ ./.git/
|
|
||||||
|
|
||||||
RUN cd .. && git clone sutty checkout
|
|
||||||
RUN cd ../checkout && git checkout $BRANCH
|
|
||||||
|
|
||||||
WORKDIR /srv/checkout
|
|
||||||
|
|
||||||
RUN rm -rf ./vendor ./node_modules ./tmp/cache ./.git ./test ./doc
|
|
||||||
RUN mv ../gems/vendor ./vendor
|
|
||||||
RUN mv ../gems/.bundle ./.bundle
|
|
||||||
RUN find /srv/checkout/vendor/ruby/2.7.0 -maxdepth 3 -type d -name test -o -name spec -o -name rubocop | xargs -r rm -rf
|
|
||||||
|
|
||||||
FROM registry.nulo.in/sutty/rails:3.13.6-2.7.5
|
FROM registry.nulo.in/sutty/rails:3.13.6-2.7.5
|
||||||
|
ARG PANDOC_VERSION=2.17.1.1
|
||||||
ENV RAILS_ENV production
|
ENV RAILS_ENV production
|
||||||
|
|
||||||
# Pandoc
|
|
||||||
RUN echo 'https://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories
|
|
||||||
|
|
||||||
# Instalar las dependencias, separamos la librería de base de datos para
|
# Instalar las dependencias, separamos la librería de base de datos para
|
||||||
# poder reutilizar este primer paso desde otros contenedores
|
# poder reutilizar este primer paso desde otros contenedores
|
||||||
#
|
#
|
||||||
# Necesitamos yarn para que Jekyll pueda generar los sitios
|
# Necesitamos yarn para que Jekyll pueda generar los sitios
|
||||||
# XXX: Eliminarlo cuando extraigamos la generación de sitios del proceso
|
# XXX: Eliminarlo cuando extraigamos la generación de sitios del proceso
|
||||||
# principal
|
# principal
|
||||||
RUN apk add --no-cache libxslt libxml2 postgresql-libs libssh2 file \
|
RUN apk add --no-cache libxslt libxml2 postgresql-libs libssh2 \
|
||||||
rsync git jpegoptim vips ffmpeg imagemagick pandoc tectonic \
|
rsync git jpegoptim vips tectonic oxipng git-lfs openssh-client \
|
||||||
oxipng git-lfs openssh-client patch yarn daemonize ruby-webrick
|
yarn daemonize ruby-webrick
|
||||||
|
|
||||||
RUN gem install --no-document --no-user-install foreman
|
RUN gem install --no-document --no-user-install foreman
|
||||||
|
RUN wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz -O - | tar --strip-components 1 -xvzf - pandoc-${PANDOC_VERSION}/bin/pandoc && mv /bin/pandoc /usr/bin/pandoc
|
||||||
|
|
||||||
USER rails
|
VOLUME "/srv"
|
||||||
|
|
||||||
RUN rm -rf /srv
|
|
||||||
COPY --from=build --chown=rails:www-data /srv/checkout /srv
|
|
||||||
|
|
||||||
RUN rm -rf /srv/http/_sites /srv/http/_deploy
|
|
||||||
RUN ln -s data/_storage /srv/http/_storage
|
|
||||||
RUN ln -s data/_sites /srv/http/_sites
|
|
||||||
RUN ln -s data/_deploy /srv/http/_deploy
|
|
||||||
RUN ln -s data/_private /srv/http/_private
|
|
||||||
|
|
||||||
USER root
|
|
||||||
RUN install -m 640 -o root -g root /srv/monit.conf /etc/monit.d/sutty.conf
|
|
||||||
RUN install -m 755 /srv/entrypoint.sh /usr/local/bin/sutty
|
|
||||||
|
|
||||||
VOLUME "/srv/data"
|
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
EXPOSE 9394
|
EXPOSE 9394
|
||||||
|
|
14
Makefile
14
Makefile
|
@ -26,7 +26,7 @@ hain ?= ENV_FILE=.env $(HAINISH)## Ubicación de Hainish
|
||||||
#
|
#
|
||||||
# Production es el entorno de panel.sutty.nl
|
# Production es el entorno de panel.sutty.nl
|
||||||
ifeq ($(env),production)
|
ifeq ($(env),production)
|
||||||
container ?= sutty
|
container ?= panel
|
||||||
## TODO: Cambiar a otra cosa
|
## TODO: Cambiar a otra cosa
|
||||||
branch ?= rails
|
branch ?= rails
|
||||||
public ?= public
|
public ?= public
|
||||||
|
@ -115,15 +115,9 @@ ota-js: assets ## Actualizar Javascript en el nodo delegado
|
||||||
ssh root@$(delegate) docker exec $(container) sh -c "cat /srv/http/tmp/puma.pid | xargs -r kill -USR2"
|
ssh root@$(delegate) docker exec $(container) sh -c "cat /srv/http/tmp/puma.pid | xargs -r kill -USR2"
|
||||||
|
|
||||||
ota: ## Actualizar Rails en el nodo delegado
|
ota: ## Actualizar Rails en el nodo delegado
|
||||||
umask 022; git format-patch $(commit)
|
ssh $(delegate) git -C /srv/sutty/srv/http/panel.sutty.nl pull ; true
|
||||||
ssh $(delegate) mkdir -p /tmp/patches-$(commit)/
|
ssh $(delegate) chown -R 1000:82 /srv/sutty/srv/http/panel.sutty.nl
|
||||||
scp ./0*.patch $(delegate):/tmp/patches-$(commit)/
|
ssh $(delegate) docker exec $(container) rails reload
|
||||||
scp ./ota.sh $(delegate):/tmp/
|
|
||||||
ssh $(delegate) docker cp /tmp/patches-$(shell echo $(commit) | cut -d / -f 1) $(container):/tmp/
|
|
||||||
ssh $(delegate) docker cp /tmp/ota.sh $(container):/usr/local/bin/ota
|
|
||||||
ssh $(delegate) docker exec $(container) apk add --no-cache patch
|
|
||||||
ssh $(delegate) docker exec $(container) ota $(commit)
|
|
||||||
rm ./0*.patch
|
|
||||||
|
|
||||||
# Todos los archivos de assets. Si alguno cambia, se van a recompilar
|
# Todos los archivos de assets. Si alguno cambia, se van a recompilar
|
||||||
# los assets que luego se suben al nodo delegado.
|
# los assets que luego se suben al nodo delegado.
|
||||||
|
|
Loading…
Reference in a new issue