Content management system with Clojure / Script.
micropress expects some environment variables to be set.
| Variable | Role |
|---|---|
DATABASE_URL |
JDBC connection string. e.g. jdbc:postgresql://db:5432/micropress |
USERNAME |
Database connection username |
PASSWORD |
Database connection password |
ACCESS_CONTROL_ALLOW_ORIGIN |
CORS(Cross Origin Resource Sharing) configuration. You can send GET request from browser of your frontend service |
AWS_ACCESS_KEY_ID |
You must set if you want to upload images to micropress. See Managing Access Keys for your AWS Account - Amazon Web Services |
AWS_SECRET_ACCESS_KEY |
You must set if you want to upload images to micropress. See Managing Access Keys for your AWS Account - Amazon Web Services |
You need
on your machine.
When you first clone this repository, run:
lein setupThis will create files for local configuration, and prep your system for the project.
To begin developing, start with a REPL.
lein replThen load the development environment.
user=> (dev)
:loadedBefore you start application, run docker and boot the database.
docker-compose up -d --buildRun go to initiate and start the system.
dev=> (go)
:startedThis creates a web server at http://localhost:3001.
When you make changes to your source files, use reset to reload any
modified files and reset the server. Changes to CSS or ClojureScript
files will be hot-loaded into the browser.
dev=> (reset)
:reloading (...)
:resumedIf you want to access a ClojureScript REPL, make sure that the site is loaded in a browser and run:
dev=> (cljs-repl)
Waiting for browser connection... Connected.
To quit, type: :cljs/quit
nil
cljs.user=>Testing is fastest through the REPL, as you avoid environment startup time.
dev=> (test)
...But you can also run tests through Leiningen.
lein testRun the command to build the docker image:
lein do clean, uberjar && docker build -t micropress:0.1 .Migrations are handled by ragtime. Migration files are stored in
the resources/migrations directory, and are applied in alphanumeric
order.
To update the database to the latest migration, open the REPL and run:
dev=> (migrate)
Applying 20150815144312-create-users
Applying 20150815145033-create-postsTo rollback the last migration, run:
dev=> (rollback)
Rolling back 20150815145033-create-postsNote that the system needs to be setup with (init) or (go) before
migrations can be applied.
This project has several generator functions to help you create files.
To create a new endpoint:
dev=> (gen/endpoint "bar")
Creating file src/foo/endpoint/bar.clj
Creating file test/foo/endpoint/bar_test.clj
Creating directory resources/foo/endpoint/bar
nilTo create a new component:
dev=> (gen/component "baz")
Creating file src/foo/component/baz.clj
Creating file test/foo/component/baz_test.clj
nilTo create a new boundary:
dev=> (gen/boundary "quz" foo.component.baz.Baz)
Creating file src/foo/boundary/quz.clj
Creating file test/foo/boundary/quz_test.clj
nilTo create a new SQL migration:
dev=> (gen/sql-migration "create-users")
Creating file resources/foo/migrations/20160519143643-create-users.up.sql
Creating file resources/foo/migrations/20160519143643-create-users.down.sql
nilCopyright © 2017 blackawa