Gigalixir Action - GitHub Action to deploy applications to Gigalixir and run your Ecto migrations automatically

Howdy folks! The project has been around for a while, figured I should finally share it here.

The Gigalixir Action is a GitHub Action should can use in your workflows to deploy applications to Gigalixir and run your Ecto migrations automatically.

GitHub: GitHub - mhanberg/gigalixir-action: A GitHub Action for deploying Phoenix applications to Gigalixir

8 Likes

I will also comment off the bat that the Gigalixir CLI is written in Python, and there are some widespread issue with Python going on right now from what I hear, so you will probably need to explicitly use the latest Python version in your workflow using this example.

I’ll get the README updated shortly.

1 Like

6 posts were split to a new topic: Split Thread: CLI Implementation Languages

Hi, @mhanberg.

I read this blog post you writed (CI/CD with Phoenix, GitHub Actions, and Gigalixir | Mitchell Hanberg) and for some reason I couldn’t make the automatic deploy works. I’m having some error in the Github Actions that says Error: Input required and not supplied: GIGALIXIR_USERNAME. My secrets variables are GIGALIXIR_EMAIL, GIGALIXIR_PASSWORD, GIGALIXIR_APP_NAME, SSH_PRIVATE_KEY. This is the link to action in Github 💚 Fixed automatic deploy · alvesgabriel/stonepay@9e31731 · GitHub.

Do you know some solution to my problem?

Since now, thank you for your attention.

I would double check you set that GIGALIXIR_EMAIL secret correctly, or check the spelling.

1 Like

Thank you very much, @mhanberg. It was really a configuration wrong in Github secrets that I did.

1 Like

Just released v0.5.0!

This release brings support for deploying an app from a subdirectory #34 from GitHub user ChristianTovar, thanks Christian!

1 Like

Also, I am looking folks using umbrella apps to test PR #16.

This PR aims to make it possible to specify an app app to use when running the db migrations.

Testers with non-umbrella apps are also welcome to help ensure there are no regressions, thanks!

v0.6.0 released!

3 Likes

I am currently having migration issues. I have checked that i only have one public key with gigalixir. I have also checked that i have private key as a secret in github repo.

Running migrations
  /opt/hostedtoolcache/Python/3.8.1/x64/bin/gigalixir ps:migrate -a <APP_NAME>
  Pseudo-terminal will not be allocated because stdin is not a terminal.
  Warning: Permanently added '[v2018-us-central1.gcp.ssh.gigalixir.com]:30654,[35.224.115.157]:30654' (ECDSA) to the list of known hosts.
  root@v2018-us-central1.gcp.ssh.gigalixir.com: Permission denied (publickey).
  Command '['ssh', '-t', 'root@v2018-us-central1.gcp.ssh.gigalixir.com', '-p', '30654', 'gigalixir_run', 'migrate']' returned non-zero exit status 255.

I have tried to run gigalixir client locally with success

➜  git:(main) gigalixir ps:migrate -a <APP_NAME>

14:56:20.023 [info]  Migrations already up
Connection to v2018-us-central1.gcp.ssh.gigalixir.com closed.

I am running out of ideas here. So trying my luck here to see if anyone had similar problems before

I would make sure that your private key that is in the GitHub Secrets is correct.

It’s a mystery. I tried pbcopy this time to make sure but still same error. I also made sure i only have one public key in gigalixir.

@laiboonh I’m with you on this - out of nowhere last week we noticed a “fun” error message using github actions with gigalixir (all documented in this issue on gigalixir-cli). They’ve since extended the ssh options to allow for -tt which works fine from dev local but was still failing with a 255 status exit when run as part of the github actions pipeline.

Here is my fork that does show the -tt option during migrate.

After the change above^ I don’t get the error Pseudo-terminal will not be allocated because stdin is not a terminal but the journey doesn’t end there. Next I found that my public key was denied (interesting given this was never a problem before last week).

Running migrations root@v2018-us-central1.gcp.ssh.gigalixir.com: Permission denied (publickey). Command '['ssh', '-tt', 'root@v2018-us-central1.gcp.ssh.gigalixir.com', '-p', '31266', 'gigalixir_run', 'migrate']' returned non-zero exit status 255.

To get around this problem I generated a new ssh key like so

ssh-keygen -t ed25519 -C "email@here.com"

Next, copy the private key and create a new secret for Github Actions named SSH_PRIVATE_KEY

pbcopy < id_ed23456

Finally, from your local machine add the public key to gigalixir

gigalixir account:ssh_keys:add "$(cat ~/.ssh/id_ed23456.pub)"

And now when you kick this deploy using github actions it’s running migrations without issue. Big thanks to @mhanberg and I’ve opened an issue on the main github project for others to benefit

1 Like