Home

Awesome

clojuredocs

The clojuredocs.org webapp

Contributing

A few ways to contribute:

Let's use GH issues for discussion for now

If you're looking for a project:

Deploy

Production is deployed on an AWS t2.micro instance. There's an nginx process running on the box, balancing to two JVMs managed by Upstart to support zero-downtime deploys.

To regenerate the upstart scripts:

cd $REPO
sudo foreman export -a clojuredocs -e ./.env -u ubuntu -c "web=2" upstart /etc/init/

To start the app processes:

sudo service clojuredocs-web-1 start
sudo service clojuredocs-web-2 start

To redeploy:

# in $REPO
sudo service clojuredocs-web-1 stop
git pull origin master
# This will compile assets & run tests
bin/build
sudo service clojuredocs-web-1 start
# Wait for proc 1 to start serving requests
sudo service clojuredocs-web-2 restart

Reqs

Dev

Run bin/dev, which will start all the things (repl, web process, scss compiler, etc). See Procfile for more info.

Connect to the repl and / or visit http://localhost:4000

You'll notice that var information is already populated. In an effort to not make the same mistakes again, all core-related var info is loaded from the runtime version of Clojure on start up.

OTOH, examples, see-alsos, and notes (and any other user-generated content) are stored in the database.

Local Data

The app uses a MongoDB database named clojuredocs to store data. Run bin/db-reset to seed the database with a recent production export (you must be running mongod for this to work).

Prod Local

Occasionally you'll need to compile and run things as they would be in production (checking advanced cljs compilation, for example): bin/prod-local.

CLJS Source Maps

The ClojureDocs project is set-up to emit source-maps for compiled javascript. To enable in Chrome, check the 'Enable JS source maps' option in the Developer Tools settings pane.

Clojure Version

Clojure vars are pulled directly from the runtime, and are not stored in the database. When new versions of Clojure are released:

App Structure

Interesting files:

Conventions

Adding Functions, Macros, Special Forms, Namespaces & Other Vars

Most vars are picked up from Clojure at runtime, using core namespace and var introspection utilities. Special forms and namespaces to include on the site are specified explicitly in the clojuredocs.search.static namespace.

Vars are picked up automatically based on the namespaces specified in clojuredocs.search.static/clojure-namespaces vector. Any namespace in this vector will be queried for public vars to be made searchable and displayable on the site.

Special forms are specified in the clojuredocs.search.static/special-forms list, and require a server restart to be picked up in a dev environment.

Adding Core Libraries

Sometimes we'd like to add core libraries that are not part of the standard Clojure distribution (like core.async) to the site. Here's how to do that:

  1. Add dependency to project.clj
  2. Add ns sym to clojure-namespaces in clojuredocs.search.static
  3. Add a short description + links to community articles / videos / other resources to src/md/namespaces/

Dev-Prod differences

Data Exports

Contributors

Zachary Kim, Lee Hinman, and more.

License

Copyright © 2010-present Zachary Kim

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.