- Clone this repo
- Clone george
- Copy a
config.jsonfile (e.g. from live), empty the secret values, and put it into./server/src/config.json - Create a MySQL database, give a user access, update the "database" section of the config.
- Run
npm run migrateto initialize the database, or use MySQL Workbench to export & import a version of the database from live. - Run
npm run devto setupbabelto watch the src directory and build-as-you-save. - In a separate terminal window, run
npm run start:devto setupnodemonto auto-restart the server when changes todist(published by babel) are made. - Local development should be against
https://karen-dev.ngrok.io, as services (e.g. LightWave) need a public endpoint to POST updates to. So installngrokif you haven't got it already, login to their site and follow the getting started steps. - For Alexa;
- Sign in to https://developer.amazon.com/alexa/console/ask/ as your dev user.
- Click into the dev skill, and go to Account Linking
- Add an element to the "authentication.clients" section of config.json, whose "client_id" and "client_secret" matches that in the Alexa Console.
- Set the access_token to a secret value
- Go to "Permissions" in the Alexa Console.
- Copy the "Client Id" and "Client Secret" into "client_id" and "client_secret" values under
config.alexa. - Start Karen locally
- On your phone, sign into the Alexa app as the dev user.
- Go to More, Skills & Games, Your Skills, Dev, (the skill)
- Click "Enable to use".
Always edit config.json from inside the container, not from the host:
docker exec -it george-karen-1 vi /usr/src/app/config.jsonWhy: Editors like vim save by writing to a temp file and then renaming it over the original. This creates a new inode at the host path. Docker bind mounts attach to the inode that existed when the container started — so after a host-side vim edit, the running container's bind mount silently points to the old inode. Karen keeps writing saveConfig() updates to that old inode while the host file (new inode) stays frozen at whatever you typed. The next time Watchtower recreates the container from a new image, it picks up the stale host file and loads outdated tokens.
Editing from inside the container writes directly through the bind mount to the correct inode, avoiding this problem entirely.
Deploys should be automated upon push to master, because of the webhook in the GHA pipeline, which calls out to the karen-updater container of watchtower. But, to do manually;
- Login to NAS
cd /volume2/docker/georgedocker-compose pull karendocker-compose up --detach karen