Skip to content

feat: arm(v7/64) builds for releases and agent scripts - #1337

Merged
bpmct merged 8 commits into
mainfrom
bpmct/armv7
May 11, 2022
Merged

bpmct merged 8 commits into
mainfrom
bpmct/armv7

Conversation

@bpmct

@bpmct bpmct commented May 9, 2022 •

Copy link
Copy Markdown
Member

This PR adds builds armv7 Linux releases. Most notably, this will improve support for Raspberry Pi operating systems

Fixes #1336

benpotter@elijo:~ $ cat /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 3 (v7l)
BogoMIPS	: 108.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

... processors 1, 2, 3

Hardware	: BCM2711
Revision	: c03111
Serial		: 10000000e67636d1
Model		: Raspberry Pi 4 Model B Rev 1.1
benpotter@elijo:~ $ coder --version
Coder v0.5.4-devel+ad8d9dd Fri May  6 20:45:18 UTC 2022
https://github.com/coder/coder/commit/ad8d9dd71a3e3672e78d48058f29bbe5b251bdfb
benpotter@elijo:~ $ 

@bpmct
bpmct requested a review from kylecarbs May 9, 2022 02:56
@bpmct bpmct changed the title feat: build armv7 linux releases (raspberry pi support) feat: build armv7 linux releases (raspberry pi 4 support) May 9, 2022
@bpmct bpmct self-assigned this May 9, 2022
@bpmct bpmct added the ci 🤖 label May 9, 2022
@codecov

codecov Bot commented May 9, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #1337 (01d5b50) into main (ad8d9dd) will increase coverage by 0.56%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1337      +/-   ##
==========================================
+ Coverage   66.44%   67.01%   +0.56%     
==========================================
  Files         284      288       +4     
  Lines       18584    18857     +273     
  Branches      235      241       +6     
==========================================
+ Hits        12349    12637     +288     
+ Misses       4967     4932      -35     
- Partials     1268     1288      +20     
Flag Coverage Δ
unittest-go-macos-latest 54.09% <100.00%> (+0.38%) ⬆️
unittest-go-postgres- 65.47% <100.00%> (+0.34%) ⬆️
unittest-go-ubuntu-latest 56.48% <100.00%> (+0.46%) ⬆️
unittest-go-windows-2022 52.39% <0.00%> (+0.33%) ⬆️
unittest-js 74.24% <ø> (+0.56%) ⬆️
Impacted Files Coverage Δ
provisionersdk/agent.go 100.00% <100.00%> (ø)
site/src/components/TableHeaders/TableHeaders.tsx 91.66% <0.00%> (-8.34%) ⬇️
codersdk/roles.go 72.72% <0.00%> (-7.92%) ⬇️
site/src/components/Table/Table.tsx 96.00% <0.00%> (-4.00%) ⬇️
site/src/components/UsersTable/UsersTable.tsx 96.00% <0.00%> (-4.00%) ⬇️
site/src/xServices/users/usersXService.ts 72.91% <0.00%> (-2.09%) ⬇️
codersdk/users.go 63.79% <0.00%> (-1.39%) ⬇️
site/src/api/index.ts 70.00% <0.00%> (-1.24%) ⬇️
provisionerd/provisionerd.go 76.84% <0.00%> (-0.27%) ⬇️
coderd/database/queries.sql.go 77.90% <0.00%> (-0.25%) ⬇️
... and 57 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad8d9dd...01d5b50. Read the comment docs.

@bpmct

bpmct commented May 9, 2022 •

Copy link
Copy Markdown
Member Author

@kylecarbs I think the Terraform provider has to be updated support arm_7 as an arch as well? Is it as simple as changing the validation rule?

https://github.com/coder/terraform-provider-coder/blob/4531753ebf98fbbd912eec8503c45dde6313a459/internal/provider/provider.go#L162-L167

Oh, and the agent scripts:

"linux": {
"amd64": `#!/usr/bin/env sh
set -eu pipefail
export BINARY_LOCATION=$(mktemp -d -t tmp.coderXXXXX)/coder
curl -fsSL ${ACCESS_URL}bin/coder-linux-amd64 -o $BINARY_LOCATION
chmod +x $BINARY_LOCATION
export CODER_AGENT_AUTH="${AUTH_TYPE}"
export CODER_AGENT_URL="${ACCESS_URL}"
exec $BINARY_LOCATION agent`,
},

I also noticed that the binary isn't being uploaded to [coder-url]/bin/coder-arm_7. In fact, none of the arm builds are. Any ideas?

Screen Shot 2022-05-08 at 10 21 08 PM

Edit: I think it has to do with the coder slim build only building amd64 binaries. I'll test in the morning

coder/.goreleaser.yaml

Lines 29 to 39 in ad8d9dd

- id: coder-slim
dir: cmd/coder
ldflags:
["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
env: [CGO_ENABLED=0]
goos: [darwin, linux, windows]
goarch: [amd64]
hooks:
# The "trimprefix" appends ".exe" on Windows.
post: |
cp {{.Path}} site/out/bin/coder-{{ .Os }}-{{ .Arch }}{{ trimprefix .Name "coder" }}

@kylecarbs

kylecarbs commented May 9, 2022 •

Copy link
Copy Markdown
Member

@bpmct

bpmct commented May 10, 2022

Copy link
Copy Markdown
Member Author

still need to a bit of work to expose the agent start script

@bpmct
bpmct requested a review from kylecarbs May 10, 2022 22:38
@bpmct
bpmct marked this pull request as draft May 10, 2022 22:39
Comment thread .goreleaser.yaml Resolved
Comment thread provisionersdk/agent.go Resolved
@bpmct

bpmct commented May 10, 2022 •

Copy link
Copy Markdown
Member Author

Testing with my raspberry pi now :)

Edit: Running into an issue parsing templates

Edit 2: got this working!

@bpmct
bpmct marked this pull request as ready for review May 11, 2022 01:06
@im-coder-lg

Copy link
Copy Markdown
Contributor

So, just a few doubts - but I will test this.

  1. Does this have compatible Docker images?
  2. Will this work on arm64 now that we got scripts in the build?
  3. -Most Important- how much time does it take to build Coder freshly?

@bpmct

bpmct commented May 11, 2022

Copy link
Copy Markdown
Member Author

So, just a few doubts - but I will test this.

  1. Does this have compatible Docker images?
  2. Will this work on arm64 now that we got scripts in the build?
  3. -Most Important- how much time does it take to build Coder freshly?

All great questions.

  1. You need to specify armv7 compatible images in the template. I'll write a guide on how to do this. Sadly armv7:ubuntu won't work because it doesn't contain curl
  2. Yes
  3. Not long (~3 minutes), but these changes mean a build is provided (.deb, .apk, or binary) for each release

@im-coder-lg

Copy link
Copy Markdown
Contributor

Thanks for the answers, I will start my build now.

@im-coder-lg

Copy link
Copy Markdown
Contributor

You need to specify armv7 compatible images in the template. I'll write a guide on how to do this.

I know how to modify the main.tf if that's what you mean. What I will have to do(i hope it's right) is go to Docker Hub and find an ARM64(my pi is 64-bit ARM) image. Then, I should add that image name to its respective section in the main.tf file. Then I should create a workspace. Am I right on this?
P.S. my pi is arm64, so (don't wanna sound rude, it happens with me) I think it could be better if you refer to this as arm. Just arm if it's fine with you.

@bpmct

bpmct commented May 11, 2022

Copy link
Copy Markdown
Member Author

I know how to modify the main.tf if that's what you mean. What I will have to do(i hope it's right) is go to Docker Hub and find an ARM64(my pi is 64-bit ARM) image. Then, I should add that image name to its respective section in the main.tf file. > Then I should create a workspace. Am I right on this?

Correct. That image needs to have curl in it. You also need to change the coder_agent arch to use arm64.

P.S. my pi is arm64, so (don't wanna sound rude, it happens with me) I think it could be better if you refer to this as arm. > Just arm if it's fine with you.

Yeah, I initially submitted this to add support for armv7 but it grew in scope when I realized the arm64 scripts weren't being added

@bpmct bpmct changed the title feat: build armv7 linux releases (raspberry pi 4 support) feat: arm(v7/64) builds for releases and agent scripts May 11, 2022
Comment thread .goreleaser.yaml
# The "trimprefix" appends ".exe" on Windows.
post: |
cp {{.Path}} site/out/bin/coder-{{ .Os }}-{{ .Arch }}{{ trimprefix .Name "coder" }}
cp {{.Path}} site/out/bin/coder-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ trimprefix .Name "coder" }}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@im-coder-lg

Copy link
Copy Markdown
Contributor

Umm.... We got a situation here. I am encountering this:
run parse: recv parse source: manager closed: EOF

Any solutions? My Pi's Neofetch if it helps:

     _,met$$$$$gg.          pi@geniuspi 
    ,g$$$$$$$$$$$$$$$P.       ----------- 
  ,g$$P"     """Y$$.".        OS: Debian GNU/Linux 11 (bullseye) aarch64 
 ,$$P'              `$$$.     Host: Raspberry Pi 4 Model B Rev 1.4 
',$$P       ,ggs.     `$$b:   Kernel: 5.15.32-v8+ 
`d$$'     ,$P"'   .    $$$    Uptime: 15 mins 
 $$P      d$'     ,    $$P    Packages: 2074 (dpkg) 
 $$:      $$.   -    ,d$$'    Shell: bash 5.1.4 
 $$;      Y$b._   _,d$P'      Resolution: 1920x1080 
 Y$$.    `.`"Y$$$$P"'         DE: Plasma 5.20.5 
 `$$b      "-.__              WM: KWin 
  `Y$$                        WM Theme: ChromeOS-light 
   `Y$$.                      Theme: Breeze [Plasma], Breeze [GTK2/3] 
     `$$b.                    Icons: Tela-circle [Plasma], Tela-circle [GTK2/3] 
       `Y$$b.                 Terminal: konsole 
          `"Y$b._             CPU: BCM2835 (4) @ 1.800GHz 
              `"""            Memory: 762MiB / 7812MiB 

                                                      
                                                     

@bpmct

bpmct commented May 11, 2022

Copy link
Copy Markdown
Member Author

Umm.... We got a situation here. I am encountering this:
run parse: recv parse source: manager closed: EOF

Any solutions? My Pi's Neofetch if it helps:

Apologies! This is a known issue and a bug in the upstream Terraform library. Installing Terraform on your Pi will fix this as a workaround.

@im-coder-lg

im-coder-lg commented May 11, 2022 via email

Copy link
Copy Markdown
Contributor

@kylecarbs kylecarbs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome!

@bpmct
bpmct merged commit f581724 into main May 11, 2022
@bpmct
bpmct deleted the bpmct/armv7 branch May 11, 2022 14:44
@im-coder-lg

Copy link
Copy Markdown
Contributor

I know this is merged and all that, but @bpmct did it work properly for you? I inserted custom images that use Ubuntu ARM, two from Canonical's kinda proxies ARMv8 provider(that's arm64, if I am not wrong) and one from a person or org named osrf. All of them failed, so are there any working images that use ARM64?

@bpmct

bpmct commented May 11, 2022

Copy link
Copy Markdown
Member Author

@im-coder-lg can we discuss this in your issue or in Discord?

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.

Feat: linux armv7 builds (raspberry pi)

4 participants