docs/SELF_HOSTING.md
docker and docker-compose-plugin installed. Follow the docker documentation on how to do this.monkeytype) and navigate into it..env file, you can copy the content from the example.env.docker compose up -dBy default, user sign-up and login are disabled. To enable this, you'll need to set up a Firebase project.
Stop the running docker containers using docker compose down before making any changes.
create a Firebase account
create a new Firebase project.
enable authentication
Authentication > Sign-in methodEmail/Password and savewhitelist your domain
Authentication > Sign-in methodAuthorized domainsAdd domain and enter the domain where you’ll host the Monkeytype frontend (e.g. localhost)generate service account
⚙ icon in the sidebar, then Project settingsService accounts tabGenerate new private key to download the .json file.serviceAccountKey.jsondocker-compose.yml and uncomment the volume block in the monkeytype-backend container to mount the Firebase service account:
#uncomment to enable the account system, check the SELF_HOSTING.md file
- type: bind
source: ./serviceAccountKey.json
target: /app/backend/src/credentials/serviceAccountKey.json
read_only: true
update the .env file
⚙ icon on the sidebar and Project settings</> icon)
monkeytypeset up firebase hostingRegister appConfig for SDK setup and configurationconst firebaseConfig = {
apiKey: "AAAAAAAA",
authDomain: "monkeytype-00000.firebaseapp.com",
projectId: "monkeytype-00000",
storageBucket: "monkeytype-00000.appspot.com",
messagingSenderId: "90000000000",
appId: "1:90000000000:web:000000000000"
};
.env file with the values above:
FIREBASE_APIKEY=AAAAAAAA
FIREBASE_AUTHDOMAIN=monkeytype-00000.firebaseapp.com
FIREBASE_PROJECTID=monkeytype-00000
FIREBASE_STORAGEBUCKET=monkeytype-00000.appspot.com
FIREBASE_MESSAGINGSENDERID=90000000000
FIREBASE_APPID=1:90000000000:web:000000000000
backend-configuration.json file and add/modify
{
"users": {
"signUp": true,
"profiles": {
"enabled": true
}
}
}
monkeytype.env file with the site key from the previous step
RECAPTCHA_SITE_KEY="your site key"
RECAPTCHA_SECRET="your secret key"
If you host privately you can use these defaults:
RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
RECAPTCHA_SECRET=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
To enable emails for password reset and email verification update the following config in .env file:
# email server config
# uncomment below if you want to send emails for e.g. password reset
EMAIL_HOST=mail.myserver # your mailserver domain
EMAIL_USER=mailuser # username to authenticate with your mailserver
EMAIL_PASS=mailpass # password for the user
EMAIL_PORT=465 # port, likely 465 or 587
EMAIL_FROM="Support <noreply@myserver>"
To enable daily leaderboards update the backend-configuration.json file and add/modify
{
"dailyLeaderboards": {
"enabled": true,
"maxResults": 250,
"leaderboardExpirationTimeInDays": 1,
"validModeRules": [
{
"language": "english",
"mode": "time",
"mode2": "15"
},
{
"language": "english",
"mode": "time",
"mode2": "60"
}
]
}
}
time or words15,30,60 or 120 if you picked mode=time or 10,25,50 or 100 if you picked mode=words.All settings are described in the example.env file.
Contains your firebase config, only needed if you want to allow users to signup.
Configuration of the backend. Check the default configuration for possible values.
[!NOTE] Configuration changes are applied only on container startup. You must restart the container for your updates to take effect.