You will need:
git clone git@github.com:kwiliarty/glyphworks && cd glyphworks
cp docker/default.env docker/override.env
source glyphworks.sh
gw-build-dev
gw-yarn install
to run yarn install
in your main application containerdocker compose up -d
gw-migrate
to perform initial db setupgw-collectstatic
to make static assets (fonts and favicon) work in styleguidistYou can theoretically set up the application using whatever networking paradigm you prefer, but this is what we recommend:
NOTE: The dirs docker/nginx
and docker/certs
are not related to local dev, they are for the production deployment.
git clone git@github.com:nginx-proxy/nginx-proxy && cd nginx-proxy
docker-compose.yml
with the docker-compose.yml template/etc/hosts
file
127.0.0.1 glyphworks.dev.test
::1 glyphworks.dev.test
127.0.0.1 styleguidist.dev.test
::1 styleguidist.dev.test
docker network create nginx-proxy
docker compose up -d
version: '3.8'
services:
nginx-proxy:
image: jwilder/nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./certs:/etc/nginx/certs
networks:
default:
name: nginx-proxy
As above, you can do certs however you want, but this is the recommended approach that we have found to be easiest:
mkcert -install
cd ~/nginx-proxy/certs && mkcert glyphworks.dev.test styleguidist.dev.test "*.dev.test" dev.test localhost 127.0.0.1 ::1
mv glyphworks.dev.test+6-key.pem server.key
mv glyphworks.dev.test+6.pem server.crt
ln -s server.crt glyphworks.dev.test.crt
ln -s server.crt styleguidist.dev.test.crt
ln -s server.key glyphworks.dev.test.key
ln -s server.key styleguidist.dev.test.key
Sourcing glyphworks.sh
in a bash shell loads up a bunch of aliases that make
it easier to work the application. Some of these aliases work only in bash. All
of them start with gw-
. Read the glyphworks.sh
file to see what's available.
The main application runs on the Django dev server in the python
container.
This server restarts the application automatically when you modify python files.
The dev stack runs webpack in a container. Webpack picks up and reprocesses any changes you make to the front-end application code.
Styleguidist runs in its own container and reloads when you make changes to the front-end code.
The Glyphs are somewhere between configuration and data, so we manage them using
a fixture file at glyphs/fixtures/glyphs.json
. We've modified the Django
migration process so that glyphs are loaded from the fixture file on each
migration. If you are changing glyphs in the application you'll need to dump
them to update the fixture file. Relevant aliases:
gw-load-glyphs
gw-dump-glyphs
Assuming you have sourced the glyphworks.sh
file…
Run gw-unit-test
to kick off a round of unit tests on the back-end application
code.
Run gw-jest-watch
to launch a session that detects changes to your code
and runs relevant jest tests. The interface provides a variety of options that
you can explore.
Run gw-cypress-run
to run Cypress end-to-end tests headlessly in a container.
This is not necessary, and it can be a bit fussy, but it provides the best test-writing experience.
node_modules
and a yarn_cache
folder,
for instance:
/home/<username>/glyphworks/node_modules
/home/<username>/glyphworks/yarn_cache
docker/override.env
export YARN_MODULES_FOLDER='/home/<username>/glyphworks/node_modules'
export YARN_CACHE_FOLDER='/home/<username>/glyphworks/yarn_cache'
gw-local-yarn install
to install the modules for local usegw-local-cypress-run
to run the tests locallygw-local-cypress-open
to open the rich testing IDE