Skip to content

Commit

Permalink
Merge pull request #435 from lexicongovernance/develop
Browse files Browse the repository at this point in the history
v2.5.5
  • Loading branch information
diegoalzate authored Jul 2, 2024
2 parents e43e271 + 8bf7f59 commit 5f173ad
Show file tree
Hide file tree
Showing 89 changed files with 9,585 additions and 3,832 deletions.
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
DB_CONNECTION_URL=postgresql://postgres:secretpassword@localhost:5432
# DATABASE CONNECTION
DATABASE_HOST="localhost"
DATABASE_PORT="5432"
DATABASE_USER="postgres"
DATABASE_PASSWORD="secretpassword"
DATABASE_NAME="postgres"

PORT=8080
COOKIE_PASSWORD=YourPasswortMustBeAtLeast32Charc
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
# Provide the password for postgres
env:
POSTGRES_PASSWORD: secretpassword
POSTGRES_USER: postgres
POSTGRES_DB: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
Expand Down Expand Up @@ -50,3 +52,11 @@ jobs:

- name: Run unit tests
run: pnpm test
env:
DATABASE_PASSWORD: secretpassword
DATABASE_USER: postgres
DATABASE_NAME: postgres
DATABASE_HOST: localhost
DATABASE_PORT: 5432
PORT: 8080
COOKIE_PASSWORD: YourPasswortMustBeAtLeast32Charc
30 changes: 30 additions & 0 deletions .processes/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
## Getting started

After following the steps in the [self-host](./self-host.md), you can start using the tool in action by following these steps:

1. Run seed data to populate the database with initial data:

```bash
pnpm seed
```

This command will create an event with cycles and dummy questions.

## How to use the tool

1. Login to the app by navigating to `http://localhost:3000` in your browser.
2. Register for an event
3. Accept the registration by running `pnpm db:studio` and updating the registration status to `APPROVED`.

You can now start using the tool to create and answer questions, view the results, and more!

## FAQ

### How do I create a new event?

1. Create a new row in the `events` table in the database. A event can have many cycles, each cycle represents a round of questions.
2. Create group categories in the `group_categories` table in the database. A group category can have many groups. At least one group category must be created with the boolean `required` set to `true`.
3. Create multiple new rows in the `groups` table in the database associated to the group category created in the previous step. A group can have many users.
4. Create a new row in the `cycles` table in the database. Make sure to set correctly the start_at and end_at time. A cycle can have many questions.
5. Create a new row in the `questions` table in the database. A question can have many options.
6. Create a new row in the `options` table in the database. An option belongs to a question.
35 changes: 35 additions & 0 deletions .processes/self-host.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Self-Hosting an Event

To self-host the app, you will need to follow these steps:

1. Clone the frontend repository from [GitHub](https://github.com/lexicongovernance/pluraltools-frontend).
2. Install Docker and Docker Compose on your machine.
3. Clone the backend repository from [GitHub](https://github.com/lexicongovernance/pluraltools-backend).
4. Navigate to the backend repository's root directory.

## Setting up the Backend

1. install [nodejs v20.14.0](https://nodejs.org/en/download)
- On WSL (Windows Subsystems for Linux) install `node.js v20` as follows:
```
1. curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
2. sudo apt install -y nodejs
```
2. install [pnpm](https://pnpm.io/installation#using-npm)
3. create a `.env` file in the backend repository's root directory.
4. populate the `.env` file with the necessary environment variables. Refer to the `.env.example` file for guidance.
6. `pnpm install` to install the required packages and depencies
5. `make docker-run` will start db and cycle-manager service
7. `pnpm build && pnpm start` will start the server
8. The backend services should now be running and accessible at `http://localhost:8000`. Run `pnpm test` to verify that the backend is running correctly.

## Setting up the Frontend

1. Navigate to the frontend repository's root directory.
2. Create a `.env` file in the frontend repository's root directory.
3. Populate the `.env` file with the necessary environment variables. Refer to the `.env.example` file for guidance.
4. Run `pnpm install` to install the required packages and depencies.
5. Run `pnpm berlin:dev` to start the frontend development server:
6. The frontend should now be running and accessible at `http://localhost:3000`.

You have successfully self-hosted the app! You can now access the frontend and interact with the backend services.
294 changes: 0 additions & 294 deletions DATABASE.md

This file was deleted.

Loading

0 comments on commit 5f173ad

Please sign in to comment.