Yet another ARTEMiS frontend. WIP
Go to file
sk1982 3a8595a1d4 chuni: add score calculator 2024-04-17 04:48:35 -04:00
.idea chuni: import note counts and chart credits 2024-04-13 02:29:08 -04:00
.vscode chuni: add score calculator 2024-04-17 04:48:35 -04:00
migrations chuni: import note counts and chart credits 2024-04-13 02:29:08 -04:00
public/assets/fonts chuni: change badge/rating font 2024-03-14 21:22:17 -04:00
scripts add message about db encoding 2024-04-16 19:57:46 -04:00
src chuni: add score calculator 2024-04-17 04:48:35 -04:00
.db-migraterc initial commit 2024-03-12 06:40:53 -04:00
.dockerignore add docker files 2024-04-07 03:59:11 -04:00
.env initial commit 2024-03-12 06:40:53 -04:00
.env.development initial commit 2024-03-12 06:40:53 -04:00
.env.local.example update .env.local.example 2024-04-07 02:53:14 -04:00
.env.production initial commit 2024-03-12 06:40:53 -04:00
.eslintrc.json suppress no-img-element warning 2024-03-31 23:29:32 -04:00
.gitignore initial commit 2024-03-12 06:40:53 -04:00
Dockerfile add docker files 2024-04-07 03:59:11 -04:00
LICENSE.txt add some license info 2024-04-07 06:04:56 -04:00
README.md add message about db encoding 2024-04-16 19:57:46 -04:00
compress.mjs add static gzip/brotli utility 2024-04-07 02:53:00 -04:00
db-migrate.cjs add message about db encoding 2024-04-16 19:57:46 -04:00
docker-compose.yml fix: docker compose port order 2024-04-07 06:44:25 -04:00
docker-transfer-next-static.sh add docker files 2024-04-07 03:59:11 -04:00
empty.cjs bump deps 2024-04-12 05:17:41 -04:00
next-env.d.ts initial commit 2024-03-12 06:40:53 -04:00
next.config.js bump deps 2024-04-12 05:17:41 -04:00
package-lock.json bump deps 2024-04-12 05:17:41 -04:00
package.json add message about db encoding 2024-04-16 19:57:46 -04:00
postcss.config.js initial commit 2024-03-12 06:40:53 -04:00
process-db.js initial commit 2024-03-12 06:40:53 -04:00
resize-observer.cjs remove resize observer polyfill 2024-04-11 00:05:46 -04:00
tailwind.base.ts fix: correctly show chuni heaven judge counts in playlog 2024-04-13 02:28:02 -04:00
tailwind.config.ts initial commit 2024-03-12 06:40:53 -04:00
tsconfig.json chuni: add recent/top ratings to board 2024-03-12 23:19:26 -04:00

README.md

Actaeon

An ARTEMiS frontend.

WARNING: Back up your database

I am not responsible for misconfigurations that lead to database issues. You should back up your database before making any changes to it.

Important: your default database encoding must be unicode

You can change the encoding by running ALTER DATABASE aime CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

Creating Database Tables

Before running the database importer script, you must create the tables in your database. This can be done by running the server once with AUTOMIGRATE enabled (see below), or by running npm run migrate (make sure you have run npm i first and have the DATABASE_URL environment variable set).

Building

Make sure you have set the required build-time variables correctly.

Building using Docker

Run docker compose build

Building without Docker

You may want to specify runtime variables by modifying .env.local

  1. Run npm i
  2. Run npm run build

Running

Make sure you have created tables and ran database importer and asset extractor.

Running using Docker

  1. Modify the runtime environment variables in docker-compose.yml
  2. Run docker compose up (or docker compose up -d to detach the output)

Running without Docker

  1. Set any runtime environment variables in .env.local that you have not set already.
  2. Run npm run start

Initial Promotion to Owner

In order to access all features of Actaeon, you need to have owner permissions. This can be done by setting the permissions column of your user inside the aime_user table to 255, or by running the server with ACTAEON_OWNER_ID set to your user id. Once one user is owner, they can promote other users to owner through the Actaeon web interface. You can find out your user id by inspecting your ARTEMiS logs:

Aimedb | INFO | access_code ******************** -> user_id 10000

Configuration

Environment variables can be added through .env.local or through the environment. At bare minimum, you will need to set the NEXT_PUBLIC_*_EXTENSION variables to the corresponding file extensions generated by the asset-extract.py script, along with the DATABASE_URL and NEXTAUTH_SECRET variables.

Build-time Variables

These variables can only be set in .env.local at build time: before running npm run build or before building the docker image.

Variable Description Examples Required
BASE_PATH The base path that the site will be hosted on. Required if you wish to serve the site through nginx from the same domain as your artemis server. (default: /web) /web No
ASSET_URL The URL or absolute path to where your assets will be hosted. This should be set to $BASE_PATH/assets unless you are using a different domain or path to serve assets. (default: /web/assets) /web/assets, /assets Yes
NEXT_PUBLIC_JACKET_EXTENSION The file extension that jacket images will use. .webp, .png, .avif Yes
NEXT_PUBLIC_IMAGE_EXTENSION The file extension that other images will use. .webp, .png, .avif Yes
NEXT_PUBLIC_MUSIC_EXTENSION The file extension that music will use. .opus, .m4a Yes
NEXT_PUBLIC_AUDIO_EXTENSION The file extension that other audio will use. .opus, .m4a Yes

Runtime Variables

These variables can be set at runtime through the environment or through the .env.local file

Variable Description Examples Required
DATABASE_URL URL to your artemis database, in the format mysql://user:pass@host:port/db_name mysql://aime:aime@127.0.0.1:3306/aime Yes
NEXTAUTH_SECRET or AUTH_SECRET Set this to a long random string (you can generate this by running openssl rand -base64 32 or npx auth secret on the command line) Yes
AUTOMIGRATE Automatically run new migrations on server startup true, false No
ACTAEON_OWNER_ID Set this to a user id to automatically grant this user owner permissions. 10000 No
COOKIE_SECURE Override the secure flag on authentication cookies (by default, the host protocol or the x-forwarded-proto header is used to determine this) true, false No
BCRYPT_ROUNDS The number of bcrypt rounds to hash passwords with (default: 12) 12, 14 No

Configuring nginx to serve Actaeon on the same domain as ARTEMiS

Nginx can be configured to serve Actaeon and ARTEMiS on the same domain. To do this, the BASE_PATH variable must be set to a non-root base path (for example, /web).

Your nginx config likely looks similar to this:

server {
	listen 80;
	server_name your.hostname.here;

	location / {
		# ...
		proxy_pass http://127.0.0.1:8080/;
	}
}

server {
	listen 443 ssl;
	server_name your.hostname.here;

	# ...

	location / {
		# ...
		proxy_pass http://127.0.0.1:8080/;
	}
}

You can serve Actaeon by adding some additional location blocks. Nginx must also have read access to Actaeon's assets. The following configs assume a base path of /web:

server {
	listen 80;
	server_name your.hostname.here;

	# redirect to https
	location = / {
		return 301 https://$host/;
	}

	location /web/ {
		return 301 https://$host$request_uri;
	}

	location / {
		# ...
		proxy_pass http://127.0.0.1:8080/;
	}
}

server {
	listen 443 ssl;
	server_name your.hostname.here;

	# ...

	# redirect root to web
	rewrite ^/$ /web/ last;

	# serve assets
	location /web/assets/ {
		# modify this path
		alias /path/to/actaeon/public/assets/;
		try_files $uri =404;
	}

	# uncomment if you want nginx to server nextjs static files
	# you will have to run ./docker-transfer-next-static.sh if running through docker
	#location /web/_next/static/ {
	#	# uncomment this if you have ngx_http_gzip_static_module
	#	#gzip_static on;
	#	#gzip_vary on;
	#	# uncomment this if you have ngx_http_brotli_static_module
	#	#brotli_static on;
	#
	#	# modify this path
	#	alias /path/to/actaeon/.next/static/;
	#	try_files $uri =404;
	#}

	# actaeon
	location /web {
		proxy_set_header X-Forwarded-Host $host;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto https;
		proxy_pass http://127.0.0.1:1430;
	}

	location / {
		# ...
		proxy_pass http://127.0.0.1:8080/;
	}
}