Haxxnet / Compose-Examples

Various Docker Compose examples of selfhosted FOSS and proprietary projects.

Home Page:https://haxxnet.github.io/Compose-Examples/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Monkeytype with sign-in

mikesellt opened this issue · comments

First of all, thanks for a great resource! I've used several of your examples in my own homelab, and they work great. I installed Monkeytype today via your compose file within CasaOS, and it worked great. However, I'd like to use the "sign-in" feature (our office has recently become obsessed with who can type fastest, so I'd like to track our own office with monkeytype instead of the leaderboard on the main monkeytype site - hence the self-hosting). When I try to use the sign-in link, it doesn't go anywhere, so I assume that function doesn't work. Most likely there isn't a database and this is just the frontend. I've done some digging online, but can't seem to find anywhere to make this work. I realize this is probably outside the scope of your compose example, but just wondering if you knew. Thanks again.

commented

Hi,

the current problem is that we are not using an official monkeytype Docker image. Instead, we are relying on another Docker Image that just implements the frontend.

https://github.com/TheMythologist/monketype_docker

The official repository lists code for frontend and backend though. So you may be able to dig into the code and build your own Docker image based on the provided compose files and repository data.

Thanks! I'll check that over. I think I saw that page before but wasn't sure if I needed all the firebase and other stuff and I could just deploy the Docker containers. I'll give it a go. Thanks again for the reply and link.

commented

FYI: I am playing currently with this.

I've forked the official repo and added a Dockerfile. It builds the container and pushes it onto Dockerhub.

https://github.com/l4rm4nd/monkeytype

I've also added a docker-compose.yml to the repo. Looks like this:

version: "3.6"

services:

  monkeytype:
    container_name: monkeytype
    image: l4rm4nd/monkeytype:latest
    restart: on-failure
    volumes:
      - /path/to/firebase-config.ts:/app/frontend/src/ts/constants/firebase-config.ts:ro
      - /path/to/.firebaserc:/app/frontend/.firebaserc:ro
    ports:
      - 127.0.0.1:8888:3000
      - 127.0.0.1:5005:5005

  monkeytype-redis:
    container_name: monkeytype-redis
    image: redis:6.2.6-alpine
    restart: on-failure
    expose:
      - 6379
    volumes:
      - ./redis-data:/data

  monkeytype-mongodb:
    container_name: monkeytype-mongodb
    image: mongo:5.0.8
    restart: on-failure
    expose:
      - 27017
    volumes:
      - ./mongo-data:/data/db

The firebase-config.ts config looks like this:

export const firebaseConfig = {
  apiKey: "",
  authDomain: "",
  databaseURL: "mongodb://monkeytype-mongodb:27017",
  projectId: "",
  storageBucket: "",
  messagingSenderId: "",
  appId: "",
};

The .firebaserc config like this:

{
  "projects": {
    "default": "<FIREBASE-PROJECT-ID>"
  }
}

I am currently playing with the firebase setup. You have to create a firebase project and then bind mount the two config files from above filled with your firebase infos into the container.

Currently, you'll get the frontend and backend up and running. Authentication does not work yet as localhost is not allowed on Google etc. Will play around a bit more, maybe getting a full-functioning compose.

That is awesome! Thanks for looking into it. I was able to get the front-end and backend up and running as well (in two separate containers before seeing your comment), but I'm definitely missing the firebase part as well as the environment variable files.