Anasaki Studio

Getting started

.env variables and Docker settings

Every variable of the .env file, putting an HTTPS reverse proxy in front, running several sites on one machine and a public demo site

9 min readLast updated

View as Markdown

On this page

docker-compose.yml reads the .env file in the same folder automatically. Never commit .env to git — it holds passwords.

Required variables#

VariableWhat it does
JWT_SECRETThe key that signs admin sessions — changing it later signs everyone out
MYSQL_PASSWORDPassword of the anasaki database user — set it before the first start; changing it later does not change the existing database
MYSQL_ROOT_PASSWORDMySQL root password (used inside the container and read only on the first start)
CODE_DB_PASSWORDPassword of the MySQL user anasaki_code — the Site Code database, which cannot touch the CMS tables; created by docker/mysql-init/10-site-code.sh on the first start

Optional variables#

VariableDefaultWhat it does
SITE_URL(empty)The site's real address, e.g. https://example.com (no trailing /), used for links in password-reset and welcome emails — set it on every live site; without it links follow the Host header, which can be forged
TRUST_PROXYfalseSet true when a reverse proxy sits in front of port 8090, so login limits and analytics see the real IP from X-Real-IP / X-Forwarded-For
TRUSTED_PROXIES(empty = loopback + private networks)IPs / CIDRs of the proxies whose headers are trusted, comma separated — behind Cloudflare connecting directly, list Cloudflare's IP ranges
STORE_URL, STORE_PUBLIC_KEY(empty = the official Plugin Store)Use your own Plugin Store, and the public key (base64) it signs packages with — without STORE_PUBLIC_KEY the site remembers the key the store shows the first time (CMS 2.4.0)
PORT8090The port on the machine that serves the site and the admin
COMPOSE_PROJECT_NAMEanasaki-studioThe name of this installation, used for the container and data volume names
STUDIO_IMAGEchichat/anasaki-studio:latestThe image to run — pin a version such as chichat/anasaki-studio:2.0.5 (tags exist as X.Y.Z, X.Y, X and latest)
ADMIN_PATH(empty)Recovers the admin address if you forgot the path set in Site settings → Security (set e.g. admin and restart); normally empty
ADMIN_EMAIL, ADMIN_PASSWORD(empty)Set both to create the administrator automatically and skip the setup wizard (only while the database has no users; sample content is added too)
SITE_CODE_SECRET_KEY(empty)The key that encrypts Site Code secrets (AES-256-GCM). When empty the system creates site-code.key in the plugins volume — keep it safe: without it saved secrets cannot be read
SITE_CODE_MAIL_SINK(empty)For developers: log writes the emails Site Code sends to the log instead of sending them
DEMO_MODE, DEMO_EMAIL, DEMO_PASSWORD, DEMO_RESET_MINUTESfalse, …, 60Turns this installation into a public demo site (see below)

Never set TRUST_PROXY=true when port 8090 is reachable directly from the internet — anyone could forge the IP headers.

Behind Cloudflare#

  • Real visitor IPs: if Cloudflare connects straight to Anasaki Studio (no Caddy/Nginx in between), set TRUST_PROXY=true and list Cloudflare's IP ranges (cloudflare.com/ips) in TRUSTED_PROXIES. Otherwise everyone looks like a Cloudflare IP and the failed-login limit (10 per IP + email per 15 minutes) counts the whole site together. With Caddy behind Cloudflare, have Caddy pass X-Real-IP from CF-Connecting-IP.
  • HSTS: Anasaki Studio sends Strict-Transport-Security: max-age=31536000 itself when SITE_URL is https, but HSTS turned on in Cloudflare (SSL/TLS → Edge Certificates → HTTP Strict Transport Security) overrides it. A Max Age of 0 switches HSTS off for the whole domain; set at least 6 months (turn on includeSubDomains / preload only when every subdomain uses https).
  • Scripts calling the API: always send your own User-Agent, because Cloudflare blocks the defaults of some libraries (403 error code: 1010). See The designer API.

Where the data lives#

All data is in 3 Docker volumes (named after COMPOSE_PROJECT_NAME):

VolumeWhat it holds
mysql-dataThe MySQL 8.4 database (both anasaki and anasaki_code)
uploadsFiles uploaded to the media library
pluginsInstalled plugin files and site-code.key

Back up the volumes directly, or use Export / import in the admin.

Going live behind a reverse proxy (HTTPS)#

Put a reverse proxy that handles HTTPS in front of port 8090, then set SITE_URL and TRUST_PROXY. An example with Caddy (it gets the HTTPS certificate for you):

example.com {
    reverse_proxy localhost:8090
}
SITE_URL=https://example.com
TRUST_PROXY=true

Several sites on one machine#

Use one folder per site, and in each folder's .env set a different COMPOSE_PROJECT_NAME and PORT, for example a demo site:

# demo/.env
COMPOSE_PROJECT_NAME=anasaki-demo
PORT=8091

With the same name, docker compose up in the second folder replaces the first site's container and uses the same database. Never change the COMPOSE_PROJECT_NAME of a site in use: its data lives in volumes named after it.

A public demo site#

Set in the demo site's .env:

DEMO_MODE=true
[email protected]
DEMO_PASSWORD=demo1234
DEMO_RESET_MINUTES=60
  • The login page shows the demo account with a Sign in with the demo account button — everyone shares that account
  • Visitors can edit content, pages, designs, menus, categories and the theme and upload small images, but cannot manage users, system settings, plugins, raw HTML code or the account's email/password, and Site Code does not run
  • Every DEMO_RESET_MINUTES minutes everything goes back to the baseline (the state when the mode was first turned on). Administrators can press Save this state as the baseline or Reset now in the admin's top bar

Use a separate administrator account of your own, and never turn this mode on for a real site.