Gosuper Integration into supervisor image and Jenkins

This commit is contained in:
Pablo Carranza Vélez 2015-07-23 14:00:37 -03:00
parent 0587858f69
commit 30ce6f77c4
9 changed files with 41 additions and 7 deletions

View File

@ -32,6 +32,9 @@ RUN chmod +x /app/src/enterContainer.sh \
&& /app/node_modules/.bin/coffee -c /app/src \
&& ln -sf /app/entry.sh /start # Needed for legacy
RUN mv /app/gosuper/bin/linux_amd64/gosuper /app/gosuper/bin/
RUN chmod +x /app/gosuper/bin/gosuper
ENV SUPERVISOR_IMAGE resin/amd64-supervisor
ENV CONFIG_MOUNT_POINT /boot/config.json
ENV LED_FILE /dev/null

View File

@ -32,6 +32,9 @@ RUN chmod +x /app/src/enterContainer.sh \
&& /app/node_modules/.bin/coffee -c /app/src \
&& ln -sf /app/entry.sh /start # Needed for legacy
RUN mv /app/gosuper/bin/linux_arm/gosuper /app/gosuper/bin/
RUN chmod +x /app/gosuper/bin/gosuper
ENV SUPERVISOR_IMAGE resin/armv7hf-supervisor
ENV CONFIG_MOUNT_POINT /boot/config.json
ENV LED_FILE /dev/null

View File

@ -7,6 +7,8 @@ ENV GOPATH /usr/src/app
WORKDIR /usr/src/app
RUN chmod +x src/resin-supervisor/build_gosuper.sh
# Run go install with -a (force rebuilding of all packages)
# and -v (print package names as they are built)
CMD go test ./... && go install -a -v ./...
CMD cd ./src/resin-supervisor && ./build_gosuper.sh

View File

@ -32,6 +32,9 @@ RUN chmod +x /app/src/enterContainer.sh \
&& /app/node_modules/.bin/coffee -c /app/src \
&& ln -sf /app/entry.sh /start # Needed for legacy
RUN mv /app/gosuper/bin/linux_386/gosuper /app/gosuper/bin/
RUN chmod +x /app/gosuper/bin/gosuper
ENV SUPERVISOR_IMAGE resin/i386-supervisor
ENV CONFIG_MOUNT_POINT /boot/config.json
ENV LED_FILE /dev/null

View File

@ -32,4 +32,7 @@ RUN chmod +x /app/src/enterContainer.sh \
&& /app/node_modules/.bin/coffee -c /app/src \
&& ln -sf /app/entry.sh /start # Needed for legacy
RUN mv /app/gosuper/bin/linux_arm/gosuper /app/gosuper/bin/
RUN chmod +x /app/gosuper/bin/gosuper
CMD ["/app/entry.sh"]

View File

@ -40,7 +40,7 @@ stop-supervisor:
# as per https://github.com/jpetazzo/dind/issues/19
-docker rm -f --volumes resin_supervisor_1 > /dev/null
supervisor:
supervisor: gosuper
cp Dockerfile.$(ARCH) Dockerfile
echo "ENV VERSION "`jq -r .version package.json` >> Dockerfile
docker build --no-cache=$(DISABLE_CACHE) -t resin/$(ARCH)-supervisor:$(SUPERVISOR_VERSION) .
@ -51,13 +51,10 @@ deploy: supervisor
docker push $(DEPLOY_REGISTRY)$(IMAGE)
go-builder:
cp Dockerfile.gosuper Dockerfile
docker build -t resin/go-supervisor-builder:$(SUPERVISOR_VERSION) .
-rm Dockerfile
docker build -f Dockerfile.gosuper -t resin/go-supervisor-builder:$(SUPERVISOR_VERSION) .
gosuper: go-builder
-mkdir gosuper/bin
-mkdir -p gosuper/bin
docker run -v $(shell pwd)/gosuper/bin:/usr/src/app/bin -e GOARCH=$(GOARCH) resin/go-supervisor-builder:$(SUPERVISOR_VERSION)
.PHONY: supervisor deploy supervisor-dind run-supervisor

12
build_gosuper.sh Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -e
go install -a -v ./...
# For consistency, always keep the binary within a linux_$GOARCH folder
if (( $GOARCH == "amd64" )); then
mkdir $GOPATH/bin/linux_$GOARCH || true
cp $GOPATH/bin/gosuper $GOPATH/bin/linux_$GOARCH/
fi
chmod -R a+rwx $GOPATH/bin

View File

@ -22,5 +22,6 @@ mount -t tmpfs -o size=1m tmpfs /var/run/resin
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
supervisorctl start resin-supervisor
supervisorctl start go-supervisor
tail -f /var/log/supervisor/supervisord.log

10
go-supervisor.conf Normal file
View File

@ -0,0 +1,10 @@
[program:go-supervisor]
directory=/app
command=/app/gosuper/bin/gosuper
redirect_stderr=true
autorestart=true
autostart=false
stdout_logfile=/var/log/go_supervisor_stdout.log
stderr_logfile=/var/log/go_supervisor_error.log
stdout_logfile_maxbytes=2MB
stdout_logfile_backups=5