dunglas / vulcain

🔨 Fast and idiomatic client-driven REST APIs.
https://vulcain.rocks
GNU Affero General Public License v3.0
3.51k stars 106 forks source link

Mistagged caddy module? #127

Closed Nayte91 closed 10 months ago

Nayte91 commented 11 months ago

Hello,

I just built and pulled Caddy with Mercure & Vulcain, with your new, ecofriendly technic :

ADD --chmod=500 https://caddyserver.com/api/download?os=linux&arch=${TARGETARCH}&p=github.com/dunglas/mercure/caddy&p=github.com/dunglas/vulcain/caddy /usr/bin/caddy

Then I checked in my container which version of everything I have, but here's my result:

/app # caddy version
v2.7.5 h1:HoysvZkLcN2xJExEepaFHK92Qgs7xAiCFydN5x5Hs6Q=
/app # caddy list-modules
[... List of standard modules ...]
  Standard modules: 106

http.handlers.mercure v0.15.3
http.handlers.vulcain v0.5.0

  Non-standard modules: 2

So I'm wondering, is the module's version mistagged? Do do I don't download the good version of it? Or this link (p=github.com/dunglas/vulcain/caddy) is not good?

dunglas commented 11 months ago

I just checked and the tags are good. I also downloaded a fresh build from the Caddy website and I get the 1.0 version. Can you try to rebuild with docker compose build --no-cache?

Nayte91 commented 11 months ago

Hello Kevin,

I also downloaded a fresh build from the Caddy website and I get the 1.0 version.

Did you try with the ADD --chmod=500 https://caddyserver.com/api/download?os=linux&arch=${TARGETARCH}&p=github.com/dunglas/mercure/caddy&p=github.com/dunglas/vulcain/caddy /usr/bin/caddy that you proposed on your blog post?

I just did a fresh test on a fresh computer with a fresh docker:

Dockerfile

FROM caddy:2-alpine

ARG TARGETARCH

ADD --chmod=500 https://caddyserver.com/api/download?os=linux&arch=$TARGETARCH&p=github.com/dunglas/mercure/caddy&p=github.com/dunglas/vulcain/caddy /usr/bin/caddy

compose.yml

services:
  webserver:
    build:
      context: .
    volumes:
      - webserver_data:/data:rw
      - webserver_config:/config:rw

volumes:
  webserver_data:
  webserver_config:

bash

nayte@fresh:~/Developpement/Vulcain$ docker compose build --no-cache
[+] Building 15.6s (7/7) FINISHED                                docker:default
 => [webserver internal] load .dockerignore                                0.0s
 => => transferring context: 2B                                            0.0s
 => [webserver internal] load build definition from Dockerfile             0.0s
 => => transferring dockerfile: 240B                                       0.0s
 => [webserver internal] load metadata for docker.io/library/caddy:2-alpi  0.7s
 => CACHED [webserver] https://caddyserver.com/api/download?os=linux&arc  14.7s
 => CACHED [webserver 1/2] FROM docker.io/library/caddy:2-alpine@sha256:f  0.0s
 => [webserver 2/2] ADD --chmod=500 https://caddyserver.com/api/download?  0.1s
 => [webserver] exporting to image                                         0.1s
 => => exporting layers                                                    0.1s
 => => writing image sha256:d6eb9838d528260f1c3fbb9b18571e0565a3b96acc86a  0.0s
 => => naming to docker.io/library/vulcain-webserver                       0.0s
nayte@fresh:~/Developpement/Vulcain$ docker compose up -d
[+] Running 2/2
 ✔ Network vulcain_default        Created                                  0.1s 
 ✔ Container vulcain-webserver-1  Start...                                 0.0s 
nayte@fresh:~/Developpement/Vulcain$ docker compose exec webserver caddy version
v2.7.5 h1:HoysvZkLcN2xJExEepaFHK92Qgs7xAiCFydN5x5Hs6Q=
nayte@fresh:~/Developpement/Vulcain$ docker compose exec webserver caddy list-modules --versions|grep vulcain
http.handlers.vulcain v0.5.0

I agree that ultimately the tag is OK:

nayte@fresh:~$ docker run dunglas/vulcain caddy list-modules --versions|grep vulcain
http.handlers.vulcain v1.0.0

So the problem should be from the caddyserver download api?

dunglas commented 11 months ago

The problem is likely the cache (the step is marked as CACHED in the build, so the old binary is reused).

Nayte91 commented 11 months ago

Hello,

In fact, I re-typed my commands after some tests to have them convenient on my console, to copy/paste easily.

But I still have my whole console output right here!

nayte@fresh:~$ cd Developpement/
nayte@fresh:~/Developpement$ mkdir Vulcain
nayte@fresh:~/Developpement$ cd Vulcain/
[... Editing my files on my IDE ...]
nayte@fresh:~/Developpement/Vulcain$ docker compose build --no-cache
[+] Building 9.9s (7/7) FINISHED                                 docker:default
 => [webserver internal] load .dockerignore                                0.0s
 => => transferring context: 2B                                            0.0s
 => [webserver internal] load build definition from Dockerfile             0.0s
 => => transferring dockerfile: 303B                                       0.0s
 => [webserver internal] load metadata for docker.io/library/caddy:2-alpi  1.3s
 => [webserver] https://caddyserver.com/api/download?os=linux&arch=amd64&  8.3s
 => [webserver 1/2] FROM docker.io/library/caddy:2-alpine@sha256:f1c092da  0.8s
 => => resolve docker.io/library/caddy:2-alpine@sha256:f1c092da9fcba7a819  0.0s
 => => sha256:70c3913f54e294079c54cc8b651576b08dd4add42a0 7.80kB / 7.80kB  0.0s
 => => sha256:96526aa774ef0126ad0fe9e9a95764c5fc37f409ab9 3.40MB / 3.40MB  0.2s
 => => sha256:a5433daac73cddf3f03243a31c38d460570073f 350.84kB / 350.84kB  0.3s
 => => sha256:c8c6b4aafe2c09344f58425bb0fe037a429808edb7b 7.51kB / 7.51kB  0.2s
 => => sha256:f1c092da9fcba7a8197cf1065a347d4f0bb67b6dd18 1.43kB / 1.43kB  0.0s
 => => sha256:a9c7585fdc50bb28d686b73a9b1f0eb9a3d103efd63 1.16kB / 1.16kB  0.0s
 => => extracting sha256:96526aa774ef0126ad0fe9e9a95764c5fc37f409ab9e9702  0.1s
 => => sha256:f7a182bff4e1b33f3d5dd80f809e697793466287c 14.71MB / 14.71MB  0.6s
 => => extracting sha256:a5433daac73cddf3f03243a31c38d460570073f83e9a8cf6  0.0s
 => => extracting sha256:c8c6b4aafe2c09344f58425bb0fe037a429808edb7b2ba37  0.0s
 => => extracting sha256:f7a182bff4e1b33f3d5dd80f809e697793466287c3da7704  0.2s
 => [webserver 2/2] ADD --chmod=500 https://caddyserver.com/api/download?  0.1s
 => [webserver] exporting to image                                         0.1s
 => => exporting layers                                                    0.1s
 => => writing image sha256:46df9d148dcdfc8aa987748d56a0dfb4ffe0af7f90504  0.0s
 => => naming to docker.io/library/vulcain-webserver                       0.0s
nayte@fresh:~/Developpement/Vulcain$ docker compose up -d
[+] Running 10/10
 ✔ backend 9 layers [⣿⣿⣿⣿⣿⣿⣿⣿⣿]      0B/0B      Pulled                     7.9s 
   ✔ a378f10b3218 Pull complete                                            1.2s 
   ✔ 20ad076dff2e Pull complete                                            0.3s 
   ✔ 6d17b5cade1b Pull complete                                            3.2s 
   ✔ d71c28a64564 Pull complete                                            0.8s 
   ✔ 7e2b91f61bd2 Pull complete                                            1.7s 
   ✔ 7ea1d02a4a76 Pull complete                                            1.7s 
   ✔ 7d563972609e Pull complete                                            3.2s 
   ✔ 46122efda3ae Pull complete                                            2.1s 
   ✔ ae2c013ea448 Pull complete                                            2.9s 
[+] Running 5/4
 ✔ Network vulcain_default            Created                              0.1s 
 ✔ Volume "vulcain_webserver_config"  Created                              0.0s 
 ✔ Volume "vulcain_webserver_data"    Created                              0.0s 
 ✔ Container vulcain-backend-1        Cre...                               0.2s 
 ✔ Container vulcain-webserver-1      C...                                 0.0s 
jrobic@Latitude-5440:~/Developpement/Vulcain$ docker compose exec webserver sh
/srv # caddy version
v2.7.5 h1:HoysvZkLcN2xJExEepaFHK92Qgs7xAiCFydN5x5Hs6Q=
/srv # caddy list-modules --versions|grep vulcain
http.handlers.vulcain v0.5.0
/srv # exit

My very first try on this computer did this result; So unless you made the same test than me, (or I do a fool mistake somewhere!) I really think there is some cache on the caddy parameter side?

Fneufneu commented 11 months ago

I can confirm with a fresh container, docker build, docker run, docker exec sh, caddy list-modules --versions give me:

...
  Standard modules: 106

http.handlers.mercure v0.15.3
http.handlers.vulcain v0.5.0

  Non-standard modules: 2

  Unknown modules: 0
Nayte91 commented 10 months ago

New test done on a fresh install: http.handlers.mercure v0.15.5 http.handlers.vulcain v1.0.0 Vulcain is now tagged 1.0: I don't know if you changed something or if it is just cache somewhere, but it's now OK. I close this. Thank you for your time!