From 580a74e7cccaaf77c51cbcaf75e20fd0eed98830 Mon Sep 17 00:00:00 2001
From: Tanya S <120410716+stubbsta@users.noreply.github.com>
Date: Fri, 7 Jun 2024 16:53:01 +0200
Subject: [PATCH] Block explorer nginx (#61)
* add nginx service for block explorer
* return environment variables for web service
* remove exposed port from web service and change nginx port to 3000
---
5xx.html | 91 ++++++++++++++++++++++++++++++++++++++++++++++
docker-compose.yml | 17 +++++++--
nginx.conf | 21 +++++++++++
3 files changed, 126 insertions(+), 3 deletions(-)
create mode 100644 5xx.html
create mode 100644 nginx.conf
diff --git a/5xx.html b/5xx.html
new file mode 100644
index 0000000..8c4d1b0
--- /dev/null
+++ b/5xx.html
@@ -0,0 +1,91 @@
+
+
+
+
+ Chainlens | Blockchain Explorer
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 9e9f30a..a5f5748 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -199,10 +199,8 @@ services:
web:
image: web3labs/epirus-free-web:latest
- ports:
- - 0.0.0.0:3000:3000
environment:
- - API_URL=${EPIRUS_WEB_API_URL:-http://localhost:8090}
+ - API_URL=${EPIRUS_WEB_API_URL:-/api}
- WS_API_URL=${EPIRUS_WEB_WS_API_URL:-ws://localhost:8090}
- DISPLAY_NETWORK_TAB=disabled
depends_on:
@@ -224,5 +222,18 @@ services:
networks:
- simulation
+ nginx:
+ image: nginx:latest
+ volumes:
+ - ./nginx.conf:/etc/nginx/nginx.conf
+ - ./5xx.html:/www/error_pages/5xx.html
+ ports:
+ - 0.0.0.0:3000:80
+ depends_on:
+ - api
+ - web
+ networks:
+ - simulation
+
volumes:
privatekeys-volume:
\ No newline at end of file
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..95033ba
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,21 @@
+events { }
+
+http {
+ server {
+ listen 80;
+ charset utf-8;
+
+ location /api/ {
+ proxy_pass http://api:8090/;
+ }
+
+ location / {
+ proxy_pass http://web:3000/;
+ }
+
+ error_page 500 502 503 504 /5xx.html;
+ location /5xx.html {
+ root /www/error_pages/;
+ }
+ }
+}
\ No newline at end of file