Skip to content

spasiu/ct-admin

Repository files navigation

C&T Admin

Prerequsities

Local Setup

Admin

  1. Clone the repo and run yarn install in the project directory.
  2. Copy .env.example into a new .env file and fill in missing environment variables.
  3. Generate GraphQL NEXT_PUBLIC_GRAPHQL_API="<HASURA API URL>" HASURA_ADMIN_SECRET="<HASURA ADMIN SECRET>" yarn generate in the project root.
  4. Run yarn global add concurrently to install the concurrently package, which is used during yarn dev.
  5. Run yarn dev.

Interact with local Firebase functions (optional - can use functions already deployed to Firebase project)

  1. Start the local firebase function emulator (firebase repository)
  2. Set NEXT_PUBLIC_ENV to local in .env file (NOTE: This will still use Firestore and Storage in the currently set firebase project in the cloud)
  3. Start admin using yarn dev

Hasura & PostgreSQL (optional)

  1. Install Docker.

  2. Run docker-compose up in the project root.

  3. Set NEXT_PUBLIC_GRAPHQL_API to http://localhost:8080/v1/graphql inside of .env file

  4. Run yarn dev

On first run:

  1. Import schema.sql into Hasura via Hasura UI SQL interface or directly into Postgres DB (Can use pgadmin)
  2. Import Hasura manifest file through Hasura UI
  3. (optional) Dump DB from staging/production and import to local

NOTE: The schema.sql file should be maintained to match the production environment

Deployment Process

Admin

We should look into Github hooks for the Firebase deploy, which are available, but for now, the manual deployment process is as follows:

  1. (Optional, but good to avoid ambiguity with previous builds) rm -rf .next out
  2. yarn build
  3. yarn deploy

Hasura changes

On initialization:

  1. Import schema.sql into Hasura instance through Hasura or directly to Postgres DB
  2. Import Hasura manifest file through Hasura UI

Afterwards, Hasura can be updated in several ways:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published