diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..c12da620 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +config/ +.git/ +target/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..6bf67f27 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM clojure:lein-2.5.3 + +MAINTAINER Trevor Hartman + +EXPOSE 3000 + +RUN mkdir -p /usr/src/app + +COPY src /usr/src/app/ + +COPY project.clj /usr/src/app + +WORKDIR /usr/src/app + +RUN lein deps + +VOLUME /usr/src/app/config/ + +CMD ["lein", "run"] diff --git a/README.md b/README.md index 913fc703..7d121e43 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# yetibot +# Yetibot -You can treat yetibot as a communal command line. It works well for: +You can treat Yetibot as a communal command line. It works well for: - **teaching**: how to run internal automation, language evaluation for JS, Scala, Clojure, and Haskell @@ -22,26 +22,31 @@ Yetibot has been undergoing continuous improvement since its inception. These are the immediate priorities, in addition to any bugfixes. Feedback and contributions are very welcome! -0. Dockerize yetibot and Datomic Pro Starter edition to simplify deployment -0. Integrate with [StackStorm](https://stackstorm.com/) for automation on - steriods -0. Create a Heroku deploy button to make it easy to get started -0. Run a demo yetibot instance +- [ ] Dockerize Yetibot and Datomic Pro Starter edition to simplify deployment. + In progress! +- [x] Integrate with [StackStorm](https://stackstorm.com/) for automation on + steriods. Done! Check out + [yetibot-stackstorm](https://github.com/devth/yetibot-stackstorm). +- [ ] Create a Heroku deploy button to make it easy to get started +- [ ] Run a demo Yetibot instance ## Installation -There are two primary ways of installing yetibot: - - 1. **Clone this repo**: this gives you a standard yetibot installation and - provides a git-ignored place to store configuration. - 2. **Make your own repo and depend on yetibot**: this gives you ultimate - customizability, allowing you to depend on custom yetibot plugins or define - your own commands in-project, and gives you control over where you store - your config (manual management, commit to private git repo, etc...) - - ```clojure - [yetibot "0.1.28"] - ``` +There are three primary ways of installing Yetibot: + +0. Follow the [Docker instructions](doc/DOCKER.md): the fastest way if you're + already using Docker! +0. **Clone this repo**: this gives you a standard Yetibot installation and + provides a git-ignored place to store configuration. Run from the root dir + with `lein run`. +0. **Make your own repo and depend on Yetibot**: this gives you ultimate + customizability, allowing you to depend on custom Yetibot plugins or define + your own commands in-project, and gives you control over where you store + your config (manual management, commit to private git repo, etc...) + + ```clojure + [yetibot "0.1.28"] + ``` ## Configuration diff --git a/doc/DOCKER.md b/doc/DOCKER.md new file mode 100644 index 00000000..8ee4d3ca --- /dev/null +++ b/doc/DOCKER.md @@ -0,0 +1,51 @@ +# Docker + +The official Yetibot image is +[devth/yetibot](https://hub.docker.com/devth/yetibot). It's built on the +official [Clojure image](https://hub.docker.com/_/clojure/). + +## Configuration + +Configuration must be passed in using the volume at `/usr/src/app/config`. The +mounted directory must contain a file `config.edn` as described by the [sample +config](https://github.com/devth/yetibot/blob/master/config/config-sample.edn). + +## Ports + +Yetibot runs a webapp on port `3000`. You may optionally expose it via `-P` or +`-p` to choose your own host port mapping. + +## Running + +Start up Yetibot in detached mode with port 3000 mapped: + +``` +# path to your config directory containing config.edn +YB_CONFIG_PATH=... + +docker run --name yetibot \ + -d -p 3000:3000 \ + -v $YB_CONFIG_PATH:/usr/src/app/config \ + devth/yetibot +``` + +Note, if you're using Docker Machine, you can view the webapp at its IP +rather than localhost. + +Tail its logs: + +``` +docker logs -f yetibot +``` + +## Troubleshoting + +To run an ephemeral interactive shell and poke around instead of running Yetibot: + +``` +docker run --rm -it --name yetibot \ + -v $YB_CONFIG_PATH:/usr/src/app/config \ + devth/yetibot \ + /bin/bash +``` + diff --git a/project.clj b/project.clj index 9216ec0d..145476e8 100644 --- a/project.clj +++ b/project.clj @@ -31,10 +31,13 @@ ; [incanter "1.4.0"] ] - :plugins [[lein-ring "0.9.5"]] + :plugins [[lein-ring "0.9.5"] + [io.sarnowski/lein-docker "1.1.0"]] :pedantic :ignore + :docker {:image-name "devth/yetibot"} + :ring {:handler yetibot.webapp.handler/app :init yetibot.webapp.handler/init :destroy yetibot.webapp.handler/destroy