mirror of
https://github.com/paralus/paralus.git
synced 2026-05-06 16:36:46 +00:00
* Add DB_ADDR to env vars list * Add Dockerfile and docker-compose * Remove go.mod from _kratos dir and clean go.mod of root dir * Run Kratos docker-compose quickstart from root dir * Add gomigrate to docker-compose * Bump docker-composen version to 3.7 * Add Kratos services in the single docker compose file Removed Kratos quickstart files and merge all setup required for rcloud-base in the kratos-compose.yml file located in the root of the repo. * Add elasticsearch in docker-compose * Allow es to not be available in when in dev mode * Change default ES endpoint Co-authored-by: Abin Simon <abin.simon@rafay.co>
2.3 KiB
2.3 KiB
rcloud-base
This repository contains all the rcloud-system components that are the backbone for ztka and gitops.
Prerequisites
- Postgres database
Ory Kratos- API for user management- We use
Casbin- An authorization library that supports access control models like ACL, RBAC, ABAC
Setting up the database
You can use the bitnami charts for postgresql
Create the initial db/user
Scripts for admindb:
create database admindb;
CREATE ROLE admindbuser WITH LOGIN PASSWORD '<your_password>';
GRANT ALL PRIVILEGES ON DATABASE admindb to admindbuser;
Now in the newly created db:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
grant execute on function uuid_generate_v4() to admindbuser;
Scripts for clusterdb:
create database clusterdb;
CREATE ROLE clusterdbuser WITH LOGIN PASSWORD '<your_password>';
GRANT ALL PRIVILEGES ON DATABASE clusterdb to clusterdbuser;
Now in the newly created db:
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
grant execute on function uuid_generate_v4() to clusterdbuser;
This will grant the necessary permission to the newly created user to run uuid_generate_v4()
Run application migrations
We use golang-migrate to perform migrations.
Install golang-migrate
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
-tags 'postgres' is important as otherwise it compiles without postgres support
You can refer to the guide for full details.
Run migrations
Example for admindb:
export POSTGRESQL_URL='postgres://<user>:<pass>@<host>:<port>/admindb?sslmode=disable'
migrate -path ./persistence/migrations/admindb -database "$POSTGRESQL_URL" up
See cli-usage for more info.
Development setup
Run following Docker Compose command to setup all requirements like Postgres db, Kratos etc. for the rcloud-base:
docker-compose up -d
Install Go dependencies:
go get
Start rcloud-base:
go run github.com/RafaySystems/rcloud-base