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

Support builds via depot.dev #3688

Merged
merged 15 commits into from
Jul 30, 2024
Merged

Support builds via depot.dev #3688

merged 15 commits into from
Jul 30, 2024

Conversation

jsierles
Copy link
Member

This borrows code from dockerfileBuilder, but has some differences as depot is remote and can build and push to the fly registry directly.

The CLI arguments followed the style of the nixpacks flags.

To deploy using depot:

  • flyctl deploy --depot

To run a machine:

  • flyctl machines run --build-depot

This borrows code from dockerfileBuilder, but has some differences
as depot is remote and can build and push to the fly registry directly.

The CLI arguments followed the style of the nixpacks flags.

To deploy using depot:
- flyctl deploy --depot

To run a machine:
* flyctl machines run --build-depot

Signed-off-by: Chris Goller <goller@gmail.com>
@jsierles jsierles changed the title Add container image building with depot Support builds via depot.dev Jun 30, 2024
@jsierles jsierles marked this pull request as draft June 30, 2024 12:33
@billyb2
Copy link
Member

billyb2 commented Jul 26, 2024

@billyb2 billyb2 marked this pull request as ready for review July 26, 2024 16:29
@KTanAug21
Copy link
Contributor

Hello!

I'm trying to review this PR by checking if it works locally:
✅ 1. Check if go build works
-works great with go build -o bin/flyctl.exe .

❌ 2. Use the built flyctl.exe to run flyctl.exe deploy --depot in a local Laravel Fly App directory:
- running the command gives me an error:

/.../newapp$ /.../go/flyctl/bin/flyctl.exe  deploy --depot
==> Verifying app config
Validating /home/admin_kath/development/projects/php/tests/newapp/fly.toml
✓ Configuration is valid
--> Verified app config
==> Building image
==> Building image
Error: failed to fetch an image or build from source: error building: returned error 500 Internal Server Error: {"errors":[{"message":"You hit a Fly API error with request ID: 01J3ZWBYA2E6V29C7SB41NQ448-ams","extensions":{"code":"SERVER_ERROR","fly_request_id":"01J3ZWBYA2E6V29C7SB41NQ448-ams"}}],"data":{}}
   - just a note: running `fly deploy` in that local Laravel Fly App directory succeeds though
   - what can I do to make this command run successfully? Did I miss anything?

@billyb2
Copy link
Member

billyb2 commented Jul 29, 2024

Hello!

I'm trying to review this PR by checking if it works locally: ✅ 1. Check if go build works -works great with go build -o bin/flyctl.exe .

❌ 2. Use the built flyctl.exe to run flyctl.exe deploy --depot in a local Laravel Fly App directory: - running the command gives me an error:

/.../newapp$ /.../go/flyctl/bin/flyctl.exe  deploy --depot
==> Verifying app config
Validating /home/admin_kath/development/projects/php/tests/newapp/fly.toml
✓ Configuration is valid
--> Verified app config
==> Building image
==> Building image
Error: failed to fetch an image or build from source: error building: returned error 500 Internal Server Error: {"errors":[{"message":"You hit a Fly API error with request ID: 01J3ZWBYA2E6V29C7SB41NQ448-ams","extensions":{"code":"SERVER_ERROR","fly_request_id":"01J3ZWBYA2E6V29C7SB41NQ448-ams"}}],"data":{}}
   - just a note: running `fly deploy` in that local Laravel Fly App directory succeeds though
   - what can I do to make this command run successfully? Did I miss anything?

ah whoops. a secret accidentally got overridden with the incorrect value. just fixed that. deploying should work fine now :)

@KTanAug21
Copy link
Contributor

KTanAug21 commented Jul 30, 2024

Awesome! I've re-run and the deploy succeeded with depot! 🎉

@KTanAug21
Copy link
Contributor

KTanAug21 commented Jul 30, 2024

Here are the manual tests I've done to verify the commands work:

Test if the commands work locally within a Laravel Fly app's project directory

❓ flyctl deploy --depot
✅ Successfully deploys

admin_kath@__6:~/.../newapp$ /.../go/flyctl/bin/flyctl.exe deploy --depot
==> Verifying app config
Validating /.../newapp/fly.toml
✓ Configuration is valid
--> Verified app config
==> Building image
==> Building image with Depot
--> build:  (​)
[+] Building 47.1s (22/22) FINISHED                 

❓ flyctl machines run --build-depot
✅ Successfully creates a new machine for the app

admin_kath@__6:~/.../newapp$ /.../go/flyctl/bin/flyctl.exe  machines run --build-depot .
==> Building image with Depot
--> build:  (​)
[+] Building 17.2s (22/22) FINISHED     

... // OTHER LOGS HERE!

Image size: 125 MB

Success! A Machine has been successfully launched in app newapp-spring-frost-6423
 Machine ID: _____
 Instance ID: ___
 State: created
       

Check if the both commands work as expected in a CI environment

  • Copied a compressed version of the local build of the PR's flyctl.exe to a repository
  • Created a github workflow to use flyctl.exe deploy --depot and flyctl.exe machines run --build-depot here's a sample run
    **RESULT: Commands run successfully!

@billyb2 billyb2 merged commit 3debb29 into master Jul 30, 2024
29 of 31 checks passed
@billyb2 billyb2 deleted the js-build-depot branch July 30, 2024 18:34
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.

None yet

5 participants