Skip to content

Commit b5f6a79

Browse files
committed
Refactor Nginx Docker setup: add landing page, update configurations, and remove deprecated files
1 parent 01419e3 commit b5f6a79

6 files changed

Lines changed: 174 additions & 83 deletions

File tree

nginx/Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
FROM nginx:stable-alpine
22

3+
ARG PROXY_CKAN_LOCATION=/catalog
4+
ARG PROXY_PYCSW_LOCATION=/csw
5+
36
ENV CKAN_PORT=5000
47
ENV PYCSW_PORT=8000
5-
ENV BDN_PORT=5001
68
ENV PYCSW_COMPOSE_SERVICE=pycsw
79
ENV CKAN_COMPOSE_SERVICE=ckan
8-
ENV CKAN_DEV_COMPOSE_SERVICE=ckan-dev
910
#ENV BDN_COMPOSE_SERVICE=bdn
1011
ENV PROXY_SERVER_NAME=localhost
11-
ENV PROXY_CKAN_LOCATION=/catalog
12-
ENV PROXY_PYCSW_LOCATION=/csw
13-
ENV PROXY_BDN_LOCATION=/bdn
1412
ENV PROXY_PYCSW_PROXY_PASS=http://${PYCSW_COMPOSE_SERVICE}:${PYCSW_PORT}
1513
ENV PROXY_CKAN_PROXY_PASS=http://${CKAN_COMPOSE_SERVICE}:${CKAN_PORT}
1614
#ENV PROXY_BDN_PROXY_PASS=http://${BDN_COMPOSE_SERVICE}:${BDN_PORT}
1715

1816
ENV NGINX_PORT=80
1917
ENV NGINX_LOG_DIR=/var/log/nginx
2018
ENV NGINX_DIR=/etc/nginx
19+
ENV NGINX_SHARE_HTML_DIR=/usr/share/nginx/html
2120

22-
RUN mkdir -p ${NGINX_LOG_DIR} && \
23-
mkdir -p ${NGINX_DIR}/certs
21+
RUN mkdir -p ${NGINX_LOG_DIR} \
22+
&& mkdir -p ${NGINX_DIR}/certs
2423

24+
# Copy configuration and static files
2525
COPY setup/nginx.conf ${NGINX_DIR}/nginx.conf
26-
COPY setup/index.html /usr/share/nginx/html/index.html
2726
COPY setup/default.conf.template ${NGINX_DIR}/templates/default.conf.template
2827
COPY setup/ckan-local.* ${NGINX_DIR}/certs/
29-
COPY setup/robots.txt /usr/share/nginx/html/robots.txt
28+
COPY setup/html/index.html setup/html/robots.txt ${NGINX_SHARE_HTML_DIR}/
29+
30+
# Replace $PROXY_CKAN_LOCATION and $PROXY_PYCSW_LOCATION in index.html
31+
RUN sed -i "s|<a href=\"/catalog\">|<a href=\"${PROXY_CKAN_LOCATION}\">|g; s|<a href=\"/csw\">|<a href=\"${PROXY_PYCSW_LOCATION}\">|g" ${NGINX_SHARE_HTML_DIR}/index.html
3032

3133
EXPOSE ${NGINX_PORT}

nginx/setup/default.conf.template

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ server {
77
ssl_certificate /etc/nginx/certs/ckan-local.crt;
88
ssl_certificate_key /etc/nginx/certs/ckan-local.key;
99

10+
root $NGINX_SHARE_HTML_DIR;
11+
index index.html;
12+
1013
# TLS 1.2 & 1.3 only
1114
ssl_protocols TLSv1.2 TLSv1.3;
1215

@@ -92,12 +95,10 @@ server {
9295
error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 421 422 423 424 425 426 428 429 431 451 500 501 502 503 504 505 506 507 508 510 511 /error.html;
9396

9497
# redirect server error pages to the static page /error.html
95-
#
96-
location = /error.html {
97-
ssi on;
98-
internal;
99-
auth_basic off;
100-
root /usr/share/nginx/html;
98+
99+
# robots.txt
100+
location = /robots.txt {
101+
add_header Content-Type text/plain;
102+
root $NGINX_SHARE_HTML_DIR;
101103
}
102-
103104
}

nginx/setup/html/index.html

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>CKAN Docker Landing Page</title>
8+
<style>
9+
body {
10+
font-family: Arial, Helvetica, sans-serif;
11+
text-align: center;
12+
background-color: #f4f4f4;
13+
color: #333;
14+
margin: 0;
15+
padding: 0;
16+
display: flex;
17+
flex-direction: column;
18+
min-height: 100vh;
19+
}
20+
header {
21+
background-color: #003164;
22+
color: white;
23+
padding: 20px 0;
24+
width: 100%;
25+
}
26+
h2 {
27+
font-weight: bold;
28+
font-size: 32px;
29+
margin: 0;
30+
}
31+
.content {
32+
flex: 1;
33+
display: flex;
34+
flex-direction: column;
35+
justify-content: center;
36+
}
37+
ul {
38+
list-style-type: none;
39+
margin: 0;
40+
padding: 0;
41+
display: flex;
42+
justify-content: center;
43+
flex-wrap: wrap;
44+
}
45+
a {
46+
text-decoration: none;
47+
color: inherit;
48+
}
49+
li {
50+
display: inline-block;
51+
margin: 20px;
52+
width: 450px;
53+
height: 400px;
54+
background-color: white;
55+
border: 1px solid #00316426;
56+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
57+
transition: transform 0.2s, color 0.2s;
58+
border-radius: 5%;
59+
display: flex;
60+
flex-direction: column;
61+
justify-content: center;
62+
align-items: center;
63+
}
64+
li:hover {
65+
transform: translateY(-10px);
66+
color: #003164;
67+
}
68+
li img {
69+
display: block;
70+
margin: 20px auto;
71+
max-width: 150px;
72+
}
73+
li p {
74+
display: block;
75+
font-weight: bold;
76+
text-decoration: none;
77+
font-size: 30px;
78+
color: #a8a6a3;
79+
margin: 10px 0;
80+
}
81+
li:hover p {
82+
color: #003164;
83+
}
84+
footer {
85+
background-color: #003164;
86+
color: white;
87+
padding: 10px 0;
88+
width: 100%;
89+
position: fixed;
90+
bottom: 0;
91+
}
92+
/* Style for the icon button */
93+
.icon-button {
94+
display: inline-flex;
95+
align-items: center;
96+
justify-content: center;
97+
text-decoration: none;
98+
color: white;
99+
border-radius: 50%;
100+
padding: 0.4rem;
101+
transition: background-color 0.3s, color 0.3s;
102+
}
103+
104+
/* Hover effect */
105+
.icon-button:hover {
106+
background-color: rgb(47 136 163 / 40%);
107+
color: white;
108+
text-decoration: none;
109+
}
110+
111+
/* Style for the icon */
112+
.icon-button svg {
113+
width: 24px;
114+
height: 24px;
115+
fill: white;
116+
}
117+
.sct-about-figures-alt-card-icon {
118+
height: 100%;
119+
width: 30%;
120+
float: left;
121+
border-radius: 4px 30px 30px 4px / 4px 40px 40px 4px;
122+
display: flex;
123+
justify-content: center;
124+
align-items: center;
125+
background-color: #003164;
126+
}
127+
</style>
128+
</head>
129+
<body>
130+
<header>
131+
<h2>CKAN Docker Landing Page</h2>
132+
</header>
133+
<div class="content">
134+
<ul>
135+
<a href="/catalog">
136+
<li>
137+
<img src="https://raw.githubusercontent.com/mjanez/ckanext-schemingdcat/21550f131bfcd7c35e095a2c2caa766bf9f9d69d/ckanext/schemingdcat/public/images/default/ckan-logo.png" alt="Open Data Catalog">
138+
<p>Open Data portal</p>
139+
</li>
140+
</a>
141+
<a href="/csw">
142+
<li>
143+
<img src="https://www.ogc.org/wp-content/uploads/2023/03/OGC-1.svg" alt="CSW Endpoint">
144+
<p>CSW Endpoint</p>
145+
</li>
146+
</a>
147+
</ul>
148+
</div>
149+
<footer>
150+
<a href="https://github.com/mjanez/ckan-docker" class="icon-button">
151+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3 .3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5 .3-6.2 2.3zm44.2-1.7c-2.9 .7-4.9 2.6-4.6 4.9 .3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3 .7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3 .3 2.9 2.3 3.9 1.6 1 3.6 .7 4.3-.7 .7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3 .7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3 .7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
152+
</a>
153+
</footer>
154+
</body>
155+
</html>

nginx/setup/index.html

Lines changed: 0 additions & 66 deletions
This file was deleted.

nginx/setup/nginx.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ http {
2626
tcp_nodelay on;
2727
types_hash_max_size 2048;
2828
keepalive_timeout 65;
29-
keepalive_requests 100;
3029

3130
# Don't expose Nginx version
3231
server_tokens off;

0 commit comments

Comments
 (0)