diff --git a/.env.example b/.env.example index 5489133..22723f8 100644 --- a/.env.example +++ b/.env.example @@ -1,10 +1,10 @@ # For SQLServer -DATABASE_URL="sqlserver://localhost:1433;database=HIERR;user=sa;password=;encrypt=DANGER_PLAINTEXT;" +DATABASE_URL="sqlserver://hierr-sql-1:1433;database=HIERR;user=sa;password=;encrypt=DANGER_PLAINTEXT;" # For SQLite # DATABASE_URL="file:./db.sqlite" NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_SECRET=DUMMY -EMAIL_SERVER="smtp://localhost:25" +EMAIL_SERVER="smtp://hierr-smtp-1:25" EMAIL_FROM="test@example.com" NEXT_PUBLIC_POLIS_SURVEYS='[{"id": "yourSurveyID1", "title": "yourSurveyTitle1", "description": "yourSurveyDescription1"}]' NEXT_PUBLIC_SEARCH_API='{your ArcGIS Search Api Key}' diff --git a/compose.yaml b/compose.yaml index 2649f06..e5743dc 100644 --- a/compose.yaml +++ b/compose.yaml @@ -13,3 +13,15 @@ services: - 25:25 environment: - ServerOptions__HostName=smtp4dev + node: + image: debian:12-slim + ports: + - 3000:3000 + stdin_open: true # used to keep container running + tty: true + user: "${UID_GID}" + environment: + HOME: "${USER_HOME}" + volumes: + - ./:/HIERR + - ${USER_HOME}:${USER_HOME} diff --git a/src/README.md b/src/README.md index c7f9893..de70e8b 100644 --- a/src/README.md +++ b/src/README.md @@ -5,14 +5,11 @@ Run these commands to set up and run the project locally for the first time. ```bash git clone https://github.com/CodeforHawaii/HIERR.git cd HIERR -# Use nvm to set the NodeJS version https://github.com/nvm-sh/nvm -nvm use -npm install cp -f .env.example .env # Note: You may have to update the .env file with your specific secret values. # Use docker to set up SQL and SMTP servers locally https://www.docker.com/ # See "SMTP Cloud Server Setup" and "Prisma SQL Server Migration" sections if # wanting to use a different set up. -docker compose up -d +UID_GID="$(id -u):$(id -g)" USER_HOME=$HOME docker compose up -d ``` Next, create database table `HIERR`. Enter the bash shell in the docker image: @@ -41,15 +38,34 @@ Then, you may exit: exit ``` +Prepare the HIERR container: + +```bash +# instal curl in hierr container +docker exec -u 0:0 -it hierr-node-1 bash -c "apt update && apt install -y curl" +# open hierr container and run +docker exec -it hierr-node-1 bash +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash +exit +docker exec -it hierr-node-1 bash +cd /HIERR +nvm install +nvm use +npm install +``` + Finally, run the DB migration scripts and run the dev server: ```bash +# still inside the HIERR container... npx prisma migrate dev npx prisma db push # Run dev server on http://localhost:3000 npm run dev ``` +You can now access HIERR from http://localhost:3000 + The SMTP email web interface is available at http://localhost:3001. # Update Prisma