pppy/osu-web

Sponsored OSS

By ppy Pty Ltd

Updated about 9 hours ago

the browser-facing portion of osu!

Image
Content Management System
Web Servers

10K+

osu!web

TestsLintCrowdindev chat

The browser-facing portion of osu!.

Getting Started

This image supports only non-development deployments of osu!web (eg. staging/production). For a development setup, see the setup guide.

Create network and databases

First, we're going to create a dedicated network:

docker network create osu-web

Setting up MySQL and the osuweb user:

docker run -d --name osu-web-mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes --network osu-web mysql/mysql-server:8.0
while ! (docker exec osu-web-mysql mysql); do echo "Waiting for MySQL to be ready..."; sleep 3; done && curl https://raw.githubusercontent.com/ppy/osu-web/master/docker/development/db_user.sql | docker exec -i osu-web-mysql mysql

Setting up Redis:

docker run -d --name osu-web-redis redis:latest

Setting up Elasticsearch:

docker run -d --name osu-web-elasticsearch -e action.auto_create_index=false -e discovery.type=single-node -e ES_JAVA_OPTS="-Xms512m -Xmx512m" --network osu-web docker.elastic.co/elasticsearch/elasticsearch:7.17.6
Configuration

Generating OAuth keys:

docker run --name passport_keys pppy/osu-web:latest artisan passport:keys
docker cp passport_keys:/app/storage/oauth-public.key .
docker cp passport_keys:/app/storage/oauth-private.key .
docker rm passport_keys

Copy osu!web's example .env to .env and adjust variables as you fit, but most importantly:

  • Run docker run --rm pppy/osu-web:latest artisan key:generate --show and set APP_KEY accordingly
  • Set PASSPORT_PUBLIC_KEY and PASSPORT_PRIVATE_KEY to the contents of oauth-public.key and oauth-private.key respectively
  • Set APP_URL to the URL you'll reach the website from your browser, eg. http://localhost:8000
  • Set APP_DEBUG to false
  • Set DB_HOST to osu-web-mysql
  • Set REDIS_HOST, CACHE_REDIS_HOST and NOTIFICATION_REDIS_HOST to osu-web-redis
  • Set ES_HOST to osu-web-elasticsearch
Populating databases
docker run --rm -it --network osu-web --env-file .env pppy/osu-web:latest artisan db:create
docker run --rm -it --network osu-web --env-file .env pppy/osu-web:latest artisan migrate
docker run --rm -it --network osu-web --env-file .env pppy/osu-web:latest artisan es:index-documents
docker run --rm -it --network osu-web --env-file .env pppy/osu-web:latest artisan es:create-search-blacklist
docker run --rm -it --network osu-web --env-file .env pppy/osu-web:latest artisan es:index-wiki --create-only

You may choose to seed data into your databases, although usually only used in development.
To do so, you will need to set OSU_API_KEY in .env to a valid osu! API v1 API key. You can obtain one from https://old.ppy.sh/p/api using an osu! account with some playtime.
Then run:

docker run --rm -it --network osu-web --env-file .env pppy/osu-web:latest artisan db:seed --force

You can now create your first user:

docker run --rm -it --network osu-web --env-file .env pppy/osu-web:latest artisan tinker
>>> (new App\Libraries\UserRegistration(["username" => "yourusername", "user_email" => "your@email.com", "password" => "yourpassword"]))->save();
Running octane

octane is the component serving HTTP requests. In this example, we're listening for HTTP requests on http://127.0.0.1:8000.

docker run -d --name osu-web-octane --network osu-web --env-file .env -p 127.0.0.1:8000:8000 pppy/osu-web:latest octane
Running jobs
docker run -d --name osu-web-jobs --network osu-web --env-file .env pppy/osu-web:latest queue:work --queue=notification,default,beatmap_high,beatmap_default,store-notifications --tries=3
Running cronjobs
docker run -d --name osu-web-cronjobs --network osu-web --env-file .env pppy/osu-web:latest schedule:work

Congratulations, you have the basic osu!web stack running and listening on http://127.0.0.1:8000!

Kubernetes Deployment

For Kubernetes deployments, see our official Helm chart: https://github.com/ppy/helm-charts/tree/master/osu/osu-web

Contributing

See the setup guide for a rundown on how to get a development environment up.

We welcome all contributions, but keep in mind that we already have the full site designed (mock-ups). If you wish to work on a new section, please open a ticket and we will give you what you need from a design perspective to proceed. If you want to make changes to the design, we recommend you open an issue with your intentions before spending too much time, to ensure no effort is wasted.

If you wish to help with localisation efforts, head over to crowdin. If you're unsure of what you can help with, check out the list of open issues. (especially those with the "good first issue" label).

Please see CONTRIBUTING.md for information about the code standards we expect from pull requests.

While we have standards in place, nothing is set in stone. If you have an issue with the way code is structured; with any libraries we are using; with any processes involved with contributing, please bring it up. We welcome all feedback so we can make contributing to this project as pain-free as possible.

For those interested, we love to reward quality contributions via bounties, paid out via paypal or osu! supporter tags. Don't hesitate to request a bounty for your work on this project.

Seeking Help

If you need help with anything, you have two options:

Create an Issue

If you have something you want to discuss in detail, or have hit an issue which you believe others will also have in deployment or development of the system, opening an issue is the best way to get help. It creates a permanent resource for others wishing to contribute to conversation. Please make sure to search first in case someone else has already addressed the same issue!

Discord

Alternatively, you can join the development discord for assistance.

Licence

osu!web is licensed under AGPL version 3 or later. Please see the licence file for more information. tl;dr if you want to use any code, design or artwork from this project, attribute it and make your project open source under the same licence.

Please note that this does not cover the usage of the "osu!" or "ppy" branding in any software, resources, advertising or promotion, as this is protected by trademark law.

Docker Pull Command

docker pull pppy/osu-web