raystack/frontier

Cannot install local dev

Closed this issue · 7 comments

All paths to installation fail.

  • Docker Run
  • docker pull then manually configure container
  • make then migrate
  • Docker compose in git
  • brew tap
frontier % ./frontier server migrate
2024-04-16T23:44:04.720-0400    info    frontier is migrating   {"version": "v0.9.0"}
2024-04-16T23:44:04.722-0400    error   error running migrations[error URL cannot be empty]     {"error": "URL cannot be empty"}
URL cannot be empty
rontier % brew install raystack/taps/frontier
==> Tapping raystack/taps
Cloning into '/usr/local/Homebrew/Library/Taps/raystack/homebrew-taps'...
remote: Repository not found.
fatal: repository 'https://github.com/raystack/homebrew-taps/' not found
Error: Failure while executing; `git clone https://github.com/raystack/homebrew-taps /usr/local/Homebrew/Library/Taps/raystack/homebrew-taps --origin=origin --template= --config core.fsmonitor=false` exited with 128.

Screenshots
(scrrenshots not uploading...?)

macbook air

Additional context
Accidently bumped into this looking fo rzitadel stuff. Looks a lot closer to waht I need. Excited to give it a run...

To run frontier locally, just starting via docker compose should be enough, no need to install anything. What happens when you clone the repo and do docker-compose up?

If you mean this as is https://github.com/raystack/frontier/blob/main/docker-compose.yml

it just builds the pg dbs and spicedb...

If I uncomment the frontier images the do docker compose before make I get this:

image

If i make then do docker compose I get the same.

If I do make then ./frontier server init also the same no key message

UPDATE: Looked a little closer at the docs seems you need ot go through the whole installation to find some more info on iinstall with docker compose. So made some progress but here I am stuck again:

Did the ./frontier init to create the config.toml and tried to run migrate and said url cannot be blank, so I saw in the config.tonl an empty postgres param and updated it with the pg just installed by docker compose. Ran migrate again and success. Then came the moment of joy trying to start the server and got blocked with:

image

I see in the config.toml an empty passkey object...but I have NO idea what to do here.
image

Quick question whil I got ya - Is there a way to abstract the billing engine from the authn?

If you just want to start, no additional configs should be required. Give this docker-compose file a try, this is the default one you see in repo with frontier uncommented. This will build frontier locally on your machine and run it in docker.

version: "3.7"

services:
  pg:
    image: postgres:13
    environment:
      - POSTGRES_DB=frontier
      - POSTGRES_USER=frontier
      - POSTGRES_HOST_AUTH_METHOD=trust
    volumes:
      - ./temp/pgdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U frontier" ]
      interval: 30s
      timeout: 30s
      retries: 3

  pg2:
    image: "postgres:13"
    environment:
      POSTGRES_USER: "spicedb"
      POSTGRES_DB: "spicedb"
      POSTGRES_HOST_AUTH_METHOD: "trust"
    volumes:
      - ./temp/pgdata2:/var/lib/postgresql/data
    ports:
      - "5431:5432"
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -U spicedb" ]
      interval: 30s
      timeout: 30s
      retries: 3

  frontier-migrate:
    build:
      context: .
      dockerfile: Dockerfile.dev
    command: migrate
    restart: on-failure
    depends_on:
      pg:
        condition: service_healthy
    environment:
      - FRONTIER_DB_DRIVER=postgres
      - FRONTIER_DB_URL=postgres://frontier:@pg:5432/frontier?sslmode=disable
      - FRONTIER_SPICEDB_PORT=50051
      - FRONTIER_SPICEDB_HOST=spicedb
      - FRONTIER_SPICEDB_PRE_SHARED_KEY=frontier

  frontier:
    build:
      context: .
      dockerfile: Dockerfile.dev
    ports:
      - "8081:8080"
    command: start
    restart: on-failure
    depends_on:
      pg:
        condition: service_healthy
      frontier-migrate:
        condition: service_completed_successfully
    environment:
      - FRONTIER_DB_DRIVER=postgres
      - FRONTIER_DB_URL=postgres://frontier:@pg:5432/frontier?sslmode=disable
      - FRONTIER_SPICEDB_PORT=50051
      - FRONTIER_SPICEDB_HOST=spicedb
      - FRONTIER_SPICEDB_PRE_SHARED_KEY=frontier
      - FRONTIER_APP_RESOURCES_CONFIG_PATH=file:///opt

  spicedb-migration:
    image: quay.io/authzed/spicedb:v1.29.2
    command: migrate head --datastore-engine postgres --datastore-conn-uri postgres://spicedb:@pg2:5432/spicedb?sslmode=disable
    restart: on-failure
    depends_on:
      pg2:
        condition: service_healthy

  spicedb:
    image: quay.io/authzed/spicedb:v1.29.2
    ports:
      - "7443:8443"
      - "50051:50051"
    command:
      serve --grpc-preshared-key "frontier" --datastore-engine postgres
      --datastore-conn-uri postgres://spicedb:@pg2:5432/spicedb?sslmode=disable --http-enabled=true
    restart: on-failure
    depends_on:
      pg2:
        condition: service_healthy
      spicedb-migration:
        condition: service_completed_successfully

Test this by curl localhost:8081/ping

Billing engine is abstracted & disabled by default unless we specify stripe key. It will have no effect on the default user/authn/z management.

The error you see is because while generating the config, it has initialized the fields with empty values. I'll fix this to avoid confusion. You can find sample config and their details on docs page. Note: this doesn't have info about billing engine at the moment.

Ok cool thank you - gave it a run and it 'looks' like I got something to start digging into. Did see this error in the compose up though:

image

ALso FYI in your docs you need ot add escapes \ to your docker run sample here:

image

As for the question abt billing - I am in the process of replacing our home grown auth for a payment switch I run. Billing / recurring billing is also going ot be replaced so when I saw your package had this raised my eyebrows. So I will need ot integrate our stuff. maybe an ISV opportunity here...?

This error is related to frontier UI which is disabled by default. To use it, we need to setup the mailer daemon in the config as well. The UI is still in the early stages but I'll update the docs on how to set it up.

Screenshot 2024-04-18 at 10 07 02 AM