boundary icon indicating copy to clipboard operation
boundary copied to clipboard

Dev getting started docs for common dev platforms

Open rileytg opened this issue 3 years ago • 13 comments

disclaimers:

  • im on a mac
  • im on a m1 mac
  • i was actively developing with go but have taken 2-4 years off day to day go– i may be just outta tune with the "go way"

Is your feature request related to a problem? Please describe. current makefile has ~/.go/bin/go test which assumes my go is installed there...

the official golang.org instructions puts the go bin at /usr/local/go/bin/go. i have also used brew for go in the past which puts it somewhere else (where... i don't remember).

my guess is the main team on this repo uses a tool im not familiar with that installs go at ~/.go/bin/go. that makes me think ya'll have a tool with rbenv vibes... i'd be very into that. the go ecosystem in the past has forced me to use the whole GOPATH thing and that doesn't really fit my normal ~/code/... project structure.

something as simple as a list of tools/setup tips from the core team would be gr8.

Describe the solution you'd like md docs on how to get dev setup running for generic mac and linux. (personally i would love m1 mac specific section but thats a "me problem"...)

Describe alternatives you've considered installing/symlinking go at/to ~/.go/bin/go.

Explain any additional use-cases n/a

Additional context

  • i tried to follow this repo's aws instructions on building a boundary binary: https://github.com/hashicorp/boundary-reference-architecture/tree/main/deployment/aws#deploy
    • i had to install gox using google fu and stackoverflow trolling (could very well be my fault on this one...)
    • UI step kept failing:
➜  boundary git:(main) XC_OSARCH=linux/amd64 make dev
==> UI assets found, use build-ui target to update
==> Building Boundary with dev and UI features enabled
==> Removing old directory...
==> Building...
Number of parallel builds: 7

-->     linux/amd64: github.com/hashicorp/boundary/cmd/boundary

1 errors occurred:
--> linux/amd64 error: exit status 1
Stderr: internal/ui/assets.go:15:12: pattern .tmp/boundary-ui/ui/admin/dist: no matching files found

make: *** [dev] Error 1

my goal with this issue is to dialog with core team and other looky-loo-would-be-contribs to enhance existing code contrib/dev guides.

rileytg avatar Jul 17 '21 05:07 rileytg

We don't assume Go is installed at any specific location -- the test-ci target -- which is a newer duplicate of the test target and the latter should be removed -- makes an assumption because the install-go target directly before that installs Go at that location. It's designed for the specific CI environment that runs that target.

Outside of that it should work normally with a normal Go install when using e.g. make dev. It seems like the UI build step failed for you partway through so you may want to remove internal/ui/.tmp and try again. Also make sure you don't have e.g. GOROOT set. I'm also not super sure why you're cross-compiling -- maybe you aren't intending to run it on your Mac?

jefferai avatar Aug 07 '21 20:08 jefferai

Ah that makes sense… i have GOROOT set and i’ll try out removing the ui tmp. And yes i was building binary for deployment using terraform. I was following the aws tf tutorial.

rileytg avatar Aug 09 '21 05:08 rileytg

https://www.boundaryproject.io/docs/developing/building

rileytg avatar Aug 13 '21 15:08 rileytg

I'm trying to get started with Boundary development on a Apple M1 laptop and make dev doesn't seem to be finishing correctly:

~/Projects/hashicorp/boundary main*
❯ make dev
==> UI assets found, use build-ui target to update
==> Building Boundary with dev and UI features enabled
==> Building Host Plugins...
==> Removing old directory...
==> Building...
internal/ui/assets.go:16:12: pattern .tmp/boundary-ui/ui/admin/dist: no matching files found
make: *** [dev] Error 1

c4milo avatar Dec 23 '21 17:12 c4milo

FWIW, also the homebrew tap doesn't seem to be installing the ARM64 binary.

c4milo avatar Dec 23 '21 17:12 c4milo

I just successfully ran make dev on a new clone of the boundary repo. make dev did successfully determine that the ui assets hadn't been previous built and built the dependency for me.

jimlambrt avatar Dec 23 '21 19:12 jimlambrt

FWIW, also the homebrew tap doesn't seem to be installing the ARM64 binary.

I also just uninstalled and installed boundary with brew and it resulted in the proper binary: /opt/homebrew/Cellar/boundary/0.7.3/bin/boundary

❯ ll /opt/homebrew/bin/boundary
lrwxr-xr-x  1 jimlambrt  37 Dec 23 14:03 /opt/homebrew/bin/boundary@ -> ../Cellar/boundary/0.7.3/bin/boundary

jimlambrt avatar Dec 23 '21 19:12 jimlambrt

Here is what I get:

/tmp/boundary main 10s
❯ boundary
rosetta error: /var/db/oah/279281325309952_279281325309952/9dc165effa6c905172c4fc33b148e9a1f5bb0311181cafe373fea12f2ceb43ed/boundary.aot: attachment of code signature supplement failed: 1
zsh: trace trap  boundary

c4milo avatar Dec 23 '21 21:12 c4milo

Fresh clone:

❯ git clone https://github.com/hashicorp/boundary.git
Cloning into 'boundary'...
remote: Enumerating objects: 59425, done.
remote: Counting objects: 100% (463/463), done.
remote: Compressing objects: 100% (244/244), done.
remote: Total 59425 (delta 247), reused 408 (delta 215), pack-reused 58962
Receiving objects: 100% (59425/59425), 63.70 MiB | 32.15 MiB/s, done.
Resolving deltas: 100% (41369/41369), done.

/tmp
❯ cd boundary

/tmp/boundary main
❯ make dev
==> No UI assets found, building...
==> Building default UI version from internal/ui/VERSION: 30d029a2238f011f1d58731e2140e0332cbb324c
Cloning into 'internal/ui/.tmp/boundary-ui'...
remote: Enumerating objects: 45751, done.
remote: Counting objects: 100% (175/175), done.
remote: Compressing objects: 100% (137/137), done.
remote: Total 45751 (delta 74), reused 84 (delta 32), pack-reused 45576
Receiving objects: 100% (45751/45751), 12.70 MiB | 28.71 MiB/s, done.
Resolving deltas: 100% (29649/29649), done.
HEAD is now at 83c2e846 Merge pull request #884 from hashicorp/chore-bump-binary-version
From https://github.com/hashicorp/boundary-ui
 * branch              30d029a2238f011f1d58731e2140e0332cbb324c -> FETCH_HEAD
Note: switching to '30d029a2238f011f1d58731e2140e0332cbb324c'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 30d029a2 Merge pull request #878 from hashicorp/feature-host-catalogs-only-supports-static-type
From https://github.com/hashicorp/boundary-ui
 * branch              30d029a2238f011f1d58731e2140e0332cbb324c -> FETCH_HEAD
Already up to date.
HEAD is now at 30d029a2 Merge pull request #878 from hashicorp/feature-host-catalogs-only-supports-static-type
./scripts/uigen.sh: line 15: yarn: command not found
Please ensure Node v14+ and Yarn v1.22.10+ are installed.
==> Building Boundary with dev and UI features enabled
==> Building Host Plugins...
github.com/hashicorp/boundary/plugins/host/mains/aws
github.com/hashicorp/boundary/plugins/host/mains/azure
==> Removing old directory...
==> Building...
internal/ui/assets.go:16:12: pattern .tmp/boundary-ui/ui/admin/dist: no matching files found
make: *** [dev] Error 1

/tmp/boundary main 10s
❯

c4milo avatar Dec 23 '21 21:12 c4milo

I'm sorry you're having these issues. Sadly I can't reproduce the issue.

I'm curious if you can make build-ui

jimlambrt avatar Dec 23 '21 21:12 jimlambrt

I was missing some dependencies. The following resolved it and I can now compile boundary without errors!

brew install nodejs
npm install -g yarn 

The homebrew tap binary is still strangely broken but it is not a blocker now :)

c4milo avatar Dec 23 '21 21:12 c4milo

Happy to hear it's working.

jimlambrt avatar Dec 23 '21 21:12 jimlambrt

I also had a similar issue on my M1 Mac, I was able to fix it by downgrading Node from 16.14.2 to 14.9.1

xingluw avatar Apr 25 '22 23:04 xingluw