-
Project ID : code-test-back
-
Region : europe-west1
-
Zone : europe-west1-b
-
Cloud Run Service : code-test-back-service
-
Cloud Build : code-test-back-trigger
-
Enabled Services :
- Enable Cloud Run API
- Enable Cloud Build
- Enable Container Register
- Enable Cloud SQL Admin API
-
Authorization:
- CodeTestBack -> IAM & Admin -> Service Accounts -> Copy the service account
- CodeTestBDD -> IAM & Admin -> IAM page -> ADD -> Past the service account and give the Cloud SQL Client Role
To run this application locally, download and install the cloud_sql_proxy
by following the
instructions here.
Instructions are provided below for using the proxy with a TCP connection or a Unix Domain Socket. On Linux or Mac OS you can use either option, but on Windows the proxy currently requires a TCP connection.
To run the sample locally with a TCP connection, set environment variables and launch the proxy as shown below.
Use these terminal commands to initialize environment variables:
- Init environment variables
chmod 775 init_db_vars.sh
source ./init_db_vars.sh
Note: Saving credentials in environment variables is convenient, but not secure - consider a more secure solution such as Secret Manager to help keep secrets safe.
- Then use this command to launch the proxy in the background:
./cloud_sql_proxy -instances=codetestbdd:europe-west1:codetest-bdd-1=tcp:5432 &
- To stop the proxy :
Find process :
ps | grep cloud_sql_proxy
Kill process based on its id
kill process_id
Host : localhost
Port : 5432
User : Postgres
Pass : CodeWorks
Database : postgres
-
Open Terminal in (Applications/Utilities/Terminal) and upgrade pip:
python3.8 -m pip install pip --upgrade
Another option to upgrade, is:
pip3 install pip --upgrade
-
Install Pipenv:
python3.8 -m pip install pipenv
Another option to upgade, is :
pip3 install pipenv --upgrade
-
Verify Pipenv:
pipenv
virtualenv --python python3 env
source env/bin/activate
pip install -r requirements.txt
Finally, start the application:
strawberry server app
Navigate towards http://127.0.0.1:8000
or http://localhost:8000
to verify your application is running correctly.