You can quickly start with pre-built docker image.
docker pull ghcr.io/nownabe/mclauncher:latestYou can run mclauncher on Cloud Run by clicking this button.
- You should add
roles/compute.instanceAdmin.v1for your Minecraft server instance to the service account used for the Cloud Run service. If you want to minimize permissions, you can create your own custom role. - Firestore and Firebase Authentication must be initialized. For now, mclauncher supports only Google provider for Firebase Authentication.
Environment variables:
PORT(required)INSTANCE_ZONE(required)INSTANCE_NAME(required)SHUTTER_AUTHORIZED_EMAIL(required) - email of service account which calls/shutter.FIREBASE_CREDENTIALS_JSON(required) - used for Firebase Authentication and Firestore.FIREBASE_CONFIG_JSON(required)TITLE(optional) - default ismclauncher.WEB_CONCURRENCY(optional) - default is4.SHUTTER_COUNT_TO_SHUTDOWN(optional) - If the count of consecutive vacant of the server counted by/shutterexceeds this count,/shuttershuts down the instance.
Install dependencies with poetry.
poetry installRun Firestore emulator.
firebase emulators:startSet environment variables.
export FIREBASE_CONFIG_JSON='{"apiKey":"...", ...}'
export FIREBASE_CREDENTIALS_JSON="$(cat firebase.credentials.json)"
export FIRESTORE_EMULATOR_HOST="localhost:8080"
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/gcpproject.credentials.json"
export INSTANCE_ZONE="asia-northeast1-a"
export INSTANCE_NAME="minecraft-instance"
export SHUTTER_AUTHORIZED_EMAIL="mclauncher@example.com"If you haven't added your email as an authorized user, run tools/add_authorized_users.py.
poetry run python tools/add_authorized_users.py you@example.comRun the development server.
poetry run uvicorn main:app --reloadOr you can run and debug with Ctrl + Shift + D.
You can forward ports. See the detail: Forwarding ports in your codespace - GitHub Docs.
Test.
poetry run pytest