Skip to content

Commit

Permalink
Merge pull request #192 from Vincit/release/summer-2024
Browse files Browse the repository at this point in the history
Release/summer 2024
  • Loading branch information
villepynttari authored Aug 26, 2024
2 parents 48c4ecd + 8642618 commit c426675
Show file tree
Hide file tree
Showing 17 changed files with 498 additions and 247 deletions.
30 changes: 30 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Docker compose env

MONGO_LOCAL_PORT=27017
BACKEND_LOCAL_PORT=8080
FRONTEND_LOCAL_PORT=3000
VITE_BACKEND_URL=http://backend:8080

# MongoDB Environment
MONGO_INITDB_DATABASE=getaroom
MONGO_INITDB_ROOT_USERNAME=root
MONGO_INITDB_ROOT_PASSWORD=testroot
MONGO_EXPRESS_USERNAME=admin
MONGO_EXPRESS_PASSWORD=testadmin

DB_OVERRIDE_URL=mongodb://getaroom:getaroom@mongodb/getaroom?retryWrites=true&w=majority
ME_CONFIG_MONGODB_URL=mongo://root:testroot@mongodb

# Secret for JWT token, could be any long random string
JWT_SECRET="foobarbaz123foobarbaz123foobarbaz123foobarbaz123"

# Client ID is found here: (https://console.cloud.google.com/apis/credentials?project=get-a-room-326217), go to "OAuth 2.0 Client IDs" -> "Get A Room!" -> "Client ID"
GOOGLE_CLIENT_ID=""

# Client secret is found here: (https://console.cloud.google.com/apis/credentials?project=get-a-room-326217), go to "OAuth 2.0 Client IDs" -> "Get A Room!" -> "Client secret"
GOOGLE_CLIENT_SECRET=""

# Google Customer ID is found here: (https://admin.google.com/ac/accountsettings/profile)
GOOGLE_CUSTOMER_ID=""

TZ=Etc/UTC
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ yarn-error.log*
.env
*.iml
.idea
.vapidkey
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,36 @@ After this you probably want to point some domain to this application. This can
As a last thing, new OAuth 2.0 Client should be created in Google Cloud -> "APIs and services" -> "CREATE CREDENTIALS" -> "OAuth Client ID". Application type is "Web Application". Authorized JavaScript origins can be left empty. And to the "Authorised redirect URIs" this URL should be added: "https://yourdomainname.com/api/auth/google/callback" And of course remember to replace "yourdomainname" with the new domain name that was reserved for this application.

Now you should have a working GitHub actions deployment and a new environment!

## Running local dev environment

<br/>

### Docker compose

1. Copy .env.example files to .env files in
/
/frontend
/backend
2. Edit root env file and add GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET and GOOGLE_CUSTOMER_ID values
3. Run docker compose build && docker compose up -d

<br/>

### Npm

MongoDb needed

1. Copy .env.example files to .env files in
/frontend
/backend
2. Run npm install
3. Run npm run generate_vapid_keys
4. Copy VAPID keys from logged output to backend and frontend .env files
5. Add GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET and GOOGLE_CUSTOMER_ID and database setting to .env-files
6. Run npm run nodemon in /backend folder
7. Run npm run start in /frontend folder

<br/>

After frontend startup go to /login page and log in with valid OAuth-user.
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use the official lightweight Node.js 12 image.
# https://hub.docker.com/_/node
FROM node:16-slim
FROM node:20

# Create and change to the app directory.
WORKDIR /usr/src/app
Expand Down
Loading

0 comments on commit c426675

Please sign in to comment.