Hi Vadim,
On Friday, 4 August 2017 23:32:27 UTC+1, Vadim Berezniker wrote:
-- Thanks for your email.
Here's my db section in the docker compose file referencing the cloud proxy:
db:
image: gcr.io/cloudsql-docker/gce-proxy:1.10
read_only: true
tmpfs:
- /tmp
- /var/run/postgresql
volumes:
- ./config/QwikGiving-d57xxxxxx.json:/xxxx-d57xxxxxx.json
- db:/var/lib/postgresql/data
- ./config/postgres-initdb.sh:/docker-entrypoint-initdb.d/initdb.sh
ports:
# - '5432:5432'
- '127.0.0.1:5435:5432'
command: ./cloud_sql_proxy -dir=/cloudsql -instances=xxxxxx-xxxxx:europe-west1:dbxxxx=tcp:5432 -credential_file=xxxxxxx-xxxx.json
db_1 | 2017/08/04 21:54:55 using credential file for authentication; email=thexxx-proxy@xxxxxx-1xxxxx.iam.gserviceaccount.com
db_1 | 2017/08/04 21:54:55 Listening on 127.0.0.1:5435 for xxxx-xxxx:europe-west1:dbxxxx
db_1 | 2017/08/04 21:54:55 Ready for new connections
So with the above, you can see the cloud_sql proxy image was successfully configured. So in my NodeJS application, I passed something like this for connection params:
const config = new Sequelize(process.env.DATABASE_URL);
Where process,env,DATABASE_URL was passed as environment variables, here's it was passed:
- DATABASE_URL=postgres://username:password@127.0.0.1:5432/db
Hope the above helps in understanding my setup. Please let me know if you have follow on questions.
Thanks,
Kunle
Just to clarify, are you doing anything to start the proxy process?The Cloud SQL proxy is not a library but rather a process that needs to be configured to run alongside your application.If I misunderstood and you have indeed configured it to run, can you share the logs from the Cloud SQL proxy?On Fri, Aug 4, 2017 at 2:55 PM, Ife A <smartde...@gmail.com> wrote:Hi there,--Have been struggling with this issue for the past three days and even put a support ticket forward but not much progress, so far its been quite frustrating. Enough of my ranting, here goes the issue / scenario:I have a NodeJS application with postgres database which I put in a docker container called `api`. I have a docker-compose file that automatically builds my applications in a docker container and then push them into GCP VM. So have got 1) Api docker image, 2) db docker image which was built using Cloud_SQL Proxy image, 3) redis 4) nginx - all docker images.When I use just my local postgres database placed in a docker container under the base docker image `postgres:9.6.3-alpine`. I was able to connect fine to my NodeJS application but keep getting `Connection Refused` when I use `gcr.io/cloudsql-docker/gce-proxy:1.10` cloud-sql image.So the issue is, my NodeJS application (api docker) is unable to connect to the `db` cloud_sql docker image. Not sure how to best resolve this, please assist. Kindly suggest if there are more feasible way to connect to my postgres inside from a docker container (api docker) on GCP.Thanks in anticipation,Ife
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com .
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql- .discuss/baca2ce1-2d9c-4b28- a707-d36aef35845d% 40googlegroups.com
For more options, visit https://groups.google.com/d/optout .
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/b41bebaf-1e99-48a6-9bd5-7d92b038a963%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment