diff --git a/.env.example b/.env.example new file mode 100644 index 0000000000..fa03747963 --- /dev/null +++ b/.env.example @@ -0,0 +1,9 @@ +# Modify this variables according to your setup and needs +SECRET=RANDOM_STRING +DATABASE_URL='postgresql://user@localhost:5432/snoopforms?schema=public' +NEXTAUTH_URL=http://localhost:3000 +ADMIN_EMAIL=user@example.com +ADMIN_PASSWORD='admin123' + +# For Docker Setup use this Database URL: +# DATABASE_URL='postgresql://postgres:postgres@postgres:5432/snoopforms?schema=public' diff --git a/.env.local.example b/.env.local.example deleted file mode 100644 index 6acd2d45fd..0000000000 --- a/.env.local.example +++ /dev/null @@ -1,5 +0,0 @@ -SECRET=RANDOM_STRING -DATABASE_URL='postgresql://user@localhost:5432/snoopforms?schema=public' -NEXTAUTH_URL=http://localhost:3000 -ADMIN_EMAIL=user@example.com -ADMIN_PASSWORD='admin123' diff --git a/.gitignore b/.gitignore index 7d093c39ff..22813e7c4a 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ yarn-error.log* .pnpm-debug.log* # local env files +.env .env.local .env.development.local .env.test.local diff --git a/README.md b/README.md index 3d485de4df..7f1c5677c6 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Spin up forms in minutes. Pipe your data exactly where you need it. Maximize you To get the project running locally on your machine you need to have the following development tools installed: -- Node.JS +- Node.JS (we recommend v16) - Yarn - PostgreSQL @@ -63,22 +63,32 @@ git clone https://github.com/snoopForms/snoopforms.git && cd snoopforms yarn install ``` -3. Create a `.env.local` file based on `.env.local.example` and change it according to your setup. Make sure the `DATABASE_URL` variable is set correctly according to your local database. You must also set the email variables to valid SMTP-credentials for the login to work. +1. Create a `.env` file based on `.env.example` and change it according to your setup. Make sure the `DATABASE_URL` variable is set correctly according to your local database. You must also set the email variables to valid SMTP-credentials for the login to work. + +```` +cp .env.example .env +``` +Use an editor of your choice to edit the file (we use nano): +```` + +nano .env -``` -cp .env.local.example .env.local && nano .env.local ``` -4. Let prisma set up the database for you: +1. Make sure your PostgreSQL Database Server is running. Then let prisma set up the database for you: ``` + npx prisma db push + ``` 5. Start the development server: ``` + yarn dev + ``` You can now access the app on [https://localhost:3000](https://localhost:3000) @@ -90,19 +100,25 @@ The easiest way to deploy snoopForms yourself on your own machine is using Docke Clone the repository: ``` + git clone https://github.com/snoopForms/snoopforms.git && cd snoopforms -``` - -Create a `.env.local` file based on `.env.local.example` and change it according to your setup. You must set the email variables to valid SMTP-credentials for the login to work: ``` -cp .env.local.example .env.local && nano .env.local + +Create a `.env` file based on `.env.example` and change it according to your setup. You must set the email variables to valid SMTP-credentials for the login to work: + +``` + +cp .env.example .env && nano .env + ``` Start the docker-compose process to build and spin up the snoopForms container as well as the postgres database. ``` + docker-compose up -d + ``` You can now access the app on [https://localhost:3000](https://localhost:3000) @@ -121,3 +137,4 @@ Contributions are what make the open source community such an amazing place to b ## License Distributed under the AGPLv3 License. See `LICENSE` for more information. +``` diff --git a/docker-compose.yml b/docker-compose.yml index 41693b1004..048eb2ef44 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: ports: - 3000:3000 env_file: - - .env.local + - .env volumes: postgres: