Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
cfd6a369
Commit
cfd6a369
authored
Sep 02, 2019
by
Markus Scheidgen
Browse files
Small docker fixes. Script to generate nginx.conf.
parent
86bd2e0c
Pipeline
#54928
passed with stages
in 32 minutes and 40 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.dockerignore
View file @
cfd6a369
**/*.git
**/.mypy_cache
**/__pycache__
**/*.pyc
**/NOMAD.egg-info
.pyenv/
.vscode/
.volumes/
.git/
.mypy_cache/
dependencies/**/test
dependencies/**/tests
data/
docs/.build
docs/*.graffle
gui/
infrastructure/
__pycache__/
*.pyc
NOMAD.egg-info/
.coverage
examples/
local/
...
...
gui/Dockerfile
View file @
cfd6a369
...
...
@@ -33,7 +33,6 @@ RUN yarn run build
# production environment
FROM
nginx:1.13.9-alpine
COPY
--from=build /nomad/app/build /app/nomad
COPY
./gui.conf /etc/nginx/conf.d/default.conf
WORKDIR
/app/nomad
COPY
./run.sh run.sh
...
...
gui/gui.conf
deleted
100644 → 0
View file @
86bd2e0c
server
{
listen
8080
;
server_name
www
.
example
.
com
;
location
/
fairdi
/
nomad
/
latest
/
gui
{
root
/
app
/;
rewrite
^/
fairdi
/
nomad
/
latest
/
gui
/(.*)$ /
nomad
/$
1
break
;
try_files
$
uri
/
fairdi
/
nomad
/
latest
/
gui
/
index
.
html
;
}
location
/
fairdi
/
nomad
/
latest
/
gui
/
service
-
worker
.
js
{
add_header
Last
-
Modified
$
date_gmt
;
add_header
Cache
-
Control
'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'
;
if_modified_since
off
;
expires
off
;
etag
off
;
root
/
app
/;
rewrite
^/
fairdi
/
nomad
/
latest
/
gui
/
service
-
worker
.
js
/
nomad
/
service
-
worker
.
js
break
;
}
}
nomad/cli/admin/admin.py
View file @
cfd6a369
...
...
@@ -89,16 +89,67 @@ def restore(path_to_dump):
config
.
mongo
.
host
,
config
.
mongo
.
port
,
config
.
mongo
.
db_name
,
path_to_dump
))
@
ops
.
command
(
help
=
(
'Generate a proxy pass config for apache2 reverse proxy servers. This can be used to '
'generate partial apache2 configs, e.g. via ... > /etc/https/conf.d/nomad.conf.'
))
@
click
.
option
(
'--nginx'
,
is_flag
=
True
,
help
=
'Provide config for apache2, default is apache.'
)
@
ops
.
command
(
help
=
(
'Generate an nginx.conf to serve the GUI and proxy pass to API container.'
))
@
click
.
option
(
'--prefix'
,
type
=
str
,
default
=
'/example_nomad'
,
help
=
'Url path prefix. Default is /example_nomd, can be empty str.'
)
def
nginx_conf
(
prefix
):
prefix
=
prefix
.
rstrip
(
'/'
)
prefix
=
'/%s'
%
prefix
.
lstrip
(
'/'
)
print
(
'''
\
server {{
listen 80;
server_name www.example.com;
location /{0} {{
return 301 /example-nomad/gui;
}}
location {1}/gui {{
root /app/;
rewrite ^{1}/gui/(.*)$ /nomad/$1 break;
try_files $uri {1}/gui/index.html;
}}
location {1}/gui/service-worker.js {{
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
root /app/;
rewrite ^{1}/gui/service-worker.js /nomad/service-worker.js break;
}}
location {1}/api {{
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_pass http://api:8000;
}}
location {1}/api/uploads {{
client_max_body_size 35g;
proxy_request_buffering off;
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_pass http://api:8000;
}}
location {1}/api/raw {{
proxy_buffering off;
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_pass http://api:8000;
}}
}}
'''
.
format
(
prefix
.
lstrip
(
'/'
),
prefix
))
@
ops
.
command
(
help
=
(
'Generate a proxy pass config for apache2 reverse proxy servers.'
))
@
click
.
option
(
'--prefix'
,
type
=
str
,
default
=
'uploads'
,
help
=
'The path prefix under which everything is proxy passed.'
)
@
click
.
option
(
'--host'
,
type
=
str
,
default
=
'130.183.207.104'
,
help
=
'The host to proxy to.'
)
@
click
.
option
(
'--port'
,
type
=
str
,
default
=
'30001'
,
help
=
'The port to proxy to.'
)
def
proxy_pass
(
nginx
,
prefix
,
host
,
port
):
if
not
nginx
:
print
(
'''
\
def
apache_conf
(
prefix
,
host
,
port
):
print
(
'''
\
ProxyPass "/{0}" "http://{1}:{2}/{0}"
ProxyPassReverse "/{0}" "http://{1}:{2}/{0}"
<Proxy http://{1}:{2}/{0}>
...
...
@@ -106,19 +157,3 @@ ProxyPassReverse "/{0}" "http://{1}:{2}/{0}"
Order deny,allow
Allow from all
</Proxy>'''
.
format
(
prefix
,
host
,
port
))
else
:
print
(
'''
\
location /{0} {{
client_max_body_size 35g;
proxy_pass http://{1}:{2};
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_buffering off;
proxy_request_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 600;
proxy_send_timeout 3600;
proxy_read_timeout 600;
send_timeout 3600;
}}'''
.
format
(
prefix
,
host
,
port
))
ops/docker-compose/nomad/README.md
View file @
cfd6a369
...
...
@@ -42,9 +42,15 @@ This encompasses to parts a `env.js` file for the client side GUI code. And an
`nginx.conf`
for the web server running the GUI (and reverse proxying the API).
Both need to be mounted to the respective containers. The
`env.js`
under
`/app/nomad/env.js`
and the
`nginx.conf`
under
`/etc/nginx/conf.d/default.conf`
.
and the
`nginx.conf`
under
`/etc/nginx/conf.d/default.conf`
. Usually the only configuration
item for the
`nginx.conf`
is the desired URL path prefix. You can generate an
`nginx.conf`
with:
Example files can be found here
`ops/docker-compose/nomad/example/`
.
```
nomad admin nginx-conf --prefix /example-nomad
```
Or use the example files can be found here
`ops/docker-compose/nomad/example/`
.
### Example *.prod.yml override:
...
...
@@ -61,7 +67,7 @@ docker login
docker-compose -f docker-compose.yml -f docker-compose.example.yml up
```
If everything goes well, NOMAD should be available at
`http://your-host/
my_
example
_
nomad/gui/`
.
If everything goes well, NOMAD should be available at
`http://your-host/example
-
nomad/gui/`
.
We recommend to either change the nginx.conf to use SSL or put this behind a reverse-proxy
that supports SSL. If you use a reverse-proxy, you should disable any buffering to support
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment