Skip to content

Commit

Permalink
Feature/use nginx to serve static (#2)
Browse files Browse the repository at this point in the history
* updating nginx to serve static direct, adding complied UI code to a docker volume

* adding tests

* removing Node config, adding build status
  • Loading branch information
RyanNoelk authored Mar 27, 2018
1 parent b6c542e commit 55ecc1c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sudo: required

language: python

python:
- "3.6"

services:
- docker

script:
- docker-compose -f test.yml -p test build nginx
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OpenEats Nginx Proxy Server

[![Build Status](https://travis-ci.org/open-eats/openeats-nginx.svg?branch=master)](https://travis-ci.org/open-eats/openeats-nginx)

This proxy server is meant as a way to easily link and serve the API and web app. Based on your environment file configuration, it will automatically bind the ports for the API and web app as well.

See [the homepage](https://github.com/open-eats/OpenEats) for more information about OpenEats!
Expand Down
21 changes: 14 additions & 7 deletions default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,25 @@ upstream api {
server api:API_PORT;
}

upstream web {
ip_hash;
server web:NODE_PORT;
}

server {
listen 80;
server_name localhost;

location / {
proxy_pass http://web/;
proxy_set_header Host $host;
root /var/www/html/openeats-static/public-ui;
try_files $uri $uri/ /index.html;
}

location /static/ {
root /var/www/html/openeats-static/public-ui;
gzip on;
gzip_types text/plain text/xml text/css
text/comma-separated-values
text/javascript application/x-javascript
application/javascript
application/atom+xml;

expires max;
}

location /api/ {
Expand Down
1 change: 0 additions & 1 deletion start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Sed replace the API_PORT and NODE_PORT vars.

sed -i "s/API_PORT/$API_PORT/g" /etc/nginx/conf.d/default.conf;
sed -i "s/NODE_PORT/$NODE_PORT/g" /etc/nginx/conf.d/default.conf;

# Start the NGINX service.

Expand Down
5 changes: 5 additions & 0 deletions test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: '2.3'
services:
nginx:
command: echo ''
build: .

0 comments on commit 55ecc1c

Please sign in to comment.