Skip to content

Commit

Permalink
Merge pull request #31 from rwblair/nginx_updates
Browse files Browse the repository at this point in the history
Nginx updates
  • Loading branch information
rwblair authored Jun 6, 2017
2 parents 6bd9937 + 911d14a commit 0736223
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@ ENV/

# OS generated files
.DS_Store

.ssl
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,28 @@
# mriqcwebapi
Built on:
* [Python Eve](http://python-eve.org/)
* [Python Gunicorn](http://gunicorn.org/)
* [Nginx](https://nginx.org/)
* [Docker](https://www.docker.com/)

## Run
Example of commands to run locally to start:
```sh
$ cd dockereve-master/
$ docker-compose build
$ docker-compose up -d
$ curl -i -H "Content-Type: application/json" http://localhost/api/v1/T1w
```

Swagger API documentation available at `http://localhost/docs`.

## Environment variables in Docker
To properly run the file dockereve-master/.env needs to be populated the following are the default values:
```
MONGODB_HOST=mongodb
MONGODB_PORT=27017
API_TOKEN=<secret_token>
API_URL=http://localhost/docs/api
```

If docker is running natively these values should work, otherwise API_URL may need to be updated from localhost accordingly.
3 changes: 3 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ machine:

test:
pre:
- mkdir dockereve-master/nginx/.ssl
- touch dockereve-master/nginx/.ssl/mriqcep.crt
- touch dockereve-master/nginx/.ssl/mriqcep.key
- docker-compose -f dockereve-master/docker-compose.yml build
override:
- docker-compose -f dockereve-master/docker-compose.yml up -d
Expand Down
23 changes: 0 additions & 23 deletions dockereve-master/README.md

This file was deleted.

6 changes: 5 additions & 1 deletion dockereve-master/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
nginx:
image: nginx
restart: always
build: ./nginx/
ports:
- 80:80
- 443:443
volumes:
- /www/static
- ./uwsgi_params.par:/etc/nginx/uwsgi_params.par:ro
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/.ssl:/etc/ssl/certs/
volumes_from:
- eve
links:
Expand Down
1 change: 1 addition & 0 deletions dockereve-master/eve-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ADD . /usr/src/app

RUN pip3 install -r requirements.txt
RUN pip3 install pytest
RUN sed -i 's/\[scheme\]/\["https"\]/' /usr/local/lib/python3.4/site-packages/eve_swagger/objects.py

#EXPOSE 5000
#CMD ["python3", "server.py"]
Expand Down
1 change: 1 addition & 0 deletions dockereve-master/eve-app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# vi: set ft=python sts=4 ts=4 sw=4 et:

import os
import socket

from eve import Eve
from eve.auth import TokenAuth
Expand Down
3 changes: 0 additions & 3 deletions dockereve-master/nginx/Dockerfile

This file was deleted.

40 changes: 40 additions & 0 deletions dockereve-master/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}

http {
server {
listen 80;
listen [::]:80 ;
server_name 34.224.227.208;

location = /docs/api {
proxy_pass http://eve:5000/docs/api;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /api {
proxy_pass http://eve:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location / {
proxy_pass http://swagger_ui:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
#return 301 https://$host$request_uri;
}
}
27 changes: 0 additions & 27 deletions dockereve-master/nginx/sites-enabled/eve_project

This file was deleted.

0 comments on commit 0736223

Please sign in to comment.