ulrichSchreiner / caddy-http

3 stars 1 forks source link

How to build? #1

Closed pepa65 closed 7 years ago

pepa65 commented 7 years ago

I tried sudo docker build . and get as response:

Sending build context to Docker daemon 109.6 kB
Step 1 : FROM github.com/ulrichschreiner/caddy-builder:0.10.9 as builder
Error parsing reference: "github.com/ulrichschreiner/caddy-builder:0.10.9 as builder" is not a valid repository/tag
ulrichSchreiner commented 7 years ago

Which Dockerfile do you use? The one in this repo does not contain this FROM-line ...

pepa65 commented 7 years ago

Sorry, I was trying something. The proper output I get is:

Sending build context to Docker daemon 203.3 kB
Step 1 : FROM ulrichschreiner/caddy-builder:0.10.9 as builder
Error parsing reference: "ulrichschreiner/caddy-builder:0.10.9 as builder" is not a valid repository/tag
ulrichSchreiner commented 7 years ago

You need a current docker with support for multistage builds. Which docker version do you use?

Am Sa., 23. Sep. 2017, 19:22 schrieb PePa notifications@github.com:

Sorry, I was trying something. The proper output I get is:

Sending build context to Docker daemon 203.3 kB Step 1 : FROM ulrichschreiner/caddy-builder:0.10.9 as builder Error parsing reference: "ulrichschreiner/caddy-builder:0.10.9 as builder" is not a valid repository/tag

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/ulrichSchreiner/caddy-http/issues/1#issuecomment-331654369, or mute the thread https://github.com/notifications/unsubscribe-auth/ABkRxzrBjrY6FBsGp4YkI2_mVg9h5e8yks5slT4_gaJpZM4Phmna .

pepa65 commented 7 years ago

I need a newer docker? I had 1.12.6-0ubuntu1~16.04.1.

OK, had installed the old package. I now have 17.05.0~ce-0~ubuntu-xenial. Output now:

Sending build context to Docker daemon  200.2kB
Error response from daemon: mkdir /var/lib/docker/tmp/docker-builder494391548: no such file or directory

I did sudo mkdir -p /var/lib/docker/tmp and it looks like I'm in business!

ulrichSchreiner commented 7 years ago

Sorry thats much too old.

you need at last 17.05. Please consult the docker homepage how to install a current one (17.06 is the current stable, 17.09 is forthcoming.

pepa65 commented 7 years ago

By the way, I've made this script to populate plugins.go with the proper (I hope) repo's for all the plugins:

#!/bin/sh
wget -q caddyserver.com/api/download-page
echo -e "package caddymain\n\nimport (" >plugins.go
sed 's@{@\n{@g' download-page |grep -o ImportPath.* |cut -d '"' -f3 |sed 's@^.*$@//\t_ "\0"@' >>plugins.go
echo "}" >>plugins.go
rm download-page
pepa65 commented 7 years ago

This is what I end up with now:

Sending build context to Docker daemon  110.6kB
Step 1/3 : FROM ulrichschreiner/caddy-builder:0.10.9 as builder
# Executing 2 build triggers...
Step 1/1 : COPY plugins.go /go/src/github.com/mholt/caddy/caddy/caddymain/plugins.go
 ---> Using cache
Step 1/1 : RUN cd github.com/mholt/caddy/caddy     && go get -u ./...     && git checkout -q ${CADDY_VERSION}     && go run build.go goos=linux
 ---> Running in 05caf6aa1490
failed to update store for object type *libnetwork.endpointCnt: Key not found in store

(I had to do mkdir -p various times to get things to go further...)

ulrichSchreiner commented 7 years ago

hi,

sorry, but it works on my side. i used your scrip to generate a plugins.go file with this content:

package caddymain

import (
        _ "github.com/hacdias/filemanager/caddy/hugo"
        _ "blitznote.com/src/caddy.upload"
        _ "github.com/caddyserver/dnsproviders/cloudflare"
        _ "github.com/miquella/caddy-awses"
        _ "github.com/hacdias/filemanager/caddy/jekyll"
        _ "github.com/SchumacherFM/mailout"
        _ "github.com/hacdias/caddy-webdav"
        _ "github.com/hacdias/caddy-minify"
        _ "github.com/epicagency/caddy-expires"
        _ "github.com/restic/caddy"
        _ "github.com/captncraig/caddy-realip"
        _ "github.com/coredns/coredns/core"
        _ "github.com/payintech/caddy-datadog"
        _ "github.com/caddyserver/dnsproviders/exoscale"
        _ "github.com/caddyserver/dnsproviders/gandi"
        _ "github.com/caddyserver/dnsproviders/googlecloud"
        _ "github.com/caddyserver/dnsproviders/dnsimple"
        _ "github.com/caddyserver/dnsproviders/route53"
        _ "github.com/captncraig/cors/caddy"
        _ "github.com/caddyserver/dnsproviders/linode"
        _ "github.com/pieterlouw/caddy-net/caddynet"
        _ "github.com/caddyserver/dnsproviders/namecheap"
        _ "github.com/caddyserver/dnsproviders/vultr"
        _ "github.com/Xumeiquer/nobots"
        _ "github.com/caddyserver/dnsproviders/dnspod"
        _ "github.com/coopernurse/caddy-awslambda"
        // _ "github.com/caddyserver/dnsproviders/rfc2136"
        _ "github.com/abiosoft/caddy-git"
        _ "github.com/casbin/caddy-authz"
        _ "github.com/tarent/loginsrv/caddy"
        _ "github.com/jung-kurt/caddy-cgi"
        _ "github.com/caddyserver/dnsproviders/digitalocean"
        _ "github.com/zikes/gopkg"
        _ "github.com/caddyserver/dnsproviders/dyn"
        _ "github.com/BTBurke/caddy-jwt"
        _ "github.com/echocat/caddy-filter"
        _ "github.com/mastercactapus/caddy-proxyprotocol"
        _ "github.com/xuqingfeng/caddy-rate-limit"
        _ "github.com/nicolasazrak/caddy-cache"
        _ "github.com/miekg/caddy-prometheus"
        _ "github.com/caddyserver/dnsproviders/rackspace"
        _ "github.com/bruhs/caddy-service"
        _ "github.com/pyed/ipfilter"
        _ "github.com/pieterlouw/caddy-grpc"
        _ "github.com/caddyserver/dnsproviders/ovh"
        _ "github.com/freman/caddy-reauth"
        _ "github.com/hacdias/filemanager/caddy/filemanager"
        _ "github.com/caddyserver/forwardproxy"
)

As you can see i commented out the dnsproviders/rfc2136 because of this issue, it does not compile at the moment.

If you clone this repo, edit the plugins.go to the upper content and build it with a not-too-old docker, you get a working container:

➜  caddy-http git:(master *=) ✗ docker version
Client:
 Version:      17.07.0-ce
 API version:  1.31
 Go version:   go1.8.3
 Git commit:   8784753
 Built:        Tue Aug 29 17:43:00 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.07.0-ce
 API version:  1.31 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   8784753
 Built:        Tue Aug 29 17:41:51 2017
 OS/Arch:      linux/amd64
 Experimental: false

➜  caddy-http git:(master *=) ✗ git remote -v
origin  git@github.com:ulrichSchreiner/caddy-http.git (fetch)
origin  git@github.com:ulrichSchreiner/caddy-http.git (push)

➜  caddy-http git:(master *=) ✗ git status -s
 M plugins.go

➜  caddy-http git:(master *=) ✗ docker build .
Sending build context to Docker daemon  118.8kB
Step 1/3 : FROM ulrichschreiner/caddy-builder:0.10.9 as builder
# Executing 2 build triggers...
Step 1/1 : COPY plugins.go /go/src/github.com/mholt/caddy/caddy/caddymain/plugins.go
Step 1/1 : RUN cd github.com/mholt/caddy/caddy     && go get -u ./...     && git checkout -q ${CADDY_VERSION}     && go run build.go goos=linux
 ---> Running in 5de6ad6bb1bb
 ---> 0589ed525700
Removing intermediate container 5de6ad6bb1bb
Step 2/3 : FROM ulrichschreiner/caddy-runtime:latest
# Executing 2 build triggers...
Step 1/1 : COPY --from=builder /go/src/github.com/mholt/caddy/caddy/caddy /usr/bin/
Step 1/1 : RUN setcap cap_net_bind_service=+ep /usr/bin/caddy
 ---> Running in 1b729a8c2fe6
 ---> ae7c614294c6
Removing intermediate container 1b729a8c2fe6
Step 3/3 : USER caddy
 ---> Running in 19915f1c84b6
 ---> d7b6a47ad154
Removing intermediate container 19915f1c84b6
Successfully built d7b6a47ad154

➜  caddy-http git:(master *=) ✗ docker run -it --rm d7b6a47ad154 -plugins
Server types:
  net
  http
  dns

Caddyfile loaders:
  short
  flag
  default

Event hook plugins:
  hook.service

Other plugins:
  dns.auto
  dns.autopath
  dns.bind
  dns.cache
  dns.chaos
  dns.debug
  dns.dnssec
  dns.dnstap
  dns.erratic
  dns.errors
  dns.etcd
  dns.federation
  dns.file
  dns.health
  dns.hosts
  dns.kubernetes
  dns.loadbalance
  dns.log
  dns.pprof
  dns.prometheus
  dns.proxy
  dns.reverse
  dns.rewrite
  dns.root
  dns.secondary
  dns.tls
  dns.trace
  dns.whoami
  http.authz
  http.awses
  http.awslambda
  http.basicauth
  http.bind
  http.browse
  http.cache
  http.cgi
  http.cors
  http.datadog
  http.errors
  http.expires
  http.expvar
  http.ext
  http.fastcgi
  http.filemanager
  http.filter
  http.forwardproxy
  http.git
  http.gopkg
  http.grpc
  http.gzip
  http.header
  http.hugo
  http.index
  http.internal
  http.ipfilter
  http.jekyll
  http.jwt
  http.limits
  http.log
  http.login
  http.mailout
  http.markdown
  http.mime
  http.minify
  http.nobots
  http.pprof
  http.prometheus
  http.proxy
  http.proxyprotocol
  http.push
  http.ratelimit
  http.realip
  http.reauth
  http.redir
  http.request_id
  http.restic
  http.rewrite
  http.root
  http.status
  http.templates
  http.timeouts
  http.upload
  http.webdav
  http.websocket
  net.host
  shutdown
  startup
  tls
  tls.dns.cloudflare
  tls.dns.digitalocean
  tls.dns.dnsimple
  tls.dns.dnspod
  tls.dns.dyn
  tls.dns.exoscale
  tls.dns.gandi
  tls.dns.googlecloud
  tls.dns.linode
  tls.dns.namecheap
  tls.dns.ovh
  tls.dns.rackspace
  tls.dns.route53
  tls.dns.vultr
  tls.storage.file

But please be aware, that the plugins are go get'ed from the master branch, so there is always the risk that one of them won't compile.

I do not understand where you do mkdir -p. In the Dockerfile or in your local shell in the cloned repo?

You only need to clone this repo, edit the plugins.go and do a docker build ..

ulrichSchreiner commented 7 years ago

This one

I did sudo mkdir -p /var/lib/docker/tmp and it looks like I'm in business!

looks like your docker installation is corrupt. This should never be needed!

If it is possible, purge your docker installation by (hope this commands are correct for ubuntu 16.04):

sudo service docker stop
sudo rm -rf /var/lib/docker
sudo service docker start

After this a docker ps should show nothing and no error too!

Be aware that after this all of your containers/images are gone! I'm also not sure if this works with 16.04; this should work, but i only can guess. Try it at your own risk!

pepa65 commented 7 years ago

Thanks for all your help. I decided to first properly install go (NOT from the Ubuntu repos) and then just build that. Works OK now.

I tried sudo systemctl stop docker.service but when I then do sudo rm -rf /var/lib/docker it doesn't allow it:

rm: cannot remove '/var/lib/docker/btrfs/subvolumes/0b1e285ea5914216dfdf020fd619a294957c5657006d335ebd38120b979b55dc': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/08be397768749007e3f0b49e567daa991d4c4e4e225a40a149a7d2bb5f44f9b7': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/24dc8177c1159e32843201a16d1e13de34d35ce25debe950f81e8d6d16823534': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/dfdb4d08735cf95e1b2616b00a8d23044ce2aea7564d801ea9b94cde0f3c843f': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/bb1e378bc5acdb3731b4b080b7d2b985f3f93a01d7db8e227823c80f300f50ee': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/4a8651aa73e8816cdeec9a7f661c2d12c29fba6aa31fc1993975afee5ff4c710': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/de45877a9179397ca9a4b9838b3cda3bf7606dcde0e1c530518b6e85a57e965d': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/9059b199bee1d9d759f4b00644112318981dec6bd7e6626f8f0f56e1b059dfcc': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/7cb3f427b85fc6bbd4022342ab7acc66c8ddbf34aa944c870f0e4254aee37e73-init': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/7cb3f427b85fc6bbd4022342ab7acc66c8ddbf34aa944c870f0e4254aee37e73': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/5c4468aab537ddb9af9978f2064fe4c85cafeb828fcbd6960cf8a6973d0f1746': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/9a97ba80f3ad427c4cb28a02f62b9b7601811a813277ebc7026298ece306c3d7-init': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/9a97ba80f3ad427c4cb28a02f62b9b7601811a813277ebc7026298ece306c3d7': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/8b2c2788f68aa7eefcecdb2d71253984b6554fdc8548bdd1449de5c176575541-init': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/8b2c2788f68aa7eefcecdb2d71253984b6554fdc8548bdd1449de5c176575541': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/a4f06a4d32384ac16863832f5eb24ea8d4cc86147183e4118ed7f39b6218490b-init': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/a4f06a4d32384ac16863832f5eb24ea8d4cc86147183e4118ed7f39b6218490b': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/7f6c559d38e270ce8bd0bb945ef4081a0b7cfa17c025b9401bb0c0d1ec46246e-init': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/7f6c559d38e270ce8bd0bb945ef4081a0b7cfa17c025b9401bb0c0d1ec46246e': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/49c397bf1f0c746bae3fdd9405483aa736c03fdf25e41fb3b9fa62602d496dcb-init': Operation not permitted
rm: cannot remove '/var/lib/docker/btrfs/subvolumes/49c397bf1f0c746bae3fdd9405483aa736c03fdf25e41fb3b9fa62602d496dcb': Operation not permitted

So I just uninstalled docker. But I still can't remove /var/lib/docker..! This is irritating.

ulrichSchreiner commented 7 years ago

looks like your docker installation uses btrfs as the volume driver. a really bad decision. i'd try to use overlay2, it is much better and easier to manage. for local devlopment aufs is also great.

perhaps this one could help?

i'll close this issue. i'm sure this is a problem with your local docker installation.

pepa65 commented 7 years ago

Thanks, the btrfs command worked.