- Copy
.env.exampleto.env - Update the environment variables
docker-compose up -d. It will create API, DB, and DB admin containers
- Access to the Google Cloud Console with your Google account:
- Create a new project
- Go to the Credentials page
- Create a new OAuth client ID
- Consent screen:
- Then, set up the App Name, Support Email
- Add
userinfo.emailanduserinfo.profile, andopenidscopes. - Add your email as a test user to start testing the application.
- After the consent screen is ready we can finally create the OAuth client id. So we go to Credentials -> Create Credentials -> OAuth client ID.
- Set up the OAuth client ID:
- Application type: Web application
- Name: Job board
- Authorized JavaScript origins: For example,
http://127.0.0.1:8000 - Authorized redirect URIs: http://127.0.0.1:8000/v1/auth
- After creating the client, it will pop a modal with your client ID and client secret
- Copy the client ID and client secret to the
.envfile in theGOOGLE_CLIENT_IDandGOOGLE_CLIENT_SECRETenv variables.
Accessing this endpoint in browser you will create new websocket connection and be able to send messages which will be broadcasted to all participants.
- Access PostgreSQL DB:
dco exec db psql --username=user_one --dbname=job_board - List of relations:
# \dt
dco exec db psql --username=user_one --dbname=job_boardselect * from table;
- Access
http://localhost:8080/ - Fill username and password (from docker-compose.yml) PGADMIN_DEFAULT_EMAIL PGADMIN_DEFAULT_PASSWORD
- Create new server:
- Add your server name
- Host name/address:
postgres_container - Port:
5432 - Username:
user_one - Password:
user_one
- From root directory execute:
pytest
- Create GCP account
- Install gcloud CLI: https://cloud.google.com/sdk/docs/install
gcloud init- Check project ID:
gcloud config get-value project - Build container image using Cloud Build:
gcloud builds submit --tag gcr.io/PROJECT-ID/api - Deploy container image to Cloud Run using env variables (Take values from your .env file):
gcloud run deploy --image gcr.io/PROJECT-ID/api --platform managed --update-env-vars POSTGRES_USER=x,POSTGRES_PASSWORD=x,POSTGRES_SERVER=x,POSTGRES_PORT=x,POSTGRES_DB=x,POSTGRES_DB_DRIVER=x - Check deployment:
gcloud run services list
Deployment to http://fly.io/. fly.toml file is used for deployment.
- Create account
- Install flyctl CLI: https://fly.io/docs/getting-started/installing-flyctl/
fly auth loginfly apps create- Build app:
fly launch - Add DB secrets to app:
fly secrets set POSTGRES_USER=x POSTGRES_PASSWORD=x env_name=env_value - Deploy app:
fly deploy - Check deployment status:
fly status - Check logs:
fly logs - Check app details:
fly info
- Add certificates:
fly certs create app_name - Check certificates:
fly certs show app_name
- Create Postgres DB:
fly postgres create - Access logs:
fly postgres connect -a my-db-app - Select all DBs:
type \ - Choose one DB:
\connect DB_NAME - List tables:
\dt