# 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.** ## 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](#runtime-variables)), or by running `npm run migrate` (make sure you have run `npm i` first and have the [`DATABASE_URL`](#runtime-variables) environment variable set). # Building Make sure you have set the required [build-time variables](#build-time-variables) correctly. ### Building using Docker Run `docker compose build` ### Building without Docker You may want to specify [runtime variables](#runtime-variables) by modifying `.env.local` 1. Run `npm i` 2. Run `npm run build` # Running Make sure you have [created tables](#creating-database-tables) and ran [database importer and asset extractor](scripts/README.md). ### Running using Docker 1. Modify the [runtime environment variables](#runtime-variables) in `docker-compose.yml` 2. Run `docker compose up` (or `docker compose up -d` to detach the output) ### Running without Docker 1. 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`. Once one user is owner, they can promote other users to owner through the Actaeon web interface. # 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`](#build-time-variables) variables to the corresponding file extensions generated by the [`asset-extract.py` script](scripts/README.md#asset-configs), along with the [`DATABASE_URL` and `NEXTAUTH_SECRET`](#runtime-variables) variables. ### Build-time Variables These variables can only be set 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](#configuring-nginx-to-serve-actaeon-on-the-same-domain-as-artemis). (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 | | `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`](#build-time-variables) 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/; } } ```