Skip to content

Commit

Permalink
Merge pull request #35 from s0er3n/self_hosting
Browse files Browse the repository at this point in the history
feat: improve selfhosting
  • Loading branch information
s0er3n authored Jan 21, 2024
2 parents 0928b5a + 5c214ab commit c1c1d0b
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 34 deletions.
22 changes: 15 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# only necessary for setup with supabase
# twitch bot
# domain for the bot message
#domain=https://geobingo.io
#name=TwitchUser3000____
#VITE_DOMAIN=8000
#domain=https://geobingo.io //domain for the bot message
#token=oauth:asdsdasldaksd123988jl12j3123g12
#supabasekey=eyASdJKASdj // should have service role
#supabaseurl=https://asdsdasldaksd123988jl12j3123g12.supabase.co
#jwtpriv=sdalsjd-123hjla-asdjasd-asdlasdj-asd // jwt secret from supabase to validate tokens
#token=oauth:XXX
# user login and saving words
#supabasekey= // should have service role
#supabaseurl=
# jwt secret from supabase to validate tokens
#jwtpriv=
# needed for restricting countries
#bigdatacloudkey=
#VITE_GMAPSAPI=
# Make sure to use the anon key
#VITE_SUPABASE_KEY=
#VITE_SUPABASE_URL=
2 changes: 2 additions & 0 deletions Backend/src/helpers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export const addWordToDB = async (word: { word: string; tags: string[] }) => {
const LANGUAGES = ["en", "nl", "es", "de", "fr", "pt", "pl", "id"]

export const backUpDBAndTranslate = async (words: { word: { word: string | { [lng: string]: string } } }[]) => {
// FIXME: only translate with api key
return
if (!supabaseProvided) return
// console.log(words)
const langWords = words.map(async word => {
Expand Down
2 changes: 1 addition & 1 deletion Frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:17.7.2-bullseye as builder
FROM node:20 as builder


# Create app directory
Expand Down
9 changes: 0 additions & 9 deletions Frontend/src/lib/components/DonationPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@
title="soerenmichaels"
/>
<div class="card-body">
<h2 class="card-title text-xs">Help me keep the site alive.</h2>
<p class="text-xs">
Since the recent rise in users, I cannot justify paying for the Google
Maps API on my own anymore and I will have to put the site offline if
the usage keeps being this high. Please consider donating on <a
class="text-blue-400"
href="https://ko-fi.com/soerenmichaels">Ko-fi.com/soerenmichaels</a
>. <br /><br /> Have fun playing, <br /> Sören
</p>
<div class="card-actions flex justify-between">
<button on:click={() => (donation = false)} class="btn btn-primary"
>go to lobby</button
Expand Down
11 changes: 3 additions & 8 deletions Frontend/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
debug "^3.1.0"
lodash.once "^4.1.1"

"@esbuild/darwin-arm64@0.18.15":
"@esbuild/linux-x64@0.18.15":
version "0.18.15"
resolved "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.15.tgz"
integrity sha512-XmrFwEOYauKte9QjS6hz60FpOCnw4zaPAb7XV7O4lx1r39XjJhTN7ZpXqJh4sN6q60zbP6QwAVVA8N/wUyBH/w==
resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.15.tgz"
integrity sha512-MsHtX0NgvRHsoOtYkuxyk4Vkmvk3PLRWfA4okK7c+6dT0Fu4SUqXAr9y4Q3d8vUf1VWWb6YutpL4XNe400iQ1g==

"@eslint-community/eslint-utils@^4.2.0":
version "4.4.0"
Expand Down Expand Up @@ -1884,11 +1884,6 @@ fs.realpath@^1.0.0:
resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==

fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

function-bind@^1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz"
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@ an open source multiplayer street view bingo game
my discord tag: **.soeren**

**You want to contribute? See this [issue here](https://github.com/s0er3n/GeoBingo.io/issues/1)**
# Self hosting with docker-compose

1. Set the Environment Variables from .env.example (only VITE_GMAPSAPI is needed for the base game)

# ⚡ How to run it yourself
- install node 16.5
2. run `docker-compose up --build`

3. the game should be running on port 3000


# ⚡ How to run it yourself for development
- install node 20

- clone repository

Expand Down
12 changes: 5 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@ services:
- token
- domain
- supabasekey
2342342 14319287349213479283477747893217490827439217 83490856902183466573281900szzgbn

- supabaseurl
- jwtpriv
ports:
- "8000:8000"
- bigdatacloudkey
build: ./Backend
frontend:
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
environment:
- branch
- VITE_DOMAIN
- VITE_SUPABASE_URL
- VITE_SUPABASE_KEY
ports:
- "80:80"
- "3000:3000"
# - "80:80"
- "3000:80"
build:
context: ./Frontend
args:
Expand Down
27 changes: 27 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
server {
listen 80;
listen [::]:80;
server_name localhost;


location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}


location /socket.io/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://backend:8000/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

0 comments on commit c1c1d0b

Please sign in to comment.