sweet-tooth-clojure.clojure-uberjar-webapp-nginx
Role Name
This role sets up an nginx server to act as a reverse proxy for an application server. It includes configurations for both SSL and non-SSL nginx.
Check out this GitHub link for an overview and instructions. You can also read Deploying Your First Clojure App ...From the Shadows for a beginner-friendly guide on Ansible and detailed information about this role.
Requirements
No specific requirements.
Role Variables
I aimed to make the settings flexible, so you only need to define a few variables for everything to work. If you set the variable clojure_uberjar_webapp_app_name
, then flyingmachine.clojure-uberjar-webapp-common
will also set this variable, which many other variables below will rely on.
For instance, if your domain is foo.bar.com
, the application name will be foo-bar-com
. The configuration for your app will be saved in /etc/nginx/sites_available/foo-bar-com.conf, and access logs will be under /var/log/nginx/foo-bar-com.access.log
. This consistency helps make the file system easier to navigate.
Although some variables reference Datomic, these are optional. I plan to update the role to remove any references to Datomic.
Variable | Description |
---|---|
clojure_uberjar_webapp_nginx_dir |
Directory where nginx configurations are stored |
clojure_uberjar_webapp_nginx_server_name |
Sets server_name in the nginx site config; defaults to clojure_uberjar_webapp_domain |
clojure_uberjar_webapp_nginx_upstream_name |
Name inside the config to identify the upstream Java application |
clojure_uberjar_webapp_nginx_sites_available |
Path to nginx's sites_available directory; included mainly for consistency |
clojure_uberjar_webapp_nginx_sites_enabled |
Path to nginx's sites_enabled directory; included mainly for consistency |
clojure_uberjar_webapp_nginx_static_location |
Base URL for serving static files. For example, http://foo.com/static/logo.png serves a static file |
clojure_uberjar_webapp_nginx_static_alias |
Location on the server file system for static files |
clojure_uberjar_webapp_nginx_use_ssl |
Set to True to enable SSL |
clojure_uberjar_webapp_nginx_letsencrypt_dir |
Directory where Let's Encrypt files are stored |
clojure_uberjar_webapp_nginx_additional_config |
Extra configurations added to the end of the site's nginx config file |
Dependencies
Example Playbook
---
- hosts: webservers
become: true
become_method: sudo
roles:
- "sweet-tooth-clojure.clojure-uberjar-webapp-common"
- "sweet-tooth-clojure.clojure-uberjar-webapp-nginx"
- "sweet-tooth-clojure.clojure-uberjar-webapp-datomic-free"
- "sweet-tooth-clojure.clojure-uberjar-webapp-app"
License
MIT
Author Information
Daniel Higginbotham
ansible-galaxy install sweet-tooth-clojure.clojure-uberjar-webapp-nginx