marcusianlevine.nginx-container
nginx-container
This adds an nginx service to your Ansible Container project. Follow these steps to install the service:
# Navigate to your Ansible Container project directory
$ cd myproject
# Install the nginx service
$ ansible-container install ansible.nginx-container
Requirements
- You need to have Ansible Container installed.
- You should have an existing Ansible Container project. To create one, run:
# Create a new project directory
$ mkdir myproject
# Go into the new directory
$ cd myproject
# Initialize your project
$ ansible-container init
Role Variables
STATIC_ROOT: /static
Path for static content served by nginx.STATIC_LOCATION: {{ STATIC_ROOT }}/
Requests matching this pattern will link to the {{ STATIC_ROOT }} directory. Typically "/static/" or "/assets/".PIDFILE_DIR: /run/nginx
Directory where nginx saves the current PID.ASSET_PATHS: []
List of paths for the static content to be copied to {{ STATIC_ROOT }}. Paths should be valid within the Ansible build container.
NOTE: If copying source files, mount the source directory to the build container with --with-volumes.
PROXY: no
If using this role in the demo app, set to 'yes' for nginx to proxy the Django service.PROXY_PASS: ""
Address of the backend server for proxied requests (e.g.,http://django:8080
).PROXY_LOCATION: ""
Optional string for matching requests that are forwarded to the backend address. For example,~* /(api|static)
forwards requests that start with/api
or/static
.PROXY_CONNECT_TIMEOUT: 60
Set timeout for proxy connection (up to 75 seconds according to NGINX docs).PROXY_SEND_TIMEOUT: 60
Set timeout for sending proxy requests.PROXY_READ_TIMEOUT: 60
Set timeout for reading proxy responses.
Optional
- EXTRA_CONFIG:
List of absolute paths for additional NGINX configuration templates to be placed in/etc/nginx/conf.d
. Filenames must end with.conf.j2
, but you can list them using just.conf
!
Dependencies
There are no dependencies.
Contributing
To test your changes to this role, use this workflow:
# Save your changes
$ git commit -m "Your message here"
# Upload your changes
$ git push
# Go to the tests directory
$ cd tests
# Run a build to install the role from your latest commit
$ ./build.sh
A few notes:
- You need to
git push
your changes for the build to recognize them. - Change build.sh to point to your version of this role.
- If everything is successful, the container built from your latest commit will run in the background.
- It will publish port 8000:8000, so visiting http://localhost:8000 in your browser should show the default nginx page.
License
Apache v2
Author Information
For a list of contributors, check AUTHORS. Thank you all!
ansible-galaxy install marcusianlevine.nginx-container