ngc2359
Ecto migrations on Google Cloud
Hi, I’m relatively new to Elixir and Phoenix but I wanted to deploy a very simple app on Google Cloud App Engine Flexible (works on localhost). The problem is that the deployment pipeline of elixir-runtime does not include any ecto.migrate routine, and once the app is deployed there is no access to any mix utility.
I tried to include this task in the pipeline but then it doesn’t have access to the database, here is my app.yaml:
env: flex
runtime: gs://elixir-runtime/elixir.yaml
runtime_config:
release_app: my_project
build:
- mix phx.digest
- mix ecto.migrate
env_variables:
DB_USER: postgres
DB_PASS: my_password
DB_NAME: my_project
DB_HOST: /cloudsql/my_project:europe-west1:my_project-sql
beta_settings:
cloud_sql_instances: my_project:europe-west1:my_project-sql
As I was not able to find any clue on the Internet, you are my last hope! ![]()
EDIT: Allowing any IP address to connect to the database (as bad as it is) doesn’t work either as the builder container does not seem to have access to that network.
First Post!
dokuzbir
As i see there is no elixir in machines. You can try install to machines to elixir. But i think wont persist.
https://github.com/kokolegorille/app/blob/master/DEPLOYMENT.md#user-content-production-server
@kokolegorille told production machines dont need elixir, erlang, phoenix. I dont know why but he can explain better than me.
Most Liked
kokolegorille
Because when You produce a release everything is included inside. You don’t need to install anything but the binary
… and the database, if hosted on the server, … and maybe a reverse proxy, like nginx.
kokolegorille
For the question, I may hardly answer because I never used Google Cloud, but to me the release Repo should be configured with the config/prod_secret.exs file.
This should grant access to the database…
There should be an equivalent inside this config/prod_secret.exs of
env_variables:
DB_USER: postgres
DB_PASS: my_password
DB_NAME: my_project
DB_HOST: /cloudsql/my_project:europe-west1:my_project-sql
Then the migration is a separate task. As I mentionned in the repo I did the migration by hand using pg_dump and psql to restore database on the production server.
I have no idea about how to configure Google Cloud, but I would look if I can initialize it with a simple sql dump file.
This part, once You get it right, can be automate by edeliver.
But their are great change coming in the deployment system…
kokolegorille
I had a look at
I don’t know if it is the service used… but it seems You can send sql to psql client in the cloud shell. I would dump the database from dev, and use this to restore db on production.
Unless there is something I am missing.
Did You look at edeliver?
Last Post!
BrightEyesDavid
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










