blog.broncotoxique.com

Just another geek website

Deploy Proprietas on Clever-Cloud

I was searching for a solution to manage the common area maintenance charges of the building I live in. I found many solutions like Diacamma which seems to be the best one but with a very old GUI. I found Proprietas, it seems its a brand new one, AI produced I guess, still it seems me easier to use.

In order to make some tests I decided to deploy Proprietas on Clever-Cloud.

Let’s assume you already have an Clever-Cloud account, you have a GitHub (or equivalent) account. Now, clone Proprietas repo.

Since you have the Proprietas clone repo, keep in mind that we will not use the docker-compose.yml either Dockerfile to deploy. The deployment we will make by reproducing the build phases that are inside the Dockerfile and using the parameters inside the docker-compose file.

The app will composed of : one Python runtime, one Postgres db, one Cellar S3 Bucket as filesystem.

Go to the Clever-Cloud console, create a new application from a repository, select your Proprietas clone, select the runtime Python, add a Postgres add-on, validate. Then create a Cellar S3 Bucket add-on and link it to the Proprietas runtime.

Now the runtime configuration, setup all that you want and about the Environment variables make sure you set the following:

CC_HEALTH_CHECK_PATH="/api/health"
CC_POST_BUILD_HOOK="cd ./frontend && npm ci && npm run build" #After build run the database migration AND build the frontend
CC_PRE_BUILD_HOOK="cp -R ${APP_HOME}/backend/* ${APP_HOME}/" #Pre build, move all the backend to the ROOT of the project
CC_RUN_COMMAND="python -m app.demarrage" #Start the backend

COPRO_DATABASE_URL="postgresql+psycopg2://[USER]:[PASSWORD]@....-postgresql.services.clever-cloud.com:[PORT]/[DB_NAME]"
COPRO_DB_MAX_OVERFLOW="5" # additional connection, at peak times
COPRO_DB_POOL_RECYCLE="1800" # seconds before renewing a connection
COPRO_DB_POOL_SIZE="5" # connections kept open; 0 = no pool (one connection per request)
COPRO_DB_POOL_TIMEOUT="30" # seconds wait for a free connection

COPRO_EMAIL_EXPEDITEUR="user@host.tld" # Default sender ID for all copro

COPRO_FRONTEND_DIST="./frontend/dist" #Make sure that the front is served from the "dist" directory

COPRO_FRONTEND_URL="https://host.tld" # The URL of the Proprietas instance frontend

COPRO_S3_ACCESS_KEY_ID="..."
COPRO_S3_BUCKET="..."
COPRO_S3_ENDPOINT_URL="https://cellar-c2.services.clever-cloud.com"
COPRO_S3_PREFIX="directory/"
COPRO_S3_REGION="default"
COPRO_S3_SECRET_ACCESS_KEY="..."

COPRO_SECRET_KEY="[YOUR_SECRET_SECRET]"

COPRO_SMTP_HOST="smtp.host.tld"
COPRO_SMTP_PASSWORD="..."
COPRO_SMTP_PORT="465"
COPRO_SMTP_USER="user@host.tld"

COPRO_STOCKAGE="s3"

COPRO_UPDATE_DIR="./data/updates"
COPRO_UPLOAD_DIR="./data/uploads"

PROPRIETAS_PORT="9000"

Then run you app, click RE-BUILD AND START, it should run.

Obviously I advise you to read the Python deployment doc from Clever Cloud : https://www.clever.cloud/developers/doc/deploy/applications/python/

If you face any issue, please write a comment.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *