Commit 4d884eac authored by KemoNine's avatar KemoNine
Browse files

Many updates related to docker overhaul

parent 05666acf
......@@ -45,6 +45,7 @@ This should be adaptable to any Armbian device but the focus of the documentatio
- [Postgresl (Use for NextCloud/Gogs/Wallabag/TT-RSS/Turtl if desired, required for some)](docs/armbian/postgres.md)
- [NextCloud (fundamental price cloud services)](docs/armbian/nextcloud.md)
- [Gogs (self hosted git/github/gitlab)](docs/armbian/gogs.md)
- [Gitea (self hosted git/github/gitlab)](docs/armbian/gitea.md)
- [Wallabag (self hosted read it later / pocket)](docs/armbian/wallabag.md)
- [TT-RSS (self hosted RSS reader - think Google Reader)](docs/armbian/ttrss.md)
- [Turtl (self hosted evernote/one note)](docs/armbian/turtl.md)
......
......@@ -79,7 +79,7 @@ REPOSITORY=/tank/backup
/usr/local/bin/borg prune -v --list \$REPOSITORY \\
--keep-daily=7 \\
--keep-weekly=4 \\
--keep-monthly=2
--keep-monthly=6
EOF
......
https://github.com/docker/distribution
https://github.com/docker/docker.github.io/blob/master/registry/deploying.md
https://stackoverflow.com/questions/24309526/how-to-change-the-docker-image-installation-directory
Prereq : Docker installed
Prereq : Docker config
/etc/docker/daemon.json
graph: /tank/docker/graph
docker info | grep "Docker Root Dir"
docker pull ubuntu:16.04 # pull from hub
docker tag ubuntu:16.04 localhost:5000/my-ubuntu # tag for registry
docker push localhost:5000/my-ubuntu # push to registry
docker image remove ubuntu:16.04 # nuke local cache
docker image remove localhost:5000/my-ubuntu # nuke local cached
docker pull localhost:5000/my-ubuntu # pull from registry
docker run --name registry \
--restart unless-stopped \\
-p 5000:5000 \
-e TZ=UTC \\
-e DEBUG=1 \\
-e REGISTRY_HTTP_ADDR=0.0.0.0:5000 \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
-e REGISTRY_AUTH=htpasswd \
-e REGISTRY_AUTH_HTPASSWD_REALM="Registry Realm" \
-e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd \
-v /path/data:/var/lib/registry
-v /path/certs:/certs
-v /path/auth:/auth
registry/registry:$tag
......@@ -7,78 +7,11 @@ Self hosted git repos, issue tracking and more. Think GitHub/GitLab but self hos
- [https://discuss.gogs.io/t/how-to-backup-restore-and-migrate/991](https://discuss.gogs.io/t/how-to-backup-restore-and-migrate/991)
- [https://blog.meinside.pe.kr/Gogs-on-Raspberry-Pi/](https://blog.meinside.pe.kr/Gogs-on-Raspberry-Pi/)
## Install / Update / Run Script
## Build/Install/Update/Run Scripts
Setup a generic script that'll auto update Gogs, build a container and launch it. You should only run this script at first launch and/or when you're looking for updates.
``` bash
mkdir -p /var/gogs
chown git:root /var/gogs
mkdir /root/docker/gogs
git clone https://github.com/gogits/gogs.git /root/docker/gogs/src
cat > /root/docker/gogs/gogs.sh << EOF
#!/bin/bash
cd /root/docker/gogs/src
git fetch
LATESTTAG=\`git describe --abbrev=0 --tags\`
git checkout \$LATESTTAG
ARCH=\`arch\`
DOCKERFILE="Dockerfile"
# Cleanup arch/container image here
if [ \$ARCH == "aarch64" ]
then
echo "64bit arm"
DOCKERFILE="Dockerfile.aarch64"
else
echo "32bit arm"
DOCKERFILE="Dockerfile.rpi"
fi
docker build \\
--network docker-private \\
--file ./\$DOCKERFILE \\
--tag gogs/gogs:\$LATESTTAG \\
.
# Cleanup existing container
docker stop gogs
docker rm gogs
##########
# For postgresql instead of sqlite run the following commands
#docker exec -it postgres psql -U postgres
#create role gogs nocreatedb nocreaterole login PASSWORD 'password';
#create database gogs owner=gogs encoding=UTF8;
# Setup the below env vars using the above database/username/role and ip of 172.30.12.12
##########
# Re-run/create container with latest image
# See https://gogs.io/docs/advanced/configuration_cheat_sheet.html for more options
docker run \\
--name gogs \\
--restart unless-stopped \\
--net docker-private \\
--ip 172.30.6.6 \\
-e TZ=UTC \\
-e DEBUG=1 \\
-e RUN_CROND=1 \\
-e APP_NAME=gogs \\
-e DOMAIN=domain.tld \\
-e ROOT_URL=https://gogs.domain.tld \\
-e DB_TYPE=sqlite3 \\
-v /var/gogs:/data \\
gogs/gogs:\$LATESTTAG
EOF
chmod a+x /root/docker/gogs/gogs.sh
```
```FIXME : Update with wget/sed from repo```
## Run Gogs
......@@ -86,49 +19,15 @@ Simply execute ```/root/docker/gogs/gogs.sh``` to update/run Gogs.
## Serving Via Caddy
``` bash
cat > /etc/caddy/services/gogs.conf <<EOF
# Gogs proxy
gogs:80, gogs:443, gogs.domain.tld:80, gogs.domain.tld:443 {
redir 301 {
if {scheme} is http
/ https://gogs.domain.tld{uri}
}
log /var/log/caddy/gogs.log
proxy / 172.30.6.6:3000 {
transparent
}
# Use acme.sh Let's Encrypt SSL cert setup
tls /var/acme.sh/domain.tld/fullchain.cer /var/acme.sh/domain.tld/domain.tld.key
}
EOF
```
```FIXME : Update with wget/sed from repo```
## Update Unbound
``` bash
cat > /etc/unbound/local_zone/gogs.conf <<EOF
local-data: "gogs-insecure A 172.30.6.6"
local-data-ptr: "172.30.6.6 gogs-insecure"
local-data: "gogs-insecure.domain.tld A 172.30.6.6"
local-data-ptr: "172.30.6.6 gogs-insecure.domain.tld"
local-data: "gogs A 172.30.0.1"
local-data-ptr: "172.30.0.1 gogs"
local-data: "gogs.domain.tld A 172.30.0.1"
local-data-ptr: "172.30.0.1 gogs.domain.tld"
EOF
```
```FIXME : Update with wget/sed from repo```
## First Run / Finalize Setup
- Navigate to ```http://gogs-insecure.domain.tld:3000```
- Follow on-screen prompts for finalizing setup
- Be sure to specify an admin user
- Login and enjoy
- Login to ```https://gogs.domain.tld``` and enjoy
......@@ -41,7 +41,6 @@ else
fi
docker build \\
--network docker-private \\
--file ./Dockerfile \\
--tag searx/searx:\$LATESTTAG \\
.
......
#!/bin/bash
# https://github.com/borgbackup/borg/issues/1018#issuecomment-231768877
# https://borg.bauerj.eu/
apt-get update
apt-get install -y curl fakeroot build-essential git jq
apt-get install -y libssl-dev libacl1-dev liblz4-dev libfuse-dev fuse pkg-config
apt-get install -y zlib1g-dev libbz2-dev libncurses5-dev libreadline-dev liblzma-dev libsqlite3-dev
BORG_RELEASE=$(curl -s https://api.github.com/repos/borgbackup/borg/releases/latest | jq -r .tag_name)
PYINSTALLER_RELEASE=$(curl -s https://api.github.com/repos/pyinstaller/pyinstaller/releases/latest | jq -r .tag_name)
ARCH=$(uname -m)
PYTHON="3.5.3"
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
export PATH="/root/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install -v $PYTHON
pyenv shell $PYTHON
cd /opt
git clone https://github.com/borgbackup/borg/
cd borg
git checkout $BORG_RELEASE
pip install -r requirements.d/development.txt
cd /opt
git clone https://github.com/pyinstaller/pyinstaller.git
cd pyinstaller
git checkout $PYINSTALLER_RELEASE
cd bootloader
python ./waf all --no-lsb
cd ..
pip install -e .
cd /opt/borg
pip install -e .
LD_LIBRARY_PATH=~/.pyenv/versions/$PYTHON/lib/ pyinstaller -F -n borg-$ARCH --clean borg/__main__.py
/opt/borg/dist/borg-armv7l
FROM arm32v6/golang:1.10-alpine
RUN apk add --no-cache git build-base
RUN go get -u github.com/mholt/caddy/caddy
RUN go get -u github.com/caddyserver/builds
WORKDIR /go/src/github.com/mholt/caddy/caddy
RUN GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 go run build.go -o /go/bin/caddy
FROM arm32v6/alpine:3.7
RUN apk add --no-cache ca-certificates tzdata
COPY --from=0 /go/bin/caddy /go/bin/caddy
CMD /go/bin/caddy
#!/bin/bash
LATESTTAG=`curl -s https://api.github.com/repos/mholt/caddy/releases/latest | jq -r .tag_name`
ARCH=`arch`
REPO='caddy'
# Cleanup arch/container image here
if [ $ARCH == "aarch64" ]
then
echo "64bit arm"
REPO='arm64v8'
else
echo "32bit arm"
REPO='arm32v7'
fi
docker build \
--file ./Dockerfile \
--tag $REPO/caddy:$LATESTTAG \
.
FROM arm64v8/golang:1.10-alpine
ARG DRONETAG=v0.8.5
RUN apk add --no-cache git build-base
RUN go get -u github.com/drone/drone-ui/dist
RUN go get -u golang.org/x/net/context
RUN go get -u golang.org/x/net/context/ctxhttp
RUN go get -u github.com/golang/protobuf/proto
RUN go get -u github.com/golang/protobuf/protoc-gen-go
#RUN go get -u github.com/drone/drone/cmd/drone-agent
WORKDIR /go/src/github.com/drone
RUN git clone https://github.com/drone/drone --single-branch --branch $DRONETAG
WORKDIR /go/src/github.com/drone/drone/cmd/drone-agent/
RUN GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -ldflags '-extldflags "-static" -X github.com/drone/drone/version.VersionDev=build.'${DRONETAG} -o /go/bin/drone-agent
FROM arm64v8/alpine:3.7
EXPOSE 3000
HEALTHCHECK CMD ["/bin/drone-agent", "ping"]
ENV GODEBUG=netdns=go
RUN apk add --no-cache ca-certificates
COPY --from=0 /go/bin/drone-agent /bin/drone-agent
CMD /bin/drone-agent
#!/bin/bash
cd /tank/docker/build/drone/agent
cp ../Dockerfile.drone.agent .
ARCH=`arch`
DOCKERFILE="Dockerfile"
REPO='drone-agent'
# Cleanup arch/container image here
if [ $ARCH == "aarch64" ]
then
echo "64bit arm"
REPO='arm64v8'
else
echo "32bit arm"
REPO='arm32v7'
sed -i s/arm64v8/arm32v6/g Dockerfile.drone.agent
sed -i 's/GOARCH=arm64/GOARCH=arm GOARM=7/g' Dockerfile.drone.agent
fi
git fetch
#LATESTTAG=`curl -s https://api.github.com/repos/drone/drone/releases/latest | jq -r .tag_name`
LATESTTAG=v0.8.5
docker build \
--file ./Dockerfile.drone.agent \
--build-arg DRONETAG=$LATESTTAG \
--tag $REPO/drone-agent:$LATESTTAG \
.
#!/bin/bash
# Cleanup existing container
docker stop drone-agent
docker rm drone-agent
# Figure out which arch we are and set the repo appropriately
ARCH=`arch`
REPO='drone'
if [ $ARCH == "aarch64" ]
then
echo "64bit arm"
REPO='arm64v8'
else
echo "32bit arm"
REPO='arm32v7'
fi
LATESTTAG=`docker image ls ${REPO}/drone-agent | sort -r | grep -v TAG | awk '{ print $2}'`
# Re-run/create container with latest image
# See http://docs.drone.io/installation/ for more options/details
# Generate DRONE_SECRET with openssl
docker run \
--name drone-agent \
--restart unless-stopped \
--net host \
-e TZ=UTC \
-e DEBUG=1 \
-e DRONE_DEBUG=true \
-e DRONE_SERVER=drone.lolipop.holdmybeer.solutions:9000 \
-e DRONE_SECRET="InsecureSecret" \
-v /var/run/docker.sock:/var/run/docker.sock \
$REPO/drone-agent:$LATESTTAG
FROM arm32v6/golang:1.10-alpine
RUN apk add --no-cache git build-base
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR /go/src/github.com/drone-plugins
RUN git clone https://github.com/drone-plugins/drone-docker/
WORKDIR /go/src/github.com/drone-plugins/drone-docker
#https://github.com/drone-plugins/drone-docker/blob/master/.drone.yml
RUN dep ensure
RUN dep status
RUN GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -tags netgo -o /go/bin/drone-docker
#GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-heroku github.com/drone-plugins/drone-docker/cmd/drone-docker-heroku
#GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-gcr github.com/drone-plugins/drone-docker/cmd/drone-docker-gcr
#GOOS=linux GOARCH=arm CGO_ENABLED=0 GOARM=7 go build -a -tags netgo -o release/linux/arm/drone-docker-ecr github.com/drone-plugins/drone-docker/cmd/drone-docker-ecr
FROM arm32v6/alpine:3.7
RUN apk add --no-cache ca-certificates git openssh curl perl
COPY --from=0 /go/bin/drone-docker /go/bin/drone-docker
CMD /go/bin/drone-docker
docker build \
--file ./Dockerfile \
--tag plugins/docker:latest \
.
FROM arm32v6/golang:1.10-alpine
RUN apk add --no-cache git build-base
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR /go/src/github.com/drone-plugins
RUN git clone https://github.com/drone-plugins/drone-download/
WORKDIR /go/src/github.com/drone-plugins/drone-download
RUN dep ensure
RUN dep status
RUN GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 go build -a -tags netgo -o /go/bin/drone-download
FROM arm32v6/alpine:3.7
RUN apk add --no-cache ca-certificates
COPY --from=0 /go/bin/drone-download /go/bin/drone-download
CMD /go/bin/drone-download
docker build \
--file ./Dockerfile \
--tag plugins/download:latest \
.
FROM arm32v6/golang:1.10-alpine
RUN apk add --no-cache git build-base
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR /go/src/github.com/drone-plugins
RUN git clone https://github.com/drone-plugins/drone-downstream/
WORKDIR /go/src/github.com/drone-plugins/drone-downstream
RUN dep ensure
RUN dep status
RUN GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 go build -a -tags netgo -o /go/bin/drone-downstream
FROM arm32v6/alpine:3.7
RUN apk add --no-cache ca-certificates
COPY --from=0 /go/bin/drone-downstream /go/bin/drone-downstream
CMD /go/bin/drone-downstream
docker build \
--file ./Dockerfile \
--tag plugins/downstream:latest \
.
FROM arm32v6/golang:1.10-alpine
RUN apk add --no-cache git build-base
RUN go get -u github.com/drone/drone-ui/dist
RUN go get -u golang.org/x/net/context
RUN go get -u golang.org/x/net/context/ctxhttp
RUN go get -u github.com/golang/protobuf/proto
RUN go get -u github.com/golang/protobuf/protoc-gen-go
WORKDIR /go/src/github.com/drone-plugins
RUN git clone https://github.com/drone-plugins/drone-git
WORKDIR /go/src/github.com/drone-plugins/drone-git
RUN GOOS=linux GOARCH=arm ARM=7 CGO_ENABLED=0 go build -a -tags netgo -o /go/bin/drone-git
FROM arm32v6/alpine:3.7
RUN apk add --no-cache ca-certificates git openssh curl perl
COPY --from=0 /go/bin/drone-git /bin/drone-git
CMD /bin/drone-git
docker build \
--file ./Dockerfile \
--tag plugins/git:latest \
.
FROM arm32v6/golang:1.10-alpine
RUN apk add --no-cache git build-base
RUN go get -u github.com/golang/dep/cmd/dep
WORKDIR /go/src/github.com/drone-plugins
RUN git clone https://github.com/drone-plugins/drone-gitea-release/
WORKDIR /go/src/github.com/drone-plugins/drone-gitea-release
RUN dep ensure
RUN dep status
RUN GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 go build -a -tags netgo -o /go/bin/drone-gitea-release
FROM arm32v6/alpine:3.7
RUN apk add --no-cache ca-certificates
COPY --from=0 /go/bin/drone-gitea-release /go/bin/drone-gitea-release
CMD /go/bin/drone-gitea-release
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment