diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..78c53e63d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM gcr.io/distroless/java:11 +COPY target/bluegenes.jar / +WORKDIR / +EXPOSE 5000 +CMD ["bluegenes.jar"] diff --git a/docs/building.md b/docs/building.md index 8d5308396..bdd8ba280 100644 --- a/docs/building.md +++ b/docs/building.md @@ -116,10 +116,26 @@ There is also a shortcut that in addition cleans and compiles CSS. ## Deploying your build -One of the easiest ways to deploy the prod minified version is to set up [Dokku](http://dokku.viewdocs.io/dokku/) on your intended server. You can also use BlueGenes with [heroku](https://www.heroku.com/). +### docker +BlueGenes has a Dockerfile which you can build with a fresh uberjar. -### Minified deployment using dokku + lein uberjar + docker build -t bluegenes . + +Run it and the web server should default to port 5000. + + docker run -p 5000:5000 -it --rm bluegenes + +You can specify environment variables by using the `-e` or `--env-file` arguments when calling docker. See [Configuring](/docs/configuring.md) for a list of all available environment variables. + +There is also a prebuilt docker image available on Docker Hub. + + docker pull intermine/bluegenes:latest + +### Dokku + +[Dokku](http://dokku.viewdocs.io/dokku/) allows you to push a Git branch and have it automatically build and serve it using the appropriate docker container. (You can also use BlueGenes with [heroku](https://www.heroku.com/).) Once dokku is configured on your remote host, you'll need to add your public key, create a remote for your host and push to it: @@ -139,7 +155,7 @@ To compile and package BlueGenes into an executable jar, run the following comma lein uberjar -Then, to start the application, execute the jar and pass in a [`config.edn` file](../config/dev/README.md): +Then, to start the application, execute the jar and pass in a [`config.edn` file](/docs/configuring.md): java -jar -Dconfig="config/prod/config.edn" target/bluegenes.jar diff --git a/docs/configuring.md b/docs/configuring.md index a8c457a91..c08255f85 100644 --- a/docs/configuring.md +++ b/docs/configuring.md @@ -1,22 +1,25 @@ -# Configuration +# Configuring BlueGenes -This applies primarily to standalone BlueGenes. +## Environment variables +| Envvar | Description | Default | +| ------ | ----------- | ------- | +| SERVER_PORT | Port used by web server | 5000 | +| LOGGING_LEVEL | Minimum level for logging | :info | +| GOOGLE_ANALYTICS | Google Analytics tracking ID | nil | +| JWT_SECRET | Secret for signing JSON Web Tokens | nil | +| BLUEGENES_DEFAULT_SERVICE_ROOT | InterMine service that is default | https://alpha.flymine.org/alpha/ | +| BLUEGENES_DEFAULT_MINE_NAME | Optional default mine name to display until it gets fetched | FlyMine | +| BLUEGENES_TOOL_PATH | Server directory where BlueGenes tools are installed | ./tools | -## Note: Ways to Configure +## How to configure -The preferred way to configure BlueGenes is via `.edn` configuration files, and it is the one being explained here. All keys can be overridden with environment variables. Please refer to [Yogthos's config docs](https://github.com/yogthos/config#yogthosconfig) for more details regarding this method. +BlueGenes supports the many methods of specifying configuration keys provided by [Yogthos' config](https://github.com/yogthos/config#yogthosconfig). The configuration keys listed above can be specified in uppercase or lowercase, and with dashes, underscores or periods as separators. - -## Configuration via `.edn` files +### Configuration via `config.edn` files Copy and paste the code from the `.template` files in `config/dev/` and `config/prod/`, tweak it to match your preferences, and save it as `config.edn` in the same folder. - ### Analytics (optional) -For now, the only supported statistics service is [Google analytics](https://analytics.google.com/). If you wish to use this service, configure your domain and then add your Google Analytics ID. - -```clojure - {:google-analytics "UA-12345678-9"} -``` +For now, the only supported statistics service is [Google analytics](https://analytics.google.com/). If you wish to use this service, configure your domain and then add your Google Analytics ID using the `GOOGLE_ANALYTICS` key listed above.