geohub
geohub copied to clipboard
[enhancement] Docker: Add docker support w Dockerfile & docker-compose
Closes #11
Adding docker support with a Dockerfile and a docker-compose.
I noticed that, in the self hosted version, the default maps were not present. If this is expected behavior then this should do the work. If not, please let me know.
Also, could you please confirm that no content is stored outside of the database. If this is at any point the case, please inform me before so that I can map any folder to a docker volume, as if it is not done all data would be lost between restarts.
Other than that, great work, this project is very nice and I am happy to help
@Paillat-dev is attempting to deploy a commit to the GeoHub Team on Vercel.
A member of the Team first needs to authorize it.
Thanks for taking this on. You are correct that the default maps are not present if you run the app locally (you would need to manually create the maps/locations) maybe this could be automated somewhere in the Docker build step to add the maps in Mongo (but not required).
I do not believe there is any other content stored outside the database, no.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
geohub | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 10, 2024 8:32pm |
Then this is it. Just fyi this will build the image with a github action on every pr and every time someone pushes on main, allowing to update the image, and check on prs that nothing breaks.
I'm trying to host Geohub with Docker Compose, and it doesn't seem to be working.
➜ geohub git:(main) ✗ sudo docker compose up
[+] Running 2/2
✘ mongo Error context canceled 0.5s
✘ geohub Error Head "https://ghcr.io/v2/benlikescode/geohub/manifests/main": denied 0.5s
Error response from daemon: Head "https://ghcr.io/v2/benlikescode/geohub/manifests/main": denied
➜ geohub git:(main) ✗
I can't find any successful runs of the docker-publish Actions workflow added in this PR, so maybe that's the cause for the ghcr request being denied?
@ninjadev64 I just saw... the action is disabled (apparently) in this repo for some reason. In the mean time you can edit the file called docker-compose.yaml
and replace
image: ghcr.io/benlikescode/geohub:main
with
build:
context: .
@benlikescode Do you think that you could enable GitHub Actions or should I open another pr to change to local build?
@Paillat-dev After making that change, this is the new output:
➜ geohub git:(main) ✗ sudo docker compose up
[+] Running 9/9
✔ mongo Pulled 14.9s
✔ 9b10a938e284 Pull complete 1.4s
✔ 6f33a3006c47 Pull complete 0.5s
✔ eedf0c2fd077 Pull complete 0.6s
✔ 00f46cd936f6 Pull complete 1.3s
✔ 42ec972210ed Pull complete 1.2s
✔ 18ba95ff848c Pull complete 1.7s
✔ 1ce226859782 Pull complete 8.8s
✔ d2b269042667 Pull complete 1.8s
[+] Building 271.9s (10/10) FINISHED docker:default
=> [geohub internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 203B 0.0s
=> [geohub internal] load metadata for docker.io/library/node:14 1.5s
=> [geohub internal] load .dockerignore 0.1s
=> => transferring context: 70B 0.0s
=> [geohub internal] load build context 12.4s
=> => transferring context: 127.37MB 12.3s
=> [geohub 1/6] FROM docker.io/library/node:14@sha256:a158d3b9b4e3fa813fa6c8c590b8f0a860e015ad4e59bbce5744d2f6fd8461aa 62.3s
=> => resolve docker.io/library/node:14@sha256:a158d3b9b4e3fa813fa6c8c590b8f0a860e015ad4e59bbce5744d2f6fd8461aa 0.1s
=> => sha256:9aa52bf2f9f6d46c4f06b61f50c214ed4e3e3626c5d9c9c88eeb00e4f86dc3f9 2.21kB / 2.21kB 0.0s
=> => sha256:a158d3b9b4e3fa813fa6c8c590b8f0a860e015ad4e59bbce5744d2f6fd8461aa 776B / 776B 0.0s
=> => sha256:b6e1f9016a807bec65d61745a2510b8c4b3e7a157d13c7e18a8b6b64742a511c 7.53kB / 7.53kB 0.0s
=> => sha256:b4910c31031a0301ea4f8b7155269014925aeb17c71b869dea3ff907ba294b55 49.24MB / 49.24MB 11.2s
=> => sha256:208fd617b499747daceba851b67da426c285d1e306b316a193f06968123f49da 7.73MB / 7.73MB 8.9s
=> => sha256:1efadebfda1423d1b70a0e991e9ff8bb2e3fe0b08d55562359a004c265fc7c86 10.00MB / 10.00MB 10.4s
=> => extracting sha256:b4910c31031a0301ea4f8b7155269014925aeb17c71b869dea3ff907ba294b55 2.4s
=> => sha256:efe7e7c438113f5e58417f97e7eb0a755b17ee63eebd85a7c3b86a2aad4c993e 52.19MB / 52.19MB 18.1s
=> => sha256:33997ebd7335eb6f55d98725b5fb8e4899166098d6db119cd6f6bc7055ffa858 183.44MB / 183.44MB 24.7s
=> => sha256:67501d6724b266c5e1bbbcc9dc82898e05969e6d368cfd4c6893fcb8e7a3fd9c 4.20kB / 4.20kB 12.0s
=> => sha256:852f2ac51586a06d124a05565f98697df6e9644403dcc71fc6c765201bcb05a1 35.36MB / 35.36MB 16.1s
=> => extracting sha256:208fd617b499747daceba851b67da426c285d1e306b316a193f06968123f49da 0.2s
=> => extracting sha256:1efadebfda1423d1b70a0e991e9ff8bb2e3fe0b08d55562359a004c265fc7c86 0.2ss
=> => sha256:b481e8e2da867a2e73bcc8f78b7cca9faa71a5ebf45ad5bb6fdb10a8ddc87ae5 2.29MB / 2.29MB 16.5s
=> => sha256:d3d53ad8b21a68bf7d0a2f5356eed25705b948632b3d9f3b5638558ead638119 451B / 451B 16.7s
=> => extracting sha256:efe7e7c438113f5e58417f97e7eb0a755b17ee63eebd85a7c3b86a2aad4c993e 6.9s
=> => extracting sha256:33997ebd7335eb6f55d98725b5fb8e4899166098d6db119cd6f6bc7055ffa858 16.7s
=> => extracting sha256:67501d6724b266c5e1bbbcc9dc82898e05969e6d368cfd4c6893fcb8e7a3fd9c 0.0s
=> => extracting sha256:852f2ac51586a06d124a05565f98697df6e9644403dcc71fc6c765201bcb05a1 12.1s
=> => extracting sha256:b481e8e2da867a2e73bcc8f78b7cca9faa71a5ebf45ad5bb6fdb10a8ddc87ae5 0.1s
=> => extracting sha256:d3d53ad8b21a68bf7d0a2f5356eed25705b948632b3d9f3b5638558ead638119 0.0s
=> [geohub 2/6] WORKDIR /usr/src/app 5.5s
=> [geohub 3/6] COPY package.json yarn.lock ./ 0.4s
=> [geohub 4/6] RUN yarn install --frozen-lockfile 83.6s
=> [geohub 5/6] COPY . . 6.3s
=> ERROR [geohub 6/6] RUN yarn build 25.9s
------
> [geohub 6/6] RUN yarn build:
0.546 yarn run v1.22.19
0.582 $ next build
0.932 info - Loaded env from /usr/src/app/.env
1.218 Attention: Next.js now collects completely anonymous telemetry regarding usage.
1.218 This information is used to shape Next.js' roadmap and prioritize features.
1.218 You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
1.218 https://nextjs.org/telemetry
1.218
1.359 info - Linting and checking validity of types...
12.27
12.27 ./pages/challenge/[id].tsx
12.27 80:6 Warning: React Hook useEffect has missing dependencies: 'fetchChallenge' and 'view'. Either include them or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/create-map/[mapId].tsx
12.27 64:6 Warning: React Hook useEffect has a missing dependency: 'getMapDetails'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 74:6 Warning: React Hook useEffect has a missing dependency: 'loadNewPano'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/game/[id].tsx
12.27 55:6 Warning: React Hook useEffect has a missing dependency: 'fetchGame'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 61:6 Warning: React Hook useEffect has a missing dependency: 'prevGameId'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/login.tsx
12.27 39:6 Warning: React Hook useEffect has missing dependencies: 'dispatch' and 'router'. Either include them or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/map/[id]/index.tsx
12.27 38:6 Warning: React Hook useEffect has missing dependencies: 'fetchMapDetails', 'fetchMapScores', and 'fetchOtherMaps'. Either include them or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/maps/index.tsx
12.27 47:6 Warning: React Hook useEffect has a missing dependency: 'getOfficialMaps'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 51:6 Warning: React Hook useEffect has a missing dependency: 'getCommunityMaps'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/ongoing/index.tsx
12.27 40:6 Warning: React Hook useEffect has missing dependencies: 'fetchGames' and 'user.id'. Either include them or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/register.tsx
12.27 27:6 Warning: React Hook useEffect has a missing dependency: 'router'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/results/[id].tsx
12.27 53:6 Warning: React Hook useEffect has a missing dependency: 'fetchGame'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/results/challenge/[id].tsx
12.27 65:6 Warning: React Hook useEffect has a missing dependency: 'fetchGames'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 69:6 Warning: React Hook useEffect has a missing dependency: 'getDefaultGameToShow'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./pages/user/[id].tsx
12.27 59:6 Warning: React Hook useEffect has a missing dependency: 'getUserDetails'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 73:6 Warning: React Hook useEffect has missing dependencies: 'getUserGames', 'getUserMaps', 'getUserStats', 'userGames', 'userMaps', and 'userStats'. Either include them or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/ChallengeStart/ChallengeStart.tsx
12.27 38:6 Warning: React Hook useEffect has a missing dependency: 'user.id'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/GameStatus/GameStatus.tsx
12.27 31:6 Warning: React Hook useEffect has a missing dependency: 'handleSubmitGuess'. Either include it or remove the dependency array. If 'handleSubmitGuess' changes too often, find the parent component that defines it and wrap that definition in useCallback. react-hooks/exhaustive-deps
12.27
12.27 ./components/GoogleMapsSearch/GoogleMapsSearch.tsx
12.27 63:6 Warning: React Hook useEffect has a missing dependency: 'handleSearch'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/GuessMap/GuessMap.tsx
12.27 57:6 Warning: React Hook useEffect has a missing dependency: 'handleSetupMap'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 61:6 Warning: React Hook useEffect has a missing dependency: 'handleResetMapState'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/SelectionMap/SelectionMap.tsx
12.27 39:6 Warning: React Hook useEffect has a missing dependency: 'handleSetupSelectionMap'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 43:6 Warning: React Hook useEffect has a missing dependency: 'handleLocationChange'. Either include it or remove the dependency array. Mutable values like 'deckRef.current' aren't valid dependencies because mutating them doesn't re-render the component. react-hooks/exhaustive-deps
12.27
12.27 ./components/StreakCountryList/StreakCountryList.tsx
12.27 40:6 Warning: React Hook useEffect has a missing dependency: 'getFormattedRounds'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 49:13 Warning: Do not use <img>. Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element. @next/next/no-img-element
12.27
12.27 ./components/StreaksGuessMap/StreaksGuessMap.tsx
12.27 60:6 Warning: React Hook useEffect has a missing dependency: 'handleSetupMap'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 64:6 Warning: React Hook useEffect has a missing dependency: 'handleResetMapState'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/StreetView/StreetView.tsx
12.27 50:6 Warning: React Hook useEffect has missing dependencies: 'checkForQuotaExceeded' and 'initializeStreetView'. Either include them or remove the dependency array. react-hooks/exhaustive-deps
12.27 57:6 Warning: React Hook useEffect has a missing dependency: 'loadNewPano'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 193:6 Warning: React Hook useEffect has a missing dependency: 'handleBackToStartKeys'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 220:6 Warning: React Hook useEffect has missing dependencies: 'handleUndoLastMoveKeys' and 'view'. Either include them or remove the dependency array. react-hooks/exhaustive-deps
12.27 238:6 Warning: React Hook useEffect has a missing dependency: 'handleSubmitGuessKeys'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27 263:6 Warning: React Hook useEffect has a missing dependency: 'handleMovingArrowKeys'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/layout/Sidebar/Sidebar.tsx
12.27 29:6 Warning: React Hook useEffect has a missing dependency: 'getRecentMaps'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/modals/DailyQuotaModal/DailyQuotaModal.tsx
12.27 26:6 Warning: React Hook useEffect has a missing dependency: 'closeModal'. Either include it or remove the dependency array. If 'closeModal' changes too often, find the parent component that defines it and wrap that definition in useCallback. react-hooks/exhaustive-deps
12.27
12.27 ./components/modals/GameSettingsModal/Challenge/Challenge.tsx
12.27 32:6 Warning: React Hook useEffect has a missing dependency: 'generateUrl'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/resultCards/StandardFinalResults/StandardFinalResults.tsx
12.27 36:6 Warning: React Hook useEffect has a missing dependency: 'handleKeyDown'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/resultCards/StandardResults/StandardResults.tsx
12.27 32:6 Warning: React Hook useEffect has a missing dependency: 'handleKeyDown'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/resultCards/StreakContinueCard/StreakContinueCard.tsx
12.27 28:6 Warning: React Hook useEffect has a missing dependency: 'handleKeyDown'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/resultCards/StreakEndedCard/StreakEndedCard.tsx
12.27 46:6 Warning: React Hook useEffect has a missing dependency: 'handleKeyDown'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/system/Modal/Modal.tsx
12.27 45:8 Warning: React Hook useEffect has a missing dependency: 'modalRef'. Either include it or remove the dependency array. Mutable values like 'modalRef.current' aren't valid dependencies because mutating them doesn't re-render the component. react-hooks/exhaustive-deps
12.27 61:8 Warning: React Hook useEffect has a missing dependency: 'handleKeyDown'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 ./components/system/ProgressBar/ProgressBar.tsx
12.27 17:6 Warning: React Hook useEffect has a missing dependency: 'progress'. Either include it or remove the dependency array. If 'setCurrProgress' needs the current value of 'progress', you can also switch to useReducer instead of useState and read 'progress' in the reducer. react-hooks/exhaustive-deps
12.27
12.27 ./components/system/Searchbar/Searchbar.tsx
12.27 92:6 Warning: React Hook useEffect has a missing dependency: 'handleKeyDown'. Either include it or remove the dependency array. react-hooks/exhaustive-deps
12.27
12.27 info - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
23.29 info - Creating an optimized production build...
23.83 <jemalloc>: Unsupported system page size
23.83 <jemalloc>: Unsupported system page size
23.83 memory allocation of 10 bytes failed
25.49 Aborted (core dumped)
25.50 error Command failed with exit code 134.
25.50 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
failed to solve: process "/bin/sh -c yarn build" did not complete successfully: exit code: 134
➜ geohub git:(main) ✗
@ninjadev64 Can you try going back to the previous setup, but edit it to use the image from my fork in the mean time ghcr.io/paillat-dev/geohub:main
I think I solved it by changing my Pi's /boot/firmware/config.txt
to include kernel=kernel8.img
.
Good, let me know if anything doesn't work out.
@Paillat-dev Didn't realize actions were disabled. I will enable them right now. Is that all that is needed on my end to get it working?
Good, let me know if anything doesn't work out.
Just the problem with the maps not being included, do you know how to download them?
@benlikescode You might have to push a placeholder commit just to trigger the first build but otherwise that's it
Just the problem with the maps not being included, do you know how to download them?
I knew they weren't included but I have no idea on how they could be added as I have limited knowledge in this project's structure
Just the problem with the maps not being included, do you know how to download them?
This is expected behavior for now. You have to add your own maps. What I may do in the future is set it up with 100 or so locations per map, I just don't want all the locations publicly viewable.
You have to add your own maps. What I may do in the future is set it up with 100 or so locations per map, I just don't want all the locations publicly viewable.
For context, I'm self-hosting because geohub.gg is blocked in my school. Surely asking users to create their own maps from scratch is a huge ask? And realistically, what are the motives for cheating on geohub.gg? (and how would you feasibly go about cheating having been given access to the data, anyway?)