Hacking around
During development, it is better to start docker compose with the following arguments:
docker-compose run --rm mito migrate
docker-compose up --build --abort-on-container-exit app
Most such commands are defined in the Lakefile
. Use lake to run
it like that:
lake devserver
Then you can connect to the web sever and worker using SLY
. Just run in
the Emacs a command sly-connect
, choose "127.0.0.1" as a hostname
and 14005
as a port for webserver or 14006
as a port to connect
to the worker.
To work in the REPL
, you will need a connection to a database. Establish it
by running (ultralisp/db:connect-toplevel)
.
Running and creating database migrations
To generate a new database migration, run:
docker-compose rm --stop --force empty-postgres
docker-compose run --rm mito generate-migration
To rollup all migration to a dev database, run:
docker-compose run --rm mito migrate
If you want to experiment with database and then rollback the database's state then create a dump with such command:
docker-compose run --rm db-ops dump
And when you want to restore the database's state, ensure that app
and worker
containers are not running and run:
docker stop ultralisp_app ultralisp_worker
docker-compose run --rm db-ops restore
Running tests
Install Postgres database, then create a test user and database:
sudo -u postgres psql -c "CREATE USER ultralisp_test WITH PASSWORD 'ultralisp_test'"
sudo -u postgres psql -c "CREATE DATABASE ultralisp_test OWNER = 'ultralisp_test'"
sudo -u postgres createdb --owner ultralisp_test ultralisp_test
Connect to the REPL
and run:
(ql:quickload :ultralisp-test)
(setf (uiop:getenv "POSTGRES_USER") "ultralisp_test")
(setf (uiop:getenv "POSTGRES_DBNAME") "ultralisp_test")
(setf (uiop:getenv "POSTGRES_PASS") "ultralisp_test")
(setf (uiop:getenv "POSTGRES_HOST") "localhost")
(setf rove:*enable-colors* nil)
(setf rove:*debug-on-error* t)
(asdf:test-system :ultralisp-test)
Interesting environment variables
HIDE_SEARCH
- if you set it, then search bar will not render. But this does not disables projects indexing.CRON_DISABLED
- turn off all cron jobs like project chechking, new version builds etc. Probably, we should create an admin page to perform these actions manually.