Skip to content

LucasPickering/beta-spray

Repository files navigation

Beta Spray

A website designed to plan and share bouldering beta. Available at betaspray.net! Try it out, let me know what you think.

Annotated boulder

Development

Run the stack with:

docker-compose up

Local Dependencies

While not necessary for development, it's helpful to install dependencies outside of Docker so your editor can access them and do typechecking/autocomplete.

API

Requires pyenv and poetry.

cd api
pyenv install
poetry install # Installs dependencies to api/.venv/

Auth

If you want to enable Google logins, you'll need to add Google OAuth client creds:

  1. Go here
    1. If you don't have access to the Google Project, sorry :/
  2. Click Create Credentials > OAuth client ID
    1. Application type = Web application
    2. Name = Something descriptive
    3. Authorized JavaScript origins = http://localhost:3000
    4. Authorized redirect URIs = http://localhost:3000/api/social/complete/google-oauth2/
    5. Save
  3. In the repo:
    1. cp example.env .env
    2. Copy in the client ID and secret

UI

Requires nvm.

cd ui
nvm install
nvm use
npm install

Debugging

The API container will automatically start debugpy and expose it on port 8001. There is already a VSCode debug config defined to attach to this (called Attach to Django). This should allow you to breakpoint and debug code from within VSCode. If you've installed dependencies locally (using steps above), VSCode should automatically load them and they should match the path layout used inside the container, meaning you can breakpoint dependency code as well.

If you want to breakpoint something that runs during startup, you can attach the debugger, then trigger a reload by saving any file. The debugger should remain attached through the reload and hit any breakpoints in startup code.

Migrations

If you make model changes, you can generate/apply migrations with:

api/m.sh makemigrations
api/m.sh migrate

https://docs.djangoproject.com/en/4.0/topics/migrations/

Production

Deployed via Kubernetes on the Keskne cluster. Deployment is run automatically on merge to master via this CI job into two environments:

Environment Namespace Domain When
Development beta-spray-dev dev.betaspray.net Manually
Production beta-spray betaspray.net Push to master

See the deployment-specific README for more info.