Skip to content

clean site/out and enforce make bin #2604

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

Merged
merged 1 commit into from
Jun 23, 2022
Merged

clean site/out and enforce make bin #2604

merged 1 commit into from
Jun 23, 2022

Conversation

johnstcn
Copy link
Member

@johnstcn johnstcn commented Jun 23, 2022

I got a panic this morning when running v2:

<i> [webpack-dev-server] On Your Network (IPv4): http://192.168.1.74:8080/
<i> [webpack-dev-server] On Your Network (IPv6): http://[fe80::1]:8080/
<i> [webpack-dev-server] Content not from webpack is served from './static' directory
<i> [webpack-dev-server] 404s will fallback to '/index.html'
Coder v0.0.0-devel - Remote development on your infrastucture
Opening tunnel so workspaces can connect to your deployment
View the Web UI: https://fcca3a71-871a-4663-a779-3f5795851b8c.wg-tunnel.coder.app/
panic: read site bin failed: verify coder binaries sha1 failed: read coder sha1 from embedded fs failed: open bin/coder.sha1: file does not exist

goroutine 1 [running]:
github.com/coder/coder/coderd.New(0x140006e4180)
        /Users/cian/src/cdr/coder/coderd/coderd.go:91 +0x708
github.com/coder/coder/cli.server.func1(0x1400083cf00, {0x1053c9ca0?, 0x4?, 0x4?})
        /Users/cian/src/cdr/coder/cli/server.go:338 +0x2c74
github.com/spf13/cobra.(*Command).execute(0x1400083cf00, {0x140008364c0, 0x4, 0x4})
        /Users/cian/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:856 +0x4c4
github.com/spf13/cobra.(*Command).ExecuteC(0x14000830500)
        /Users/cian/go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x354
main.main()
        /Users/cian/src/cdr/coder/cmd/coder/main.go:18 +0xa8
exit status 2

@mafredri and I investigated and it looks like I had a dirty site/out/bin folder that was missing the shasums.
We should probably be clearing this out in between builds.

Also, the warning about make bin seems to be routinely ignored, so enforcing it.
I'm also open to just automatically running make bin if folks find the enforcement too aggressive.

Future work: serve current binary as agent if running via develop.sh.

@johnstcn johnstcn requested a review from a team June 23, 2022 11:22
@johnstcn johnstcn self-assigned this Jun 23, 2022
@johnstcn johnstcn requested a review from a team June 23, 2022 11:22
./scripts/build_go_slim.sh \
--compress 6 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this line do/why do we need it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From build_go_slim.sh: it compresses the coder-slim binaries.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try to answer this @jsjoeio.

This is the PR that added the feature #2533, the motivation is to significantly reduce the size of "fat" binaries. We use level 6 for dev builds since it's very fast, 22 for prod builds which shaves an additional 20+MB. (You can see the effect on the releases page, comparing v0.7.3 binaries vs v0.7.4 😄)

I guess it's not strictly necessary to compress for make bin, though. Personally I think it's nice if they're prepared in case one does go build -tags embed during development, and it's closer to what we'd do with production builds too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! I agree, getting development and production builds to be as similar as possible seems like a good thing to aim for. Thank you both for explaining! Appreciate it 🙌🏼

@johnstcn johnstcn merged commit ac557e0 into main Jun 23, 2022
@johnstcn johnstcn deleted the cj/develop-make-bin branch June 23, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants