mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Merge branch 'fix-startup-output' into 'master'
Fixes scary output on docker startup. Closes #26 See merge request !55
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM treeder/dind
|
||||
FROM funcy/dind
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
4
Makefile
4
Makefile
@@ -29,10 +29,10 @@ docker-dep:
|
||||
docker-build:
|
||||
docker pull funcy/go:dev
|
||||
docker run --rm -v ${CURDIR}:/go/src/gitlab-odx.oracle.com/odx/functions -w /go/src/gitlab-odx.oracle.com/odx/functions funcy/go:dev go build -o functions-alpine
|
||||
docker build --build-arg HTTP_PROXY -t treeder/functions:latest .
|
||||
docker build --build-arg HTTP_PROXY -t funcy/functions:latest .
|
||||
|
||||
docker-run: docker-build
|
||||
docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e LOG_LEVEL=debug -e "DB_URL=bolt:///app/data/bolt.db" -v ${CURDIR}/data:/app/data -p 8080:8080 treeder/functions
|
||||
docker run --rm --privileged -it -e NO_PROXY -e HTTP_PROXY -e LOG_LEVEL=debug -e "DB_URL=bolt:///app/data/bolt.db" -v ${CURDIR}/data:/app/data -p 8080:8080 funcy/functions
|
||||
|
||||
docker-test:
|
||||
docker run -ti --privileged --rm -e LOG_LEVEL=debug \
|
||||
|
||||
@@ -208,18 +208,17 @@ func (s *Server) startGears(ctx context.Context) {
|
||||
}
|
||||
|
||||
const runHeader = `
|
||||
____ __
|
||||
/ __ \_________ ______/ /__
|
||||
/ / / / ___/ __ / ___/ / _ \
|
||||
/ /_/ / / / /_/ / /__/ / __/
|
||||
\_________ \__,_/\___/_/\____
|
||||
/ ____/_ __ ___ _____/ /_( )___ ____ _____
|
||||
/ /_ / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/
|
||||
/ __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__ )
|
||||
/_/ \____/_/ /_/\___/\__/_/\____/_/ /_/____/
|
||||
`
|
||||
|
||||
logrus.Infof(runHeader)
|
||||
____ __
|
||||
/ __ \_________ ______/ /__
|
||||
/ / / / ___/ __ / ___/ / _ \
|
||||
/ /_/ / / / /_/ / /__/ / __/
|
||||
\_________ \__,_/\___/_/\____
|
||||
/ ____/_ __ ___ _____/ /_( )___ ____ _____
|
||||
/ /_ / / / / __ \/ ___/ __/ / __ \/ __ \/ ___/
|
||||
/ __/ / /_/ / / / / /__/ /_/ / /_/ / / / (__ )
|
||||
/_/ \____/_/ /_/\___/\__/_/\____/_/ /_/____/
|
||||
`
|
||||
fmt.Println(runHeader)
|
||||
logrus.Infof("Serving Functions API on address `%s`", listen)
|
||||
|
||||
svr := &supervisor.Supervisor{
|
||||
|
||||
@@ -20,7 +20,3 @@ release:
|
||||
GOOS=darwin go build -o fn_mac
|
||||
GOOS=windows go build -o fn.exe
|
||||
docker run --rm -v ${PWD}:/go/src/gitlab-odx.oracle.com/odx/functions/fn -w /go/src/gitlab-odx.oracle.com/odx/functions/fn funcy/go:dev go build -o fn_alpine
|
||||
|
||||
# install locally
|
||||
install: build
|
||||
sudo mv fn /usr/local/bin/
|
||||
|
||||
@@ -30,7 +30,8 @@ func start(c *cli.Context) error {
|
||||
if c.String("log-level") != "" {
|
||||
denvs = append(denvs, "GIN_MODE="+c.String("log-level"))
|
||||
}
|
||||
// docker run --rm -it --name functions -v ${PWD}/data:/app/data -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 treeder/functions
|
||||
// Socket mount: docker run --rm -it --name functions -v ${PWD}/data:/app/data -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 funcy/functions
|
||||
// OR dind: docker run --rm -it --name functions -v ${PWD}/data:/app/data --privileged -p 8080:8080 funcy/functions
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
logrus.WithError(err).Fatalln("Getwd failed")
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
FROM docker:1.13.1-dind
|
||||
FROM docker:edge-dind
|
||||
|
||||
RUN apk update && apk upgrade && apk add --no-cache ca-certificates
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
COPY dind.sh /usr/local/bin/
|
||||
# cleanup warning: https://github.com/docker-library/docker/issues/55
|
||||
RUN addgroup -g 2999 docker
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
COPY preentry.sh /usr/local/bin/
|
||||
|
||||
# USAGE: Add a CMD to your own Dockerfile to use this (NOT an ENTRYPOINT, so that this is called)
|
||||
ENTRYPOINT ["preentry.sh"]
|
||||
|
||||
# USAGE: Add a CMD to your own Dockerfile to use this (NOT an ENTRYPOINT), eg:
|
||||
# CMD ["./runner"]
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
This is the base image for all Titan's docker-in-docker images.
|
||||
This is the base image for all docker-in-docker images.
|
||||
|
||||
The difference between this and the official `docker` images are that this will choose the best
|
||||
filesystem automatically. The official ones use `vfs` (bad) by default unless you pass in a flag.
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.1.2
|
||||
0.1.3
|
||||
@@ -1,3 +1,3 @@
|
||||
set -ex
|
||||
|
||||
docker build -t treeder/dind:latest .
|
||||
docker build --build-arg HTTP_PROXY -t funcy/dind:latest .
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
# modified from: https://github.com/docker-library/docker/blob/866c3fbd87e8eeed524fdf19ba2d63288ad49cd2/1.11/dind/dockerd-entrypoint.sh
|
||||
# this will run either overlay or aufs as the docker fs driver, if the OS has both, overlay is preferred.
|
||||
# rewrite overlay to use overlay2 (docker 1.12, linux >=4.x required), see https://docs.docker.com/engine/userguide/storagedriver/selectadriver/#overlay-vs-overlay2
|
||||
|
||||
fsdriver=$(grep -Eh -w -m1 "overlay|aufs" /proc/filesystems | cut -f2)
|
||||
|
||||
if [ $fsdriver == "overlay" ]; then
|
||||
fsdriver="overlay2"
|
||||
fi
|
||||
|
||||
cmd="dockerd \
|
||||
--host=unix:///var/run/docker.sock \
|
||||
--host=tcp://0.0.0.0:2375 \
|
||||
--storage-driver=$fsdriver"
|
||||
|
||||
# nanny and restart on crashes
|
||||
until eval $cmd; do
|
||||
echo "Docker crashed with exit code $?. Respawning.." >&2
|
||||
# if we just restart it won't work, so start it (it wedges up) and
|
||||
# then kill the wedgie and restart it again and ta da... yea, seriously
|
||||
pidfile=/var/run/docker/libcontainerd/docker-containerd.pid
|
||||
kill -9 $(cat $pidfile)
|
||||
rm $pidfile
|
||||
sleep 1
|
||||
done
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -ex
|
||||
|
||||
/usr/local/bin/dind.sh &
|
||||
|
||||
# wait for daemon to initialize
|
||||
sleep 3
|
||||
|
||||
exec "$@"
|
||||
14
images/dind/preentry.sh
Executable file
14
images/dind/preentry.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
fsdriver=$(grep -Eh -w -m1 "overlay|aufs" /proc/filesystems | cut -f2)
|
||||
if [ $fsdriver == "overlay" ]; then
|
||||
fsdriver="overlay2"
|
||||
fi
|
||||
|
||||
dockerd-entrypoint.sh --storage-driver=$fsdriver &
|
||||
|
||||
# give docker a few seconds
|
||||
sleep 3
|
||||
|
||||
exec "$@"
|
||||
@@ -6,7 +6,7 @@ docker run --rm -v "$PWD":/app treeder/bump patch
|
||||
version=`cat VERSION`
|
||||
echo "version $version"
|
||||
|
||||
docker tag treeder/dind:latest treeder/dind:$version
|
||||
docker tag funcy/dind:latest funcy/dind:$version
|
||||
|
||||
docker push treeder/dind:latest
|
||||
docker push treeder/dind:$version
|
||||
docker push funcy/dind:latest
|
||||
docker push funcy/dind:$version
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
user="treeder"
|
||||
user="funcy"
|
||||
service="functions"
|
||||
tag="latest"
|
||||
|
||||
@@ -34,11 +34,10 @@ git tag -f -a "$version" -m "version $version"
|
||||
git push
|
||||
git push origin $version
|
||||
|
||||
# TODO: Where to push these?
|
||||
# Finally tag and push docker images
|
||||
# docker tag $user/$service:$tag $user/$service:$version
|
||||
# docker push $user/$service:$version
|
||||
# docker push $user/$service:$tag
|
||||
docker tag $user/$service:$tag $user/$service:$version
|
||||
docker push $user/$service:$version
|
||||
docker push $user/$service:$tag
|
||||
|
||||
cd fn
|
||||
./release.sh $version
|
||||
|
||||
Reference in New Issue
Block a user