Skip to content

Latest commit

 

History

History
58 lines (35 loc) · 2.05 KB

00-test-local.md

File metadata and controls

58 lines (35 loc) · 2.05 KB

Try the application locally

Before you get to deploying this application on Google Cloud, you can test the application locally with Docker and Docker Compose.

In this section, we'll build the application on our local machine, and using the provided configuration file, we'll deploy the app locally.


You will need to install:

This local deployment will use the same image as our production deployment will, but will make use of the included docker-compose.yml to connect together the components.

Get a local copy of the code

If you are familiar with git:

git clone [email protected]:villers/laravel-cloud-run-sql.git
cd laravel-cloud-run-sql

Build the image

Before we can use our image, we have to build it. The database image will be pulled down later, so we just need to manually build our web image:

docker-compose build

Start the services

Now we have a database, and a build web image, we can start them:

docker-compose up
  • Be sure the composer and php is installed in your system. (not in the docker)

Initialise the database

At the moment the database is empty. We can use standard django commands to run our database migrations, and add some default data; these instructions need to be run the context of our web image:

docker-compose run --rm app php artisan migrate --seed

You can now see app running in your browser at http://localhost:8080/


Next step: Setup Google Cloud Platform environment