Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
doc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

mango

    __  ___
   /  |/  /___ _____  ____ _____
  / /|_/ / __ `/ __ \/ __ `/ __ \
 / /  / / /_/ / / / / /_/ / /_/ /
/_/  /_/\__,_/_/ /_/\__, /\____/
                   /____/

A blog written in Clojure for learning Clojure... and blogging.

Configuring

You can configure three profiles: dev, test, and prod. Each profile can have separate urls, databases, and other fields configured to isolate them from each other.

config.edn

Each profile, dev, test, and prod can be configured by editing its corresponding config.edn file. You'll probably want to specify different article, page, media, and users collections among the different configurations in order to separate the data you develop and test with, from your production data.

{
 :db-name "blog"
 :db-article-collection "articles"
 :db-page-collection "pages"
 :db-media-collection "media"
 :db-users-collection "users"
 :site-url "http://localhost"
 :site-title "My Mango Site"
 :site-description "A site I made with mango"
 :site-copyright "My copyright message"
 :twitter-site-handle "{your twitter handle}"
 :twitter-creator-handle "{your twitter handle}"
 :admin-email "your-email@your-domain.com"
 :port 8080
 :logo-url "https://s3-us-west-1.amazonaws.com/{your bucket}/logo.png"
 :aws-media-bucket "{your bucket}"
 :aws-region "us-west-1"
 :cdn-url "https://s3-us-west-1.amazonaws.com/{your bucket}/blog/"
 :app-css "/css/mango.css"
 :app-js "/cljs-out/dev-main.js"}
 :analytics-enabled false
 :google-analytics-id "{your google analytics id}"
 :ads-enabled false
 :google-ad-client "{your google client id}"
 :google-ad-slot "{your google ad slot id}"

CDN / Media Storage

You'll need to supply your Amazon credentials and S3 bucket

Database

Mango is currently strictly tied to mongoDB and you must have an instance running that you can connect to.

Developing

Running locally for development:

Server

Run the server from the command line with $ lein with-profile dev run. If you're only developing the back end you can stop here and simply open a browser window to the url of your server (http://localhost:8080 by default).

Client

In order to develop the front end with clojurescript, you can fire up figwheel and have all the interactive development (REPL, live code reloading, etc) you could wish for.

You can run the client code with figwheel watching for live updates with $ lein fig. If you want to use the command line REPL you can use $ lein fig-repl

I use the CIDER REPL from Emacs.

The dev.cljs.edn file configures the development build and figwheel-main to connect to the running server above:

^{:open-url "http://localhost:8080"}
{:main mango.core}

To start CIDER:

  • M-x cider-jack-in-cljs
  • When asked what type of ClojureScript REPL to start, choose figwheel-main
  • When asked the name of the build choose dev. NOT :dev and NOT the default!

The REPL will eventually come up, and load the server url above. Happy hacking!

Testing

  • To run the default tests: $ lein test
  • To run integration tests (requires database connection): $ lein test :integration

To Cut a Version

$ lein v update {patch|minor|major}

Deploying / Hosting

Run $ lein build-server-uberjar and deploy the resulting mango-{version}-standalone.jar file. I just scp it to my Amazon EC2 instance and run it with $ java -jar mango-{version}-standalone.jar. You could so set it up to run automatically for your environment like in this example.

Changelog

2019/07/16

  • Integrate figwheel-main for developing the front end in clojurescript

2019/02/19

  • First commit in prep for open source. Hope all my secrets are scrubbed!

Acknowledgements

Built with

License

See LICENSE.txt

Releases

No releases published

Packages

No packages published