An open API service indexing awesome lists of open source software.

https://github.com/mpolinowski/nomadic-fileserver

Provisioning an HTTP Fileserver with Hashicorp Nomad
https://github.com/mpolinowski/nomadic-fileserver

fileserver hashicorp-nomad nginx

Last synced: 2 months ago
JSON representation

Provisioning an HTTP Fileserver with Hashicorp Nomad

Awesome Lists containing this project

README

          

# Provisioning an HTTP Fileserver

Spin up an NGINX container with __Hashicorp Nomad__ that servers your files via HTTP. You will have to change the `server_name` to your domain or local IP. Run the job file and navigate your browser to port `8888`:

```bash
server {
listen 8080;
listen [::]:8080;

server_name my.domain.com;

location ~ /secret/.* {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/conf.d/.htpasswd;
root /usr/share/nginx/html;
}

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
}
```

Nomad will create a text file in both the `/secret/` and `/public/` directory for testing:

![Provisioning an HTTP Fileserver with Hashicorp Nomad](./nomadic-fileserver.png)

## NGINX Server Configuration

Check [nginx_docker_ingress](https://github.com/mpolinowski/nginx_docker_ingress) on how to configure NGINX. The configuration is automatically generated by Nomad - but I did remove the TLS configuration for this example.

## Service Check

The uses Consul to verify that the web service is available - if you don't use either remove the `check` or switch the `provider` to `nomad`:

```bash
check {
name = "HTTP Health"
path = "/"
type = "http"
protocol = "http"
interval = "10s"
timeout = "2s"
}
```