Commit 31cdc627 authored by Noah Prail's avatar Noah Prail

feat: Switch to Docker image

parent b49506d6
Pipeline #13244 passed with stage
in 1 minute and 52 seconds
......@@ -2,4 +2,5 @@ caddy*.deb
caddy-*
bin/
!*.service
!*.conf
\ No newline at end of file
!*.conf
.env
\ No newline at end of file
stages:
- build
- package
- deploy
- post-deploy
variables:
DEFAULT_VERSION: 1.0.0
build:
stage: build
tags:
- docker
image: golang:1.12-alpine
before_script:
- apk add --no-cache git gcc musl-dev
- if [ -n "${VERSION}" ]; then export RELEASE=true && echo "Release Version"; fi
- export VERSION=${VERSION:-"${DEFAULT_VERSION}"}
script:
- sh scripts/builder.sh
artifacts:
paths:
- bin/
package_deb:
stage: package
tags:
- docker
image: registry.e1dev.com/docker/deb:latest
dependencies:
- build
- docker-shell
before_script:
- if [ -n "${VERSION}" ]; then export RELEASE=true && echo "Release Version"; else export VERSION=${VERSION:-"${DEFAULT_VERSION}"}-${CI_PIPELINE_ID}; fi
- export VERSION=${VERSION}
script:
- cp bin/caddy . && rm -rf bin/
- bash scripts/deb-builder.sh
artifacts:
paths:
- bin/
deploy_bin:
stage: deploy
tags:
- docker
image: registry.e1dev.com/docker/aws-cli:latest
dependencies:
- build
- package_deb
script:
- aws s3 cp bin s3://cdn.filiosoft.com/artifacts/caddy/ --recursive
deploy_deb:
stage: deploy
tags:
- docker
image: registry.e1dev.com/docker/deb:latest
dependencies:
- build
- package_deb
before_script:
- echo -e $GPG_KEY > gpg.key
- gpg --allow-secret-key-import --import gpg.key
- if [ -n "${VERSION}" ]; then export RELEASE=true && echo "Release Version"; fi
- export VERSION=${VERSION:-"${DEFAULT_VERSION}"}
script:
- bash scripts/deb-publish.sh
invalidations:
stage: post-deploy
tags:
- docker
image: registry.e1dev.com/docker/aws-cli:latest
- docker info
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- aws configure set preview.cloudfront true
- aws cloudfront create-invalidation --distribution-id E1MS659EX3VE05 --paths "/artificats/caddy/*"
- aws cloudfront create-invalidation --distribution-id E1MS659EX3VE05 --paths "/debian/*"
\ No newline at end of file
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" -t "$CI_REGISTRY_IMAGE:latest" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
- docker push "$CI_REGISTRY_IMAGE:latest"
FROM golang:1.12-alpine
RUN mkdir /app
ADD build /app/
WORKDIR /app
RUN apk add --no-cache git gcc musl-dev
ENV GO111MODULE=on
ENV VERSION=1.0.0
RUN go get github.com/mholt/caddy@v${VERSION} && \
go build
ENTRYPOINT ["/app/caddy"]
\ No newline at end of file
# Caddy Automated Builds
# Caddy
Caddy docker image.
Automated caddy builds from source to get past the Caddy EULA.
## Debian Packages
### Stable release builds
```bash
curl -o- -sL https://cdn.filiosoft.com/debian/setup | sudo bash -s
sudo apt-get install caddy
### based on [golang:1.12-alpine](https://hub.docker.com/_/golang/)
----
### Pull from e1dev
```
docker pull registry.e1dev.com/docker/caddy:latest
```
### Nightly beta builds
```bash
curl -o- -sL https://cdn.filiosoft.com/debian/setup | sudo bash -s -- --nightly
sudo apt-get install caddy
### Build from GitLab
```
docker build -t registry.e1dev.com/docker/caddy https://e1dev.com/docker/caddy.git
```
## Binary Download
- [Latest](https://cdn.filiosoft.com/artifacts/caddy/caddy)
- Specfic Version: `https://cdn.filiosoft.com/artifacts/caddy/caddy-$VERSION`
### Run image
```
docker run -it registry.e1dev.com/docker/caddy
```
`builder.sh` code from [abiosoft/caddy-docker](https://github.com/abiosoft/caddy-docker/blob/master/builder/builder.sh)
\ No newline at end of file
### Use as base image
```Dockerfile
FROM registry.e1dev.com/docker/caddy:latest
```
module caddy
go 1.12
require github.com/mholt/caddy v1.0.0
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/bifurcation/mint v0.0.0-20180715133206-93c51c6ce115 h1:fUjoj2bT6dG8LoEe+uNsKk8J+sLkDbQkJnB6Z1F02Bc=
github.com/bifurcation/mint v0.0.0-20180715133206-93c51c6ce115/go.mod h1:zVt7zX3K/aDCk9Tj+VM7YymsX66ERvzCJzw8rFCX2JU=
github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY=
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9 h1:a1zrFsLFac2xoM6zG1u72DWJwZG3ayttYLfmLbxVETk=
github.com/cheekybits/genny v0.0.0-20170328200008-9127e812e1e9/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-acme/lego v2.5.0+incompatible h1:5fNN9yRQfv8ymH3DSsxla+4aYeQt2IgfZqHKVnK8f0s=
github.com/go-acme/lego v2.5.0+incompatible/go.mod h1:yzMNe9CasVUhkquNvti5nAtPmG94USbYxYrZfTkIn0M=
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/hashicorp/go-syslog v1.0.0 h1:KaodqZuhUoZereWVIYmpUgZysurB1kBLX2j0MwMrUAE=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47 h1:UnszMmmmm5vLwWzDjTFVIkfhvWF1NdrmChl8L2NUDCw=
github.com/hashicorp/golang-lru v0.0.0-20180201235237-0fb14efe8c47/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a h1:BcF8coBl0QFVhe8vAMMlD+CV8EISiu9MGKLoj6ZEyJA=
github.com/jimstudt/http-authentication v0.0.0-20140401203705-3eca13d6893a/go.mod h1:wK6yTYYcgjHE1Z1QtXACPDjcFJyBskHEdagmnq3vsP8=
github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/lucas-clemente/aes12 v0.0.0-20171027163421-cd47fb39b79f h1:sSeNEkJrs+0F9TUau0CgWTTNEwF23HST3Eq0A+QIx+A=
github.com/lucas-clemente/aes12 v0.0.0-20171027163421-cd47fb39b79f/go.mod h1:JpH9J1c9oX6otFSgdUHwUBUizmKlrMjxWnIAjff4m04=
github.com/lucas-clemente/quic-clients v0.1.0/go.mod h1:y5xVIEoObKqULIKivu+gD/LU90pL73bTdtQjPBvtCBk=
github.com/lucas-clemente/quic-go v0.10.2 h1:iQtTSZVbd44k94Lu0U16lLBIG3lrnjDvQongjPd4B/s=
github.com/lucas-clemente/quic-go v0.10.2/go.mod h1:hvaRS9IHjFLMq76puFJeWNfmn+H70QZ/CXoxqw9bzao=
github.com/lucas-clemente/quic-go-certificates v0.0.0-20160823095156-d2f86524cced h1:zqEC1GJZFbGZA0tRyNZqRjep92K5fujFtFsu5ZW7Aug=
github.com/lucas-clemente/quic-go-certificates v0.0.0-20160823095156-d2f86524cced/go.mod h1:NCcRLrOTZbzhZvixZLlERbJtDtYsmMw8Jc4vS8Z0g58=
github.com/marten-seemann/qtls v0.2.3/go.mod h1:xzjG7avBwGGbdZ8dTGxlBnLArsVKLvwmjgmPuiQEcYk=
github.com/mholt/caddy v1.0.0 h1:KI6RPGih2GFzWRPG8s9clKK28Ns4ZlVMKR/v7mxq6+c=
github.com/mholt/caddy v1.0.0/go.mod h1:PzUpQ3yGCTuEuy0KSxEeB4TZOi3zBZ8BR/zY0RBP414=
github.com/mholt/certmagic v0.5.0 h1:lYXxsLUFya/I3BgDCrfuwcMQOB+4auzI8CCzpK41tjc=
github.com/mholt/certmagic v0.5.0/go.mod h1:g4cOPxcjV0oFq3qwpjSA30LReKD8AoIfwAY9VvG35NY=
github.com/miekg/dns v1.1.3 h1:1g0r1IvskvgL8rR+AcHzUA+oFmGcQlaIm4IqakufeMM=
github.com/miekg/dns v1.1.3/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks=
github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0=
github.com/naoina/toml v0.1.1 h1:PT/lllxVVN0gzzSqSlHEmP8MJB4MY2U7STGxiouV4X8=
github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4 h1:S9YlS71UNJIyS61OqGAmLXv3w5zclSidN+qwr80XxKs=
github.com/russross/blackfriday v0.0.0-20170610170232-067529f716f4/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190328230028-74de082e2cca h1:hyA6yiAgbUwuWqtscNvWAI7U1CtlaD1KilQ6iudt1aI=
golang.org/x/net v0.0.0-20190328230028-74de082e2cca/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190124100055-b90733256f2e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e h1:ZytStCyV048ZqDsWHiYDdoI2Vd4msMcrDECFxS+tL9c=
golang.org/x/sys v0.0.0-20190228124157-a34e9553db1e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/mcuadros/go-syslog.v2 v2.2.1/go.mod h1:l5LPIyOOyIdQquNg+oU6Z3524YwrcqEm0aKH+5zpt2U=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/square/go-jose.v2 v2.2.2 h1:orlkJ3myw8CN1nVQHBFfloD+L3egixIa4FvUP6RosSA=
gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
......@@ -2,9 +2,6 @@ package main
import (
"github.com/mholt/caddy/caddy/caddymain"
_ "github.com/caddyserver/dnsproviders/cloudflare"
_ "github.com/captncraig/cors"
)
func main() {
......
import conf.d/*.conf
* {
proxy / https://stagings-pages.event1.io {
transparent
}
gzip
tls {
ask https://api.event1.io/system/domain
}
}
*.convention.page {
proxy / https://stagings-pages.event1.io {
transparent
}
gzip
tls certs@event1.io {
wildcard
}
}
Section: web
Priority: optional
Homepage: https://caddyserver.com
Standards-Version: 3.9.2
Bugs: https://github.com/mholt/caddy/issues
Vcs-Browser: https://github.com/mholt/caddy
Package: caddy
Version: VERSION
Maintainer: eventOne Developers <developers@event1.io>
Architecture: amd64
Copyright: debian/copyright
License: Apache
Readme: README.md
Files: caddy /usr/local/bin/
index.html /usr/share/caddy/
caddy.service /etc/systemd/system/
caddy.conf /etc/caddy/
default-site.conf /etc/caddy/conf.d
envfile /etc/caddy/
Preinst: debian/preinst
Postinst: debian/postinst
Description: Caddy is the HTTP/2 web server with automatic HTTPS.
This diff is collapsed.
#!/bin/sh
set -e
chown root:root /usr/local/bin/caddy
chmod 755 /usr/local/bin/caddy
case "$1" in
configure)
echo "Registering service Caddy"
set +e
id -u www-data >/dev/null 2>&1
USER_EXISTS=$?
set -e
if [ ! $USER_EXISTS -eq 0 ]; then
useradd \
-g www-data --no-user-group \
--home-dir /var/www --no-create-home \
--shell /usr/sbin/nologin \
--group \
--system --uid 33 www-data
elif id -nG www-data | grep --invert-match --word-regexp --quiet 'www-data'; then
# User exists but is not part of the www-data group
echo "Adding www-data user to www-data group"
usermod -g www-data www-data
fi
echo "Setting up folders..."
# setup caddy folder
mkdir -p /etc/caddy/conf.d
chown -R root:www-data /etc/caddy
# caddy home folder
mkdir -p /var/lib/caddy
chown -R root:www-data /var/lib/caddy
chmod 0770 /var/lib/caddy
# setup logfile folder
mkdir -p /var/log/caddy
chown -R root:www-data /var/log/caddy
echo "Enabling Caddy service"
if command -v systemctl >/dev/null 2>&1; then
systemctl enable caddy
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
;;
esac
systemctl daemon-reload
systemctl start caddy.service
\ No newline at end of file
#!/bin/sh
set -e
systemctl stop caddy.service || true
\ No newline at end of file
:80 {
gzip
root /usr/share/caddy
}
version: '3'
services:
caddy:
build: .
# restart: always
ports:
- "443:443"
- "80:80"
- "2015:2015"
command: -agree=true -root=/var/tmp -quic -conf=/etc/caddy/caddy.conf
volumes:
- ./caddy.conf:/etc/caddy/caddy.conf
env_file:
- .env
\ No newline at end of file
module caddy
go 1.12
require (
github.com/caddyserver/dnsproviders v0.2.0
github.com/captncraig/cors v0.0.0-20190326022215-48080ede89fe
github.com/mholt/caddy v1.0.0
)
replace github.com/h2non/gock => gopkg.in/h2non/gock.v1 v1.0.14
This diff is collapsed.
#!/bin/sh
VERSION=${VERSION:-"1.0.0"}
echo "Building ${VERSION}"
export GO111MODULE=on
go get github.com/mholt/caddy@v${VERSION}
go build
mkdir -p bin && mv caddy bin/caddy
if [ -n "${RELEASE}" ]; then cp bin/caddy bin/caddy-${VERSION}; fi
bin/caddy -version
bin/caddy -plugins
#!/bin/bash
set -e
# build deb
if [ -x "$(command -v equivs-build)" ];
then
echo -e "\n==============\nPackaging DEB\n==============\n"
sed -i 's/^Version:.*$/Version: '"${VERSION}"'/g' debian/control
equivs-build --full debian/control
mkdir -p bin
cp caddy*.deb bin/caddy_latest_amd64.deb
if [ -n "${RELEASE}" ]; then mv caddy*.deb bin/; fi
fi
#!/bin/bash
set -e
echo -e "\n=============\nPublish Stage\n=============\n"
cat <<EOT > ~/.aptly.conf
{
"S3PublishEndpoints":{
"cdn.filiosoft.com":{
"region":"us-east-1",
"bucket":"cdn.filiosoft.com",
"prefix":"debian",
"acl":"public-read"
}
}
}
EOT
if [ -z "$RELEASE" ]
then
LATEST_PREFIX="nightly"
DISTRIBUTION=nightly
COMMENT="Nightly builds"
echo -e "\nNightly build\n"
else
LATEST_PREFIX="stable"
DISTRIBUTION=stable
COMMENT="Stable builds"
echo -e "\nStable build\n"
fi
echo -e "\nPublishing v${VERSION}-${LATEST_PREFIX}\n"
cp bin/caddy_latest_amd64.deb bin/caddy_${VERSION}-${LATEST_PREFIX}-${CI_PIPELINE_ID}_amd64.deb
wget -O - https://cdn.filiosoft.com/debian/pubkey.gpg | gpg --no-default-keyring --keyring trustedkeys.gpg --import
# setup repo mirror and pull
aptly mirror create e1 https://cdn.filiosoft.com/debian ${DISTRIBUTION}
aptly mirror update e1
# create new repo
aptly repo create -distribution=${DISTRIBUTION} -comment="${COMMENT}" -component=main caddy-release
# import mirror to repo
aptly repo import e1 caddy-release caddy
aptly repo add caddy-release bin/caddy_${VERSION}-${LATEST_PREFIX}-${CI_PIPELINE_ID}_amd64.deb
aptly snapshot create caddy-${VERSION} from repo caddy-release
aptly publish snapshot -force-overwrite -batch=true -gpg-key="F56BD64C" -passphrase="$GPG_PWD" -architectures="amd64" caddy-${VERSION} s3:cdn.filiosoft.com:
\ No newline at end of file
#!/bin/bash
# Script to install the eventOne repo onto a
# Debian or Ubuntu system.
#
# Run as root or insert `sudo -E` before `bash`:
#
# curl -sL https://cdn.filiosoft.com/debian/setup | bash -
# or
# wget -qO- https://cdn.filiosoft.com/debian/setup | bash -
#
export DEBIAN_FRONTEND=noninteractive
FSPKG="caddy"
if [ "$1" = '--nightly' ]; then
DIST=nightly
else
DIST=stable
fi
print_status() {
echo
echo "## $1"
echo
}
if test -t 1; then # if terminal
ncolors=$(which tput > /dev/null && tput colors) # supports color
if test -n "$ncolors" && test $ncolors -ge 8; then
termcols=$(tput cols)
bold="$(tput bold)"
underline="$(tput smul)"
standout="$(tput smso)"
normal="$(tput sgr0)"
black="$(tput setaf 0)"
red="$(tput setaf 1)"
green="$(tput setaf 2)"
yellow="$(tput setaf 3)"
blue="$(tput setaf 4)"
magenta="$(tput setaf 5)"
cyan="$(tput setaf 6)"
white="$(tput setaf 7)"
fi
fi
print_bold() {
title="$1"
text="$2"
echo
echo "${red}================================================================================${normal}"
echo "${red}================================================================================${normal}"
echo
echo -e " ${bold}${yellow}${title}${normal}"
echo
echo -en " ${text}"
echo
echo "${red}================================================================================${normal}"
echo "${red}================================================================================${normal}"
}
bail() {
echo 'Error executing command, exiting'
exit 1
}
exec_cmd_nobail() {
echo "+ $1"
bash -c "$1"
}
exec_cmd() {
exec_cmd_nobail "$1" || bail
}
setup() {
print_status "Installing the eventOne repo..."
if $(uname -m | grep -Eq ^armv6); then
print_status "You appear to be running on ARMv6 hardware. Unfortunately this is not currently supported by the eventOne Linux distributions."
exit 1
fi
PRE_INSTALL_PKGS=""
# Check that HTTPS transport is available to APT
# (Check snaked from: https://get.docker.io/ubuntu/)
if [ ! -e /usr/lib/apt/methods/https ]; then
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} apt-transport-https"
fi
if [ ! -x /usr/bin/lsb_release ]; then
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} lsb-release"
fi
if [ ! -x /usr/bin/curl ] && [ ! -x /usr/bin/wget ]; then
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} curl"
fi
# Populating Cache
print_status "Populating apt-get cache..."
exec_cmd 'apt-get update'
if [ "X${PRE_INSTALL_PKGS}" != "X" ]; then
print_status "Installing packages required for setup:${PRE_INSTALL_PKGS}..."
# This next command needs to be redirected to /dev/null or the script will bork
# in some environments
exec_cmd "apt-get install -y${PRE_INSTALL_PKGS} > /dev/null 2>&1"
fi
IS_PRERELEASE=$(lsb_release -d | grep 'Ubuntu .*development' >& /dev/null; echo $?)
if [[ $IS_PRERELEASE -eq 0 ]]; then
print_status "Your distribution, identified as \"$(lsb_release -d -s)\", is a pre-release version of Ubuntu. eventOne does not maintain official support for Ubuntu versions until they are formally released."
exit 1
fi
DISTRO=$(lsb_release -c -s)
check_alt() {
if [ "X${DISTRO}" == "X${2}" ]; then
echo
echo "## You seem to be using ${1} version ${DISTRO}."
echo "## This maps to ${3} \"${4}\"... Adjusting for you..."
DISTRO="${4}"
fi
}
check_alt "Kali" "sana" "Debian" "jessie"
check_alt "Kali" "kali-rolling" "Debian" "jessie"
check_alt "Linux Mint" "maya" "Ubuntu" "precise"
check_alt "Linux Mint" "qiana" "Ubuntu" "trusty"
check_alt "Linux Mint" "rafaela" "Ubuntu" "trusty"
check_alt "Linux Mint" "rebecca" "Ubuntu" "trusty"
check_alt "Linux Mint" "rosa" "Ubuntu" "trusty"
check_alt "Linux Mint" "sarah" "Ubuntu" "xenial"
check_alt "Linux Mint" "serena" "Ubuntu" "xenial"
check_alt "Linux Mint" "sonya" "Ubuntu" "xenial"
check_alt "LMDE" "betsy" "Debian" "jessie"
check_alt "elementaryOS" "luna" "Ubuntu" "precise"
check_alt "elementaryOS" "freya" "Ubuntu" "trusty"
check_alt "elementaryOS" "loki" "Ubuntu" "xenial"
check_alt "Trisquel" "toutatis" "Ubuntu" "precise"
check_alt "Trisquel" "belenos" "Ubuntu" "trusty"
check_alt "BOSS" "anokha" "Debian" "wheezy"
check_alt "bunsenlabs" "bunsen-hydrogen" "Debian" "jessie"
check_alt "Tanglu" "chromodoris" "Debian" "jessie"
if [ "X${DISTRO}" == "Xdebian" ]; then
print_status "Unknown Debian-based distribution, checking /etc/debian_version..."
NEWDISTRO=$([ -e /etc/debian_version ] && cut -d/ -f1 < /etc/debian_version)
if [ "X${NEWDISTRO}" == "X" ]; then
print_status "Could not determine distribution from /etc/debian_version..."
else
DISTRO=$NEWDISTRO
print_status "Found \"${DISTRO}\" in /etc/debian_version..."
fi
fi
print_status 'Adding the eventOne signing key to your keyring...'
if [ -x /usr/bin/curl ]; then
exec_cmd 'curl -s https://cdn.filiosoft.com/debian/pubkey.gpg | apt-key add -'
else
exec_cmd 'wget -qO- https://cdn.filiosoft.com/debian/pubkey.gpg | apt-key add -'
fi
print_status "Creating apt sources list file for the eventOne repo..."
exec_cmd "echo 'deb [arch=$(dpkg --print-architecture)] https://cdn.filiosoft.com/debian/ ${DIST} main' > /etc/apt/sources.list.d/e1-${DIST}.list"
print_status 'Running `apt-get update` for you...'
exec_cmd 'apt-get update'
print_status "Run \`apt-get install ${FSPKG}\` (as root) to install ${FSPKG}"
}
## Defer setup until we have the complete script
setup
\ No newline at end of file
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