A Web utility for creating custom scripts and almanacs for the game Blood on the Clocktower.
Once you have cloned the repository, you can get set up to work in it by:
- install npm
- on the command line in project directory:
npm install - You can then
- Build:
npm run-script builddevornpm run-script buildprod - Run the automatic building and development server:
npm run-script watch - Serve files locally:
npm run-script serve - In VS Code, tasks are set up for the above. Just press Ctrl+Shift+B (at least with the Visual Studio Keymap extension. It might be something else by default) and select which thing you'd like.
- Build:
- VS Code extensions I'm using
- For debugging I just press F12 in Firefox or Chrome. Firefox is expecially nice for live-editting css because it has that 'changes' tab to keep track of what you did. Chrome seems to do a little better at showing source-mapped callstacks.
For production deployments we recommend docker compose.
using the published image and
run out-of-tree — you do not need to clone this repository onto the server.
You do need a copy of a few files from the repo (the compose file, .env.sample,
the persistent/config/ and persistent/published/ contents, and schema.sql),
so grab those however you like (clone elsewhere, download, scp, etc.).
-
Pick a deployment directory on the server, for example
/srv/bloodstar. All remaining steps happen inside that directory. -
Copy the compose file and env file from the repo:
cp /path/to/repo/docker-compose.example.yaml docker-compose.yaml cp /path/to/repo/.env.sample .env
Edit
.envand fill in real values forMYSQL_ROOT_PASSWORD,MYSQL_USER,MYSQL_USER_PASSWORD, theEMAIL_*SMTP settings, andWEB_PORT. Editdocker-compose.yamlif you need to change the image tag, published ports, or mount paths for your environment. -
Create the
persistent/directory tree next to the compose file. The compose file bind-mounts each of these paths, so every one must exist beforedocker compose up:-
persistent/config/nginx.conf— copy from the repo. -
persistent/config/php.ini— copy from the repo. -
persistent/protected/— create this directory and populate it with the secrets described inpersistent/protected/README.md:-
db— a JSON file withhost,username,password, anddbkeys. Usehost: "db",db: "bloodstar_db",username: "bloodstar_user", and setpasswordto matchMYSQL_USER_PASSWORDin.env. -
jwt_key.pemandjwt_key.pub— generate with:openssl genrsa -out persistent/protected/jwt_key.pem 2048 openssl rsa -in persistent/protected/jwt_key.pem -pubout -out persistent/protected/jwt_key.pub
-
-
persistent/usersave/— create empty; user saves land here. -
persistent/published/— create the directory and copy the defaultalmanac.cssandprint.cssfrompersistent/published/in the repo. Published almanacs will be written here at runtime. -
persistent/db_data/— create empty; MariaDB stores its data files here.
-
-
Start the stack:
docker compose up -d
This pulls
tsubashi/bloodstar:latestandmariadb:latestand starts both services. -
Initialize the database on first boot by loading
schema.sqlintobloodstar_db:docker compose exec -T db mysql -u root -p"$MYSQL_ROOT_PASSWORD" bloodstar_db < schema.sql
Initial setup was done like this. (DO NOT do this with an already set-up project)
-
install npm
-
on the command line in project directory:
- create the project
npm init -y - typescript and webpack stuff
npm install --save-dev typescript eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin webpack webpack-cli ts-loader style-loader css-loader live-server npm-run-all mini-css-extract-plugin css-minimizer-webpack-plugin html-webpack-plugin file-loader - because I'm using jszip:
npm install --save-dev jszip
- create the project