Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
serve __version__ statically - fixes #31
Browse files Browse the repository at this point in the history
  • Loading branch information
tarekziade committed Mar 3, 2017
1 parent d5ae12f commit 31d11c9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docker/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
.PHONY: build run

SERVICEBOOK = http://192.168.1.101:5001/api/
SERVICEBOOK = http://192.168.1.12:5001/api/

build:
python3 create_version.py > version.json
docker build -t serviceweb/dev:latest .

run:
Expand Down
5 changes: 4 additions & 1 deletion create_version.py → docker/create_version.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import json
import os
import subprocess
import sys

sys.path.append('..')
from serviceweb import __version__


HERE = os.path.dirname(__file__)


with open(os.path.join(HERE, 'serviceweb', 'templates',
with open(os.path.join(HERE, '..', 'serviceweb', 'templates',
'version.json')) as f:
version = json.loads(f.read())

Expand Down
5 changes: 5 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ server {
charset utf-8;
client_max_body_size 75M;

location /__version__ {
alias /app/version.json;
add_header Content-Type application/json;
}

location / {
include uwsgi_params;
uwsgi_pass uwsgicluster;
Expand Down
2 changes: 1 addition & 1 deletion docker/version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"source": "https://github.com/mozilla/servicebook", "commit": "2674ec3", "build": "https://travis-ci.org/mozilla/servicebook", "version": "0.1"}
{"build": "https://travis-ci.org/mozilla/servicebook", "commit": "d5ae12f", "version": "0.1", "source": "https://github.com/mozilla/servicebook"}

0 comments on commit 31d11c9

Please sign in to comment.