Using the built-in ring server is the simplest approach. Simply run:
% lein ring server
at the project root and your site will come to life! To set the port you can change the options that live in your project.clj
:
:ring {:handler taiga.core/handler :init taiga.core/init :port 33333})
Set the port to any viable port number and restart!
For Tomcat, the process is simple. First, change your {:assets {:dir ...}}
from "app/"
to something absolute on your filesystem (as you cannot add files into your deployed uberwar).
Then build the uberwar:
% lein ring uberwar
Once this has completed, drop the resulting jar into your running Tomcat container's webapps directory. Voila!
To deploy to Immutant, set up the lein-immutant plugin and then in your Caribou project root simply type:
% lein immutant deploy
Immutant is configured through the :immutant
key in your project.clj. See the Immutant docs for help.
To deploy to Beanstalk running Tomcat, the key is to use the lein-beanstalk plugin and have the right set of values in your project.clj
. Here is an example configuration:
:aws {:access-key "YOUR-AWS-ACCESS-KEY" :secret-key "YOUR-AWS-SECRET-KEY" :region "us-west-1" :beanstalk {:region "us-west-1" :s3-region "us-west-1" :app-name "taiga" :s3-bucket "taiga-prod" :environments [{:name "taiga-production" :env {"environment" "production"}}]}}
Then, run the lein-beanstalk
command:
% lein beanstalk deploy
If your Beanstalk configuration with AWS is set up right, you now have a Caribou project running in the cloud somewhere! Congratulations.
Caribou by default is already set up to deploy to Heroku. The main thing to deal with is setting up and migrating the Postgresql database.
We will start from the beginning.
% lein new caribou orbmaster % cd orbmaster
% git init % heroku apps:create % heroku addons:add heroku-postgresql:dev % heroku config:set CARIBOU_ENVIRONMENT=heroku
resources/config/heroku.clj
config file with the right values (this is the most elaborate part). The values to swap out will be obvious by their heroku-
prefix in the map under the :database
key. This is only necessary for migration, once deployed your app will just use the heroku supplied environment variable DATABASE_URL
for its database information:% heroku config | grep HEROKU_POSTGRESQL # note the color! % heroku pg:promote HEROKU_POSTGRESQL_{{color}}_URL # replace with your color! % heroku pg:credentials DATABASE # note host, port, database, user and password % vim resources/config/heroku.clj # add values discovered from previous command!
% lein caribou migrate resources/config/heroku.clj # IGNORE EVERYTHING BELOW THIS, IT IS ACTUALLY WORKING # -------------------------------------- # ERROR no current database connection # INFO Already used these: # nil # INFO -> migration caribou.migrations.bootstrap started. # DEBUG :INVOKE_MODELS No models table yet! # DEBUG :stacktrace >>> org.postgresql.util.PSQLException: ERROR: relation "model" does not exist
% git add . % git commit -m "init" % git push heroku master
% heroku ps:scale web=1
% heroku open
You should see your new app up and running!
If you want to use the Caribou image support, you have to set up an s3 bucket (as heroku does not have a persistent filesystem). To do this, add the following entry to your resources/config/heroku.clj
config file:
:aws {:bucket "your.bucket.name" :credentials {:access-key "YOUR-ACCESS-KEY" :secret-key "YOUR-SECRET-KEY"}}
This will allow uploading images in the admin and resizing images from templates (or elsewhere).
Most of the above is standard Heroku procedure. For any additional Heroku support, refer to the Heroku docs.