How does one install Pebble?

In recent releases, Go deprecated and then EOL'd the go get installation method, as used in the Pebble docs. Pebble now lacks functional installation instructions.

I have limited experience with Go and can't figure out a way to correctly install Pebble from the Github repo. All my online searches either return the old methods, or new ways to install official releases. Does anyone here know how to install the active github repo?

5 Likes

I just use go install ./...

It then puts the two binaries in ~/go/bin/.

The following is just for devving on Certbot:

I then in certbot-ci/certbot_integration_tests/utils/pebble_artifacts.py I change:

asset_path = os.path.join(ASSETS_PATH, '{0}_{1}_{2}'.format(asset, PEBBLE_VERSION, suffix))

To:

asset_path = f"/home/osiris/go/bin/{asset}"

Works nicely for me :slight_smile:

Also interesting might be the following script I use when I'm doing a little bit more tinkering on Pebble. I just run the following once at the beginning of a dev-session:

export GOPATH=/home/osiris/pebble/
alias buildpebble='go install -v -ldflags "-X main.BranchName=$(git branch --show-current) -X main.CommitHash=$(git log -1 --pretty=format:%h)" ./...'
echo "You can now run 'buildpebble' from within the Pebble Git repository."

And then I run buildpebble from the Pebble git repo. The location is different in that case due to the different GOPATH variable.

The reason I did the above is because I wanted to show which commit Iw as running when devving. This is accomplished in the Pebble code by:

diff --git a/cmd/pebble/main.go b/cmd/pebble/main.go
index f281df2..ee29d76 100644
--- a/cmd/pebble/main.go
+++ b/cmd/pebble/main.go
@@ -31,6 +31,12 @@ type config struct {
        }
 }
 
+// build flags
+var (
+       CommitHash string
+       BranchName string
+)
+
 func main() {
        configFile := flag.String(
                "config",
@@ -52,7 +58,7 @@ func main() {
 
        // Log to stdout
        logger := log.New(os.Stdout, "Pebble ", log.LstdFlags)
-       logger.Printf("Starting Pebble ACME server")
+       logger.Printf("Starting Pebble ACME server (Osiris Inferis Fork: %s, %s)", BranchName, CommitHash)
 
        var c config
        err := cmd.ReadConfigFile(*configFile, &c)

Also, welcome to the club of people with limited experience with Go.. In my case, VERY limited experience (just Pebble to be honest..).. My advice? Don't try to learn Go, I hate it already. Just stick with Python :rofl: Much more intuitive.

3 Likes

Sorry, I should have clarified... this is for CI systems, not local development. I can't download/install without a huge effort in retooling everything.

After wasting a few hours, this seems like it might be a candidate:

go install github.com/letsencrypt/pebble/cmd/pebble@HEAD

I need to do some further testing to see if this is installing in predictable ways

3 Likes

Shouldn't you be using github.com/letsencrypt/pebble/...@HEAD?

2 Likes

That was the first thing I tried. Go did not like that.

2 Likes

Hm, weird, works like a charm here:

osiris@erazer pebble $ go install github.com/letsencrypt/pebble/...@HEAD
go: downloading github.com/letsencrypt/challtestsrv v1.2.1
go: downloading golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
go: downloading golang.org/x/net v0.0.0-20211020060615-d418f374d309
go: downloading golang.org/x/sys v0.0.0-20211020174200-9d6173849985
osiris@erazer pebble $ ls -l ~/go/bin/
total 30272
-rwxr-xr-x 1 osiris osiris 13372691 May  3 17:59 dive
-rwxr-xr-x 1 osiris osiris  9374798 Jun  7 18:55 pebble
-rwxr-xr-x 1 osiris osiris  8229224 Jun  7 18:55 pebble-challtestsrv
osiris@erazer pebble $ cd /tmp/
osiris@erazer tmp $ go install github.com/letsencrypt/pebble/...@HEAD
osiris@erazer tmp $  

No complaints when changing to a different directory. But also nothing to do.. :stuck_out_tongue: Not sure where Go leaves the original packages tho..

Is pebble-challtestsrv an absolute requirement?

2 Likes

For CI, I just use git to shallow clone the repository,

That said, I also use docker to run pebble in CI. Could probably modify it to run pebble from the git repo, but in the past it has been easier to use docker across windows/mac/linux.

5 Likes

Thanks! I may switch to Docker and correlate the ports we use for testing to the docker image. I've finally got this running on Github Actions, but had to rewrite a bunch of stuff to make the config and default certs accessible.

This was not a fun day.

6 Likes

No, thank you for the reminder! I’ve been meaning to switch over to GitHub actions, so will definitely be checking that out to see what’s involved. Might see if it’s easier to use podman, too.

2 Likes

@eggsampler GitHub actions are great. I like them a lot more than Travis.

The only issue I had was on modifying /etc/hosts. I don't know why, but the only thing that worked was (line 34):

sudo cat tests/test_configuration/hosts.txt | sudo tee -a /etc/hosts

I tried at least a dozen more familiar ways to modify it, and eventually found the cat/tee combination in another repo.

4 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.