Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to specify Caddy version when building it from source with plugins #2573

Closed
ghost opened this issue Apr 20, 2019 · 14 comments
Closed

How to specify Caddy version when building it from source with plugins #2573

ghost opened this issue Apr 20, 2019 · 14 comments
Labels
question ❔ Help is being requested

Comments

@ghost
Copy link

ghost commented Apr 20, 2019

I followed the instructions from the README today to build Caddy from source with plugins, but when I ran go build, Go pulled the source code from the latest release tag (v0.11.5) instead of the most recent pre-release tag (v1.0.0-beta1).

Is it possible to specify either a pre-release tag or a specific commit when building Caddy from source with plugins?

@mholt Your input would be appreciated.

@mholt
Copy link
Member

mholt commented Apr 20, 2019

Yes, see the README for instructions on how to build from source at a specific release, see also the Go module documentation and the discussion in #2560.

@mholt mholt closed this as completed Apr 20, 2019
@mholt mholt added the question ❔ Help is being requested label Apr 20, 2019
@ghost
Copy link
Author

ghost commented Apr 20, 2019

@mholt Thanks, I figured it out now.

@mholt
Copy link
Member

mholt commented Apr 20, 2019

@WhaleHub What was your solution?

@ghost
Copy link
Author

ghost commented Apr 20, 2019

@mholt When I ran build.go, Go automatically populated the go.mod file with the required dependencies. Among them was github.com/mholt/caddy with the version tag v0.11.5. After consulting Go's documentation, I found out that you can specify a prerelease tag or a commit for a required dependency by replacing the versioned tag with the respective prerelease tag or the commit's hash (e.g. 917d9bc). Go will automatically convert the latter into a so-called pseudo-version (e.g. v1.0.0-beta1.0.20190420181127-917d9bc9daf9) when you run go build again.

I was able to build Caddy from the latest commit with plugins this way without a problem.

root@debian:~/.caddy/build# ./caddy -version
Caddy v1.0.0-beta1.0.20190420181127-917d9bc9daf9 (h1:Qy+MKd5e5M3p2x21Bm/wxzpTR7T4tE/xq/n9AV3nM88=)

@mholt
Copy link
Member

mholt commented Apr 20, 2019

Thanks. But, we just removed build.go... it is no longer needed.

@ghost
Copy link
Author

ghost commented Apr 20, 2019

@mholt That was a typo. I meant to say "When I ran go build [...]".

@mholt
Copy link
Member

mholt commented Apr 20, 2019

Are the instructions in our readme wrong then? We specifically mention a beta version because Go modules ignores prereleases otherwise.

@ghost
Copy link
Author

ghost commented Apr 20, 2019

@mholt As far as I can tell, the instructions for building Caddy without plugins are correct. It's the instructions for building it with plugins that require an overhaul. If you want, I can type something up to fix them.

@mholt
Copy link
Member

mholt commented Apr 20, 2019

What needs to be changed? They worked for me last night.

@elcore
Copy link
Collaborator

elcore commented Apr 20, 2019

What needs to be changed? They worked for me last night.

Run go get github.com/mholt/[email protected] before go build. This will not be necessary after the release of the v1.0.0 version tag

Edit:

This should be the content of go.mod:

module caddy

go 1.12

require github.com/mholt/caddy v1.0.0-beta2

@elcore
Copy link
Collaborator

elcore commented Apr 20, 2019

Furthermore, I propose another change.

go mod init mycaddy (the name doesn't really matter).

This is not really true, the module name equals the name of the binary i.e if it is called mycaddy the binary will be called mycaddy

@mholt
Copy link
Member

mholt commented Apr 20, 2019

🤔 Huh, I thought the name of the binary was based on the folder name.

@mholt
Copy link
Member

mholt commented Apr 20, 2019

But yes, a lot of pain will go away after a stable release. It's a chicken-and-egg problem. At this point I'll be tagging 1.0 just hoping it works. 😬

@elcore
Copy link
Collaborator

elcore commented Apr 20, 2019

🤔 Huh, I thought the name of the binary was based on the folder name.

Not for me... Can anyone confirm this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question ❔ Help is being requested
Projects
None yet
Development

No branches or pull requests

2 participants