From 6bdefcd1e5758a804fa12f67a69c0b29e7b130fa Mon Sep 17 00:00:00 2001 From: Francis Anthony Date: Tue, 10 Sep 2024 14:05:24 +0800 Subject: [PATCH] Add install instructions fixes #126 --- ENV_TEMPLATE.md | 90 +++++++++++++++++++++++++++++++++++++++++++++++++ SETUP.md | 30 +++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 ENV_TEMPLATE.md create mode 100644 SETUP.md diff --git a/ENV_TEMPLATE.md b/ENV_TEMPLATE.md new file mode 100644 index 0000000..f4353b9 --- /dev/null +++ b/ENV_TEMPLATE.md @@ -0,0 +1,90 @@ +## How to use + +1. Create a new `.env` file +2. Paste the contents from the `Environment variables` section below +3. Edit the required values + +## Environment variables + +``` +DATABASE_URL="postgresql://forent:password@localhost:5432/forent?schema=public" + +# Read more at https://next-auth.js.org/configuration/options#nextauth_secret +NEXTAUTH_SECRET= +NEXTAUTH_URL="http://localhost:3000" + +# Read more at https://next-auth.js.org/providers/email +EMAIL_SERVER_HOST= +EMAIL_SERVER_PORT= +EMAIL_SERVER_USER= +EMAIL_SERVER_PASSWORD= +EMAIL_FROM= + +# Read more at +# https://next-auth.js.org/providers/google +# https://developers.google.com/identity/protocols/oauth2 +GOOGLE_CLIENT_ID= +GOOGLE_CLIENT_SECRET= +GOOGLE_REFRESH_TOKEN= + +# (Optional) +# Read more at https://www.chromatic.com/docs/cli/ +CHROMATIC_PROJECT_TOKEN= + + +## NOTICE +# The values below can be left as-is. +# However, you can edit any of them to customize this application's behavior. +## NOTICE + + +# Reverse geocoding +GEOCODE_URL_GEONAMES="http://api.3geonames.org/lat,lon.json" + +# Listing image dimensions +LISTING_CARD_PHOTO_WIDTH=300 +LISTING_CARD_PHOTO_HEIGHT=300 + +LISTING_COVER_PHOTO_WIDTH=800 +LISTING_COVER_PHOTO_HEIGHT=600 + +LISTING_FULL_PHOTO_WIDTH=1600 +LISTING_FULL_PHOTO_HEIGHT=900 + +# Listing min-max values +LISTING_PRICE_MIN=100 +LISTING_PRICE_MAX=100_000_000 + +LISTING_DEPOSIT_MIN=0 +LISTING_DEPOSIT_MAX=1_000_000 + +LISTING_DESC_MIN=16 +LISTING_DESC_MAX=1024 + +LISTING_BEDS_MIN=1 +LISTING_BEDS_MAX=750 + +LISTING_BATHS_MIN=1 +LISTING_BATHS_MAX=250 + +LISTING_AREA_MIN=10 +LISTING_AREA_MAX=1_000_000 + +LISTING_ADDRESS_LINE_MIN=1 +LISTING_ADDRESS_LINE_MAX=128 + +LISTING_ADDRESS_CITY_MIN=1 +LISTING_ADDRESS_CITY_MAX=64 + +LISTING_ADDRESS_STATE_MIN=1 +LISTING_ADDRESS_STATE_MAX=64 + +LISTING_ADDRESS_ZIP_MIN=0 +LISTING_ADDRESS_ZIP_MAX=64 + +LISTING_ADDRESS_LON_MIN=-180 +LISTING_ADDRESS_LON_MAX=180 + +LISTING_ADDRESS_LAT_MIN=-90 +LISTING_ADDRESS_LAT_MAX=90 +``` \ No newline at end of file diff --git a/SETUP.md b/SETUP.md new file mode 100644 index 0000000..0533c97 --- /dev/null +++ b/SETUP.md @@ -0,0 +1,30 @@ +## Requirement + +1. Running PostgreSQL server + +## Steps + +1. Install packages `npm ci` +2. Build the application `npm build` +3. Start the server in production mode `npm start` + +Alternatives are listed in the [official Next.js docs](https://nextjs.org/docs/app/building-your-application/deploying) + +## Docker + +Docker is not compatible with this project since Prisma, the database client, is encountering this error. + +``` +21.88 error: Environment variable not found: DATABASE_URL. +21.88 --> schema.prisma:8 +21.88 | +21.88 7 | provider = "postgresql" +21.88 8 | url = env("DATABASE_URL") +21.88 | +``` + +I have tried the following yet the same error persists: + +1. [`docker compose run -e`](https://docs.docker.com/compose/environment-variables/set-environment-variables/#set-environment-variables-with-docker-compose-run---env) +2. [`env_file`](https://docs.docker.com/compose/environment-variables/set-environment-variables/#use-the-env_file-attribute) +3. [`environment`](https://docs.docker.com/compose/environment-variables/set-environment-variables/#use-the-env_file-attribute)