4

Iam looking for help to containerize a laravel application with docker, running it locally and make it deployable to gcloud Run, connected to a gcloud database. My application is an API, build with laravel, and so far i have just used the docker-compose/sail package, that comes with laravel 8, in the development.

Here is what i want to achieve:

  • Laravel app running on gcloud Run.
  • Database in gcloud, Mysql, PostgreSQL or SQL server. (prefer Mysql).
  • Enviroment stored in gcloud.

My problem is can find any info if or how to use/rewrite the docker-composer file i laravel 8, create a Dockerfile or cloudbuild file, and build it for gcloud.

Maybe i could add something like this in a cloudbuild.yml file:

#cloudbuild.yml
  steps:
  # running docker-compose
  - name: 'docker/compose:1.26.2'
    args: ['up', '-d']

Any help/guidanceis is appreciated.

megaman
  • 153
  • 3
  • 13
  • 1
    Is [this](https://www.youtube.com/watch?v=KCWGJV3x1Rs) what you are looking for? – Ralemos Feb 10 '21 at 15:27
  • 1
    Yeah that video, helps alot on how to build some of the conf files and so on. But does not touch on database connection and secrets – megaman Feb 10 '21 at 15:36
  • 1
    for those you can check both this [documentation](https://cloud.google.com/sql/docs/mysql/connect-run) and this [article](https://medium.com/google-cloud/secret-manager-improve-cloud-run-security-without-changing-the-code-634f60c541e6) respectively. – Ralemos Feb 10 '21 at 17:32

1 Answers1

1

As mentioned in the comments to this question you can check this video that explains how you can use docker-composer, laravel to deploy an app to Cloud Run with a step-by-step tutorial.

As per database connection to said app, the Connecting from Cloud Run (fully managed) to Cloud SQL documentation is quite complete on that matter and for secret management I found this article that explains how to implement secret manager into Cloud Run.

I know this answer is basically just links to the documentation and articles, but I believe all the information you need to implement your app into Cloud Run is in those.

Ralemos
  • 5,571
  • 2
  • 9
  • 18
  • I successfully deployed my app to Google Cloud App Engine but I'm unable to store files in '/storage'. – aghwotu Apr 20 '21 at 08:48
  • You cannot upload files and store them with Google Cloud App Engine. See details here : https://stackoverflow.com/questions/2693081/does-google-app-engine-allow-creation-of-files-and-folders-on-the-server . Store the files on Google cloud storage or equivalent file storage service. – Rares Hideg Apr 30 '21 at 03:06