Skip to content
Snippets Groups Projects
Commit 3ad745ed authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Added ESAP GUI and added it to the proxy.

parent b4a83561
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,17 @@ services:
#volumes:
# - ./services/api-gateway/opt/esap-api-gateway:/opt/opt/esap-api-gateway
gui:
image: "esap/gui"
container_name: gui
hostname: gui
ports:
- "8001:8001"
#volumes:
# - ./services/gui/opt/esap-gui:/opt/opt/esap-gui
proxy:
image: "esap/proxy"
container_name: proxy
......
......@@ -31,6 +31,7 @@ if [[ "x$SERVICE" == "x" ]] ; then
# Build all services
$BUILD_COMMAND services/api-gateway -t esap/api-gateway
$BUILD_COMMAND services/proxy -t esap/proxy
$BUILD_COMMAND services/gui -t esap/gui
else
......
FROM ubuntu:20.04
MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com>
#----------------------
# Basics
#----------------------
# Set non-interactive
ENV DEBIAN_FRONTEND noninteractive
# Update
RUN apt-get update
# Utilities
RUN apt-get install -y nano telnet unzip wget openssh-server sudo curl
# Devel
RUN apt-get install -y build-essential python-dev git-core
# Node & nginx
RUN apt-get install -y nodejs npm nginx
#------------------------
# Esap user
#------------------------
# Add group. We chose GID 65527 to try avoiding conflicts.
RUN groupadd -g 65527 esap
# Add user. We chose UID 65527 to try avoiding conflicts.
RUN useradd esap -d /esap -u 65527 -g 65527 -m -s /bin/bash
# Add esap user to sudoers
RUN adduser esap sudo
# No pass sudo (for everyone, actually)
COPY sudoers /etc/sudoers
#------------------------
# Code
#------------------------
RUN cd /opt && git clone https://git.astron.nl/astron-sdc/esap-gui.git
RUN cd /opt/esap-gui && git pull && git checkout 0be8125b478007c75b13002d4e5273af7e14c057
RUN cd /opt/esap-gui && npm install
RUN cd /opt/esap-gui && npm run build
# Link static files
RUN ln -s /opt/esap-gui/build /var/www/html/esap-gui
RUN ln -s /opt/esap-gui/build/static/ /var/www/html/static
# Change nginx conf to listen on 8001
COPY sites_enabled_default /etc/nginx/sites-enabled/default
# Add redirect index
COPY index.html /var/www/html/index.html
#----------------------
# Entrypoint
#----------------------
COPY run_gui.sh /run_gui.sh
COPY entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh /run_gui.sh
USER esap
ENTRYPOINT ["/entrypoint.sh"]
#!/bin/bash
# Exit on any error.
set -e
echo ""
echo "[INFO] Executing entrypoint..."
#---------------------
# Save env
#---------------------
echo "[INFO] Dumping env"
# Save env vars for later usage (e.g. docker exec)
env | \
while read env_var; do
if [[ $env_var == HOME\=* ]]; then
: # Skip HOME var
elif [[ $env_var == PWD\=* ]]; then
: # Skip PWD var
else
echo "export $env_var" >> /tmp/env.sh
fi
done
#---------------------
# Entrypoint command
#---------------------
if [[ "x$@" == "x" ]] ; then
ENTRYPOINT_COMMAND="/run_gui.sh"
else
ENTRYPOINT_COMMAND=$@
fi
echo -n "[INFO] Executing Docker entrypoint command: "
echo $ENTRYPOINT_COMMAND
exec "$ENTRYPOINT_COMMAND"
<html>
<head>
<meta http-equiv="refresh" content="0; URL=/esap-gui" />
</head>
</html>
\ No newline at end of file
#!/bin/bash
DATE=$(date)
echo ""
echo "==================================================="
echo "Starting GUI @ $DATE"
echo "==================================================="
echo ""
sudo nginx -g 'daemon off;'
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 8001 default_server;
listen [::]:8001 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
# fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
......@@ -32,15 +32,21 @@
# TODO: Re-evaluate, this is somehow a bad idea, as
# 1) dev env is different than staging/production, and
# 2) other roules in 001-proxy.conf are never reached
# 2) other rules in 001-proxy.conf are never reached
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} !=localhost
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
ProxyPass / http://api-gateway:8000/
ProxyPassReverse / http://api-gateway:8000/
# ESAP API Gateway
ProxyPass /esap-api http://api-gateway:8000/esap-api
ProxyPassReverse /esap-api http://api-gateway:8000/esap-api
# ESAP GUI
ProxyPass / http://gui:8001/
ProxyPassReverse / http://gui:8001/
</VirtualHost>
......
......@@ -3,8 +3,13 @@
<VirtualHost _default_:443>
ServerAdmin webmaster@esap
ProxyPass / http://api-gateway:8000/
ProxyPassReverse / http://api-gateway:8000/
# ESAP API Gateway
ProxyPass /esap-api http://api-gateway:8000/esap-api
ProxyPassReverse /esap-api http://api-gateway:8000/esap-api
# ESAP GUI
ProxyPass / http://gui:8001/
ProxyPassReverse / http://gui:8001/
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
......
#!/bin/bash
# Source env
source /env.sh
source /tmp/env.sh
# Exec Apache in foreground
exec /usr/sbin/apache2ctl -DFOREGROUND
# Or just use in supervisord:
#/bin/bash -c "source /etc/apache2/envvars && source /env.sh && exec /usr/sbin/apache2 -DFOREGROUND"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment