diff --git a/.env.development b/.env.development index 59f291d8d..0bdb018f4 100644 --- a/.env.development +++ b/.env.development @@ -4,10 +4,9 @@ SECRET_PASSWORD=abcdef1234567890abcdef1234567890 # The base url where this instance is accessible, including the scheme. # Example: https://example.com NEXT_PUBLIC_BASE_URL=http://localhost:3000 -NEXTAUTH_URL=$NEXT_PUBLIC_BASE_URL # A connection string to your Postgres database -DATABASE_URL="postgres://postgres:postgres@localhost:5450/rallly" +DATABASE_URL="postgres://postgres:postgres@rallly_db:5450/rallly" # Required to be able to send emails SUPPORT_EMAIL=support@rallly.co diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b6b6d88f1..dad2d983f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,12 +90,11 @@ jobs: - name: Create production build run: yarn turbo build:test --filter=@rallly/web - - name: Generate Prisma Client - run: yarn db:generate + - name: Start services + run: yarn docker:up - - name: Set up database - run: | - yarn dx + - name: Setup database + run: yarn db:deploy - name: Run tests run: yarn test:integration diff --git a/README.md b/README.md index f19a49ea0..a3a068027 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,11 @@ Built with [Next.js](https://github.com/vercel/next.js/), [Prisma](https://githu Check out the [self-hosting docs](https://support.rallly.co/self-hosting) for more information on running your own instance of Rallly. -## Get started +## Local Installation -1. Clone the repository switch to the project directory +The following instructions are for running the project locally for development. + +1. Clone the repository and switch to the project directory ```bash git clone https://github.com/lukevella/rallly.git @@ -41,29 +43,34 @@ Check out the [self-hosting docs](https://support.rallly.co/self-hosting) for mo 3. Setup environment variables + Create a `.env` file by copying `.env.development`. This will be were you can set your [configuration options](https://support.rallly.co/self-hosting/configuration-options). + ```bash - cp sample.env .env + cp .env.development .env ``` - Create a `.env` file by copying `sample.env` then open it and set the required [configuration options](https://support.rallly.co/self-hosting/configuration-options). + **Note:** `.env.development` is preconfigured with default values for development. You can leave these as is for local development. -4. Setup the database +4. Setup database - If you don't have a postgres database running locally, you can spin up a new database using docker by running: + You will need to have [Docker](https://docs.docker.com/get-docker/) installed and running to run the database using the provided docker-compose file. + + To start the database, run: ``` - yarn dx + yarn docker:up ``` - If you already have a postgres database, you can run the migrations and seed the database by running: + Next run the following command to setup the database: ``` - yarn db:setup + yarn db:reset ``` This will: - - run migrations to create the database schema + - delete the existing database (if it exists) + - run migrations to create a new database schema - seed the database with test users and random data 5. Start the Next.js server diff --git a/apps/docs/self-hosting/configuration-options.mdx b/apps/docs/self-hosting/configuration-options.mdx index e8bafd508..e3c8abbfd 100644 --- a/apps/docs/self-hosting/configuration-options.mdx +++ b/apps/docs/self-hosting/configuration-options.mdx @@ -50,9 +50,7 @@ These variables need to be configured to let Rallly send out transactional email This email will be shown as the contact email for support queries. - - The host address of your SMTP server - +The host address of your SMTP server The port of your SMTP server diff --git a/package.json b/package.json index a43667204..cfa8939b9 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "private": true, "version": "3.7.0", "scripts": { - "dx": "run-s docker:up db:setup", "dev": "dotenv -c development -- turbo dev --filter=@rallly/web", "dev:emails": "turbo dev --filter=@rallly/emails", "dev:landing": "dotenv -c development turbo dev --filter=@rallly/landing", @@ -15,10 +14,8 @@ "db:generate": "turbo db:generate", "db:migrate": "prisma migrate dev", "db:reset": "prisma migrate reset", - "db:seed": "yarn workspace @rallly/database db:seed", "docker:up": "docker compose -f docker-compose.dev.yml up -d && wait-on --timeout 60000 tcp:localhost:5450", "docker:down": "docker compose -f docker-compose.dev.yml down --volumes --remove-orphans", - "db:setup": "run-s db:deploy db:generate db:seed", "test:integration": "turbo test:integration", "test:unit": "turbo test:unit", "lint": "turbo lint", diff --git a/sample.env b/sample.env deleted file mode 100644 index 4342974b0..000000000 --- a/sample.env +++ /dev/null @@ -1,33 +0,0 @@ -# REQUIRED CONFIG - -# A random 32-character secret key used to encrypt user sessions -SECRET_PASSWORD= -# The base url where this instance is accessible, including the scheme. -# Example: https://example.com -NEXT_PUBLIC_BASE_URL=http://localhost:3000 -NEXT_PUBLIC_APP_BASE_URL=http://localhost:3000 -# A connection string to your Postgres database -DATABASE_URL= - -# EMAIL CONFIG (required for sending emails) - -# All outgoing emails will show this email as the sender's email address, which also serves as the support email. -SUPPORT_EMAIL= -# The host address of your SMTP server -SMTP_HOST=localhost -# The port of your SMTP server -SMTP_PORT=25 -# Set to "true" if SSL is enabled for your SMTP connection -SMTP_SECURE=false -# The username (if auth is enabled on your SMTP server) -SMTP_USER= -# The password (if auth is enabled on your SMTP server) -SMTP_PWD= - -# OPTIONAL CONFIG - -# Comma separated list of email addresses that are allowed to register and login. -# You can use wildcard syntax to match a range of email addresses. -# Example: "john@example.com,jane@example.com" or "*@example.com" -ALLOWED_EMAILS= - diff --git a/turbo.json b/turbo.json index 208a2f884..d48061c6c 100644 --- a/turbo.json +++ b/turbo.json @@ -28,6 +28,7 @@ "cache": true }, "test:integration": { + "dependsOn": ["@rallly/database#db:generate"], "cache": true }, "db:generate": {