Skip to content

Commit f4a184c

Browse files
committed
Minor tweaks before server shutdown
1 parent 539c802 commit f4a184c

File tree

6 files changed

+276
-7
lines changed

6 files changed

+276
-7
lines changed

.docker/nginx/include/nginx_datalab_dev_http.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
upstream datalab_dev {
2+
server app_dev:8081;
3+
}
4+
5+
upstream pydatalab_dev {
6+
server api_dev:5001;
7+
}
8+
9+
map $remote_addr $internal {
10+
default 0;
11+
127.0.0.1 1;
12+
212.159.87.162 1;
13+
}
14+
15+
# API server
16+
server {
17+
listen 443 ssl;
18+
include nginx_ssl.conf;
19+
client_max_body_size 500M;
20+
21+
# set the correct host(s) for your site
22+
server_name www.api-dev.odbx.science api-dev.odbx.science;
23+
24+
location /503.html {
25+
root /app/static;
26+
}
27+
28+
location / {
29+
set $maintenance 0;
30+
if (-f /etc/nginx/static/datalab_dev_maintenance_on) {
31+
set $maintenance 1;
32+
}
33+
if ($internal != 1) {
34+
set $maintenance "${maintenance}1";
35+
}
36+
if ($maintenance = 11) {
37+
return 503;
38+
}
39+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
40+
proxy_set_header X-Forwarded-Proto $scheme;
41+
proxy_set_header Host $http_host;
42+
# we don't want nginx trying to do something clever with
43+
# redirects, we set the Host: header above already.
44+
proxy_redirect off;
45+
proxy_pass http://pydatalab_dev;
46+
47+
limit_except OPTIONS {
48+
auth_basic "Password Required";
49+
auth_basic_user_file /keys/.htpasswd;
50+
}
51+
}
52+
error_page 503 /503.html;
53+
}
54+
55+
# App server
56+
server {
57+
listen 443 ssl;
58+
include nginx_ssl.conf;
59+
client_max_body_size 500M;
60+
61+
# set the correct host(s) for your site
62+
server_name www.datalab-dev.odbx.science datalab-dev.odbx.science;
63+
64+
location /503.html {
65+
root /app/static;
66+
}
67+
68+
location / {
69+
set $maintenance 0;
70+
if (-f /etc/nginx/static/datalab_dev_maintenance_on) {
71+
set $maintenance 1;
72+
}
73+
if ($internal != 1) {
74+
set $maintenance "${maintenance}1";
75+
}
76+
if ($maintenance = 11) {
77+
return 503;
78+
}
79+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
80+
proxy_set_header X-Forwarded-Proto $scheme;
81+
proxy_set_header Host $http_host;
82+
# we don't want nginx trying to do something clever with
83+
# redirects, we set the Host: header above already.
84+
proxy_redirect off;
85+
proxy_pass http://datalab_dev;
86+
limit_except OPTIONS {
87+
auth_basic "Password Required";
88+
auth_basic_user_file /keys/.htpasswd;
89+
}
90+
91+
}
92+
error_page 503 /503.html;
93+
94+
}

.docker/nginx/include/nginx_datalab_http.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
upstream datalab {
2+
server app:8081;
3+
}
4+
5+
upstream pydatalab {
6+
server api:5001;
7+
}
8+
9+
map $remote_addr $internal {
10+
default 0;
11+
127.0.0.1 1;
12+
212.159.87.162 1;
13+
}
14+
15+
# App server
16+
server {
17+
listen 443 ssl;
18+
include nginx_ssl.conf;
19+
20+
client_max_body_size 500M;
21+
22+
# set the correct host(s) for your site
23+
server_name www.datalab.odbx.science datalab.odbx.science;
24+
25+
location /503.html {
26+
root /app/static;
27+
}
28+
29+
location / {
30+
31+
set $maintenance 0;
32+
if (-f /etc/nginx/static/datalab_maintenance_on) {
33+
set $maintenance 1;
34+
}
35+
if ($internal != 1) {
36+
set $maintenance "${maintenance}1";
37+
}
38+
if ($maintenance = 11) {
39+
return 503;
40+
}
41+
42+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
43+
proxy_set_header X-Forwarded-Proto $scheme;
44+
proxy_set_header Host $http_host;
45+
# we don't want nginx trying to do something clever with
46+
# redirects, we set the Host: header above already.
47+
proxy_redirect off;
48+
proxy_pass http://datalab;
49+
}
50+
51+
error_page 503 /503.html;
52+
53+
}
54+
55+
# API server
56+
server {
57+
listen 443 ssl;
58+
include nginx_ssl.conf;
59+
client_max_body_size 500M;
60+
61+
# set the correct host(s) for your site
62+
server_name www.api.odbx.science api.odbx.science;
63+
64+
location /503.html {
65+
root /app/static;
66+
}
67+
68+
location / {
69+
set $maintenance 0;
70+
if (-f /etc/nginx/static/datalab_maintenance_on) {
71+
set $maintenance 1;
72+
}
73+
if ($internal != 1) {
74+
set $maintenance "${maintenance}1";
75+
}
76+
if ($maintenance = 11) {
77+
return 503;
78+
}
79+
80+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
81+
proxy_set_header X-Forwarded-Proto $scheme;
82+
proxy_set_header Host $http_host;
83+
# we don't want nginx trying to do something clever with
84+
# redirects, we set the Host: header above already.
85+
proxy_redirect off;
86+
proxy_pass http://pydatalab;
87+
}
88+
error_page 503 /503.html;
89+
}

.docker/nginx/include/nginx_datalab_public_http.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
upstream datalab_public {
2+
server app_public:8081;
3+
}
4+
5+
upstream pydatalab_public {
6+
server api_public:5001;
7+
}
8+
9+
map $remote_addr $internal {
10+
default 0;
11+
127.0.0.1 1;
12+
212.159.87.162 1;
13+
}
14+
15+
# App server
16+
server {
17+
listen 443 ssl;
18+
include nginx_ssl.conf;
19+
20+
client_max_body_size 500M;
21+
22+
# set the correct host(s) for your site
23+
server_name public.datalab.odbx.science;
24+
25+
location /503.html {
26+
root /app/static;
27+
}
28+
29+
location / {
30+
31+
set $maintenance 0;
32+
if (-f /etc/nginx/static/datalab_public_maintenance_on) {
33+
set $maintenance 1;
34+
}
35+
if ($internal != 1) {
36+
set $maintenance "${maintenance}1";
37+
}
38+
if ($maintenance = 11) {
39+
return 503;
40+
}
41+
42+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
43+
proxy_set_header X-Forwarded-Proto $scheme;
44+
proxy_set_header Host $http_host;
45+
# we don't want nginx trying to do something clever with
46+
# redirects, we set the Host: header above already.
47+
proxy_redirect off;
48+
proxy_pass http://datalab_public;
49+
}
50+
51+
error_page 503 /503.html;
52+
error_page 502 /503.html;
53+
54+
}
55+
56+
# API server
57+
server {
58+
listen 443 ssl;
59+
include nginx_ssl.conf;
60+
client_max_body_size 500M;
61+
62+
# set the correct host(s) for your site
63+
server_name public.api.odbx.science;
64+
65+
location /503.html {
66+
root /app/static;
67+
}
68+
69+
location / {
70+
set $maintenance 0;
71+
if (-f /etc/nginx/static/datalab_public_maintenance_on) {
72+
set $maintenance 1;
73+
}
74+
if ($internal != 1) {
75+
set $maintenance "${maintenance}1";
76+
}
77+
if ($maintenance = 11) {
78+
return 503;
79+
}
80+
81+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
82+
proxy_set_header X-Forwarded-Proto $scheme;
83+
proxy_set_header Host $http_host;
84+
# we don't want nginx trying to do something clever with
85+
# redirects, we set the Host: header above already.
86+
proxy_redirect off;
87+
proxy_pass http://pydatalab_public;
88+
}
89+
error_page 503 /503.html;
90+
}

optimade_gnome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"provider": {
2020
"name": "Gnome",
21-
"description": "A re-up of the Gnome database.",
21+
"description": "An unoffiical OPTIMADE API for the Gnome dataset from Google Deepmind (CC-BY NC). Full terms of use can be found on the project homepage.",
2222
"prefix": "gnome",
2323
"homepage": "https://github.com/google-deepmind/materials_discovery"
2424
},

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
optimade[server]==1.0.0
1+
optimade[server]==1.0.4
22
uvicorn[standard]
33
git+https://github.com/ml-evs/matador@7b4e2a0fae2d96946af466c048fa5f7622607ea2
44
numpy

scripts/certbot.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
docker compose run --rm --entrypoint "certbot certonly --webroot -w /var/www/certbot --email [email protected] --agree-tos --no-eff-email -d www.odbx.science -d optimade-index.odbx.science -d optimade.odbx.science -d optimade-misc.odbx.science -d odbx.science -d datalab.odbx.science -d api.odbx.science -d api-dev.odbx.science -d datalab-dev.odbx.science -d dcgat.odbx.science -d alexandria.odbx.science -d optimade-test.odbx.science -d electrides.odbx.science -d public.datalab.odbx.science -d
2-
public.api.odbx.science -d royce-cam.api.odbx.science -d royce-cam.datalab.odbx.science -d optimade-gnome.odbx.science -d tmdne.odbx.science -d www.thismaterialdoesnotexist.com -d thismaterialdoesnotexist.com -d uh-datalab.odbx.science -d uh-datalab-api.odbx.science -d menkin-datalab.odbx.science -d menkin-datalab-api.odbx.science" certbot
1+
docker compose run --rm --entrypoint "certbot certonly --webroot -w /var/www/certbot --email [email protected] --agree-tos --no-eff-email -d www.odbx.science -d optimade-index.odbx.science -d optimade.odbx.science -d optimade-misc.odbx.science -d odbx.science -d datalab.odbx.science -d api.odbx.science -d api-dev.odbx.science -d datalab-dev.odbx.science -d dcgat.odbx.science -d alexandria.odbx.science -d optimade-test.odbx.science -d electrides.odbx.science -d public.datalab.odbx.science -d public.api.odbx.science -d royce-cam.api.odbx.science -d royce-cam.datalab.odbx.science -d optimade-gnome.odbx.science -d tmdne.odbx.science -d www.thismaterialdoesnotexist.com -d thismaterialdoesnotexist.com -d uh-datalab.odbx.science -d uh-datalab-api.odbx.science -d menkin-datalab.odbx.science -d menkin-datalab-api.odbx.science" certbot

0 commit comments

Comments
 (0)