Skip to content

Commit

Permalink
Merge branch 'master' of github.com:FORTH-ICS-INSPIRE/artemis
Browse files Browse the repository at this point in the history
  • Loading branch information
vkotronis committed Oct 4, 2019
2 parents f6b5161 + 240fb2c commit e58c206
Show file tree
Hide file tree
Showing 10 changed files with 369 additions and 5 deletions.
2 changes: 2 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ RUN sed -i 's/bind 127.0.0.1/bind 0.0.0.0/g' /etc/redis.conf \
# backwards compatibility
&& ln -s /usr/local/lib/pyenv/versions/3.6.8/bin/python /usr/local/bin

COPY ./supervisor.d/* /etc/supervisor/conf.d/

ENTRYPOINT ["./entrypoint"]
231 changes: 231 additions & 0 deletions docker-compose.testcafe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
version: '3'
services:
testcafe:
image: testcafe/testcafe:latest
container_name: testcafe
depends_on:
- backend
- frontend
network_mode: host
entrypoint: ["/bin/sh", "-c"]
command: ["sleep 60s && testcafe chromium:headless /tests/**/*.js"]
volumes:
- ./testcafe/tests:/tests
backend:
image: artemis_backend
build: ./backend/
container_name: backend
depends_on:
- rabbitmq
- postgres
- monitor
networks:
- artemis
expose:
- ${BACKEND_SUPERVISOR_PORT}
environment:
ARTEMIS_WEB_HOST: ${ARTEMIS_WEB_HOST}
RABBITMQ_USER: ${RABBITMQ_USER}
RABBITMQ_PASS: ${RABBITMQ_PASS}
RABBITMQ_HOST: ${RABBITMQ_HOST}
RABBITMQ_PORT: ${RABBITMQ_PORT}
DB_USER: ${DB_USER}
DB_PASS: ${DB_PASS}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_NAME: ${DB_NAME}
DB_VERSION: ${DB_VERSION}
BACKEND_SUPERVISOR_HOST: ${BACKEND_SUPERVISOR_HOST}
BACKEND_SUPERVISOR_PORT: ${BACKEND_SUPERVISOR_PORT}
MON_SUPERVISOR_HOST: ${MON_SUPERVISOR_HOST}
MON_SUPERVISOR_PORT: ${MON_SUPERVISOR_PORT}
REDIS_HOST: ${REDIS_HOST}
REDIS_PORT: ${REDIS_PORT}
HASURA_HOST: ${HASURA_HOST}
HASURA_PORT: ${HASURA_PORT}
HASURA_GRAPHQL_ACCESS_KEY: ${HASURA_SECRET_KEY}
GUI_ENABLED: ${GUI_ENABLED}
HIJACK_LOG_FILTER: ${HIJACK_LOG_FILTER}
MON_TIMEOUT_LAST_BGP_UPDATE: ${MON_TIMEOUT_LAST_BGP_UPDATE}
# for backwards compatibility
SUPERVISOR_HOST: ${BACKEND_SUPERVISOR_HOST}
SUPERVISOR_PORT: ${BACKEND_SUPERVISOR_PORT}
HISTORIC: ${HISTORIC}
HIJACK_LOG_FIELDS: ${HIJACK_LOG_FIELDS}
monitor:
image: artemis_monitor
build: ./monitor/
container_name: monitor
depends_on:
- rabbitmq
networks:
- artemis
expose:
- ${MON_SUPERVISOR_PORT}
environment:
RABBITMQ_USER: ${RABBITMQ_USER}
RABBITMQ_PASS: ${RABBITMQ_PASS}
RABBITMQ_HOST: ${RABBITMQ_HOST}
RABBITMQ_PORT: ${RABBITMQ_PORT}
DB_USER: ${DB_USER}
DB_PASS: ${DB_PASS}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_NAME: ${DB_NAME}
RIS_ID: ${RIS_ID}
BACKEND_SUPERVISOR_HOST: ${BACKEND_SUPERVISOR_HOST}
BACKEND_SUPERVISOR_PORT: ${BACKEND_SUPERVISOR_PORT}
MON_SUPERVISOR_HOST: ${MON_SUPERVISOR_HOST}
MON_SUPERVISOR_PORT: ${MON_SUPERVISOR_PORT}
REDIS_HOST: ${REDIS_HOST}
REDIS_PORT: ${REDIS_PORT}
HISTORIC: ${HISTORIC}
frontend:
image: artemis_frontend
build: ./frontend/
container_name: frontend
depends_on:
- rabbitmq
- postgres
- postgrest
- backend
- monitor
networks:
- artemis
expose:
- ${WEBAPP_PORT}
environment:
RABBITMQ_USER: ${RABBITMQ_USER}
RABBITMQ_PASS: ${RABBITMQ_PASS}
RABBITMQ_HOST: ${RABBITMQ_HOST}
RABBITMQ_PORT: ${RABBITMQ_PORT}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
API_HOST: ${API_HOST}
API_PORT: ${API_PORT}
HASURA_HOST: ${HASURA_HOST}
HASURA_PORT: ${HASURA_PORT}
SYSTEM_VERSION: ${SYSTEM_VERSION}
BIND_IP: ${BIND_IP}
WEBAPP_PORT: ${WEBAPP_PORT}
USER_ROOT_USERNAME: ${ADMIN_USER}
USER_ROOT_PASSWORD: ${ADMIN_PASS}
USER_ROOT_EMAIL: ${ADMIN_EMAIL}
BACKEND_SUPERVISOR_HOST: ${BACKEND_SUPERVISOR_HOST}
BACKEND_SUPERVISOR_PORT: ${BACKEND_SUPERVISOR_PORT}
MON_SUPERVISOR_HOST: ${MON_SUPERVISOR_HOST}
MON_SUPERVISOR_PORT: ${MON_SUPERVISOR_PORT}
JWT_SECRET_KEY: ${JWT_SECRET_KEY}
FLASK_SECRET_KEY: ${FLASK_SECRET_KEY}
JS_VERSION: ${JS_VERSION}
SECURITY_PASSWORD_SALT: ${SECURITY_PASSWORD_SALT}
# for backwards compatibility
SUPERVISOR_HOST: ${BACKEND_SUPERVISOR_HOST}
SUPERVISOR_PORT: ${BACKEND_SUPERVISOR_PORT}
nginx:
image: nginx:1.15-alpine
container_name: nginx
restart: always
depends_on:
- frontend
- postgrest
networks:
- artemis
expose:
- 8080 # HTTP
- 8443 # HTTPS
ports:
- "8080:8080"
- "8443:8443"
volumes:
- ./testcafe/configs/nginx.conf:/etc/nginx/nginx.conf
- ./frontend/webapp/configs/certs/:/etc/nginx/certs/
rabbitmq:
image: rabbitmq:3.7.8-management-alpine
container_name: rabbitmq
restart: always
networks:
- artemis
expose:
- ${RABBITMQ_PORT}
# - 15672 management port
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASS}
volumes:
- ./other/rabbitmq/enabled-plugins:/etc/rabbitmq/enabled_plugins
postgres:
image: timescale/timescaledb:1.1.0-pg10
container_name: postgres
restart: always
networks:
- artemis
expose:
- ${DB_PORT}
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASS}
DB_BACKUP: ${DB_BACKUP}
DB_AUTOCLEAN: ${DB_AUTOCLEAN}
DB_HIJACK_DORMANT: ${DB_HIJACK_DORMANT}
volumes:
- ./other/postgres-entrypoint.sh:/postgres-entrypoint.sh
- ./other/db/init.sql:/docker-entrypoint-initdb.d/zinit.sql
- ./other/db/data/:/docker-entrypoint-initdb.d/data/
- ./other/db/libs/:/docker-entrypoint-initdb.d/libs/
entrypoint: ["./postgres-entrypoint.sh"]
postgrest:
image: postgrest/postgrest:v5.2.0
container_name: postgrest
restart: always
depends_on:
- postgres
- backend
networks:
- artemis
expose:
- ${API_PORT}
environment:
PGRST_DB_URI: postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}
PGRST_DB_SCHEMA: ${DB_SCHEMA}
PGRST_DB_ANON_ROLE: ${DB_USER}
pg-amqp-bridge:
image: subzerocloud/pg-amqp-bridge:0.0.6
container_name: pg-amqp-bridge
depends_on:
- postgres
- backend
- rabbitmq
networks:
- artemis
environment:
- POSTGRESQL_URI=postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}
- AMQP_URI=amqp://${RABBITMQ_USER}:${RABBITMQ_PASS}@${RABBITMQ_HOST}:${RABBITMQ_PORT}//
- BRIDGE_CHANNELS=events:amq.direct
# - RUST_LOG=debug
# - RUST_BACKTRACE=1
volumes:
- ./backend/wait-for:/root/wait-for
command: ["/root/wait-for", "${RABBITMQ_HOST}:${RABBITMQ_PORT}", "-t", "0", "--", "pg-amqp-bridge"]
graphql:
image: hasura/graphql-engine:v1.0.0-alpha45
container_name: graphql
restart: always
depends_on:
- postgres
networks:
- artemis
expose:
- ${HASURA_PORT}
environment:
HASURA_GRAPHQL_DATABASE_URL: postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}
HASURA_GRAPHQL_ACCESS_KEY: ${HASURA_SECRET_KEY}
HASURA_GRAPHQL_ENABLE_CONSOLE: ${HASURA_GUI}
HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS256", "key":"${JWT_SECRET_KEY}"}'
command:
- graphql-engine
- serve

networks:
artemis:
2 changes: 1 addition & 1 deletion frontend/webapp/render/templates/admin/system.htm
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ <h1 class="page-header">System</h1>
});
comment_editor.setSize("100%", 140);

const ws = new WebSocket('wss://' + window.location.hostname + '/api/graphql', 'graphql-ws');
const ws = new WebSocket('wss://' + window.location.host + '/api/graphql', 'graphql-ws');
ws.addEventListener('open', (event) => {
fetch("/jwt/auth", {
method: "GET",
Expand Down
2 changes: 1 addition & 1 deletion frontend/webapp/render/templates/main/bgpupdates.htm
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ <h1>Additional actions</h1>
}

$(document).ready(function(){
ws = new WebSocket('wss://' + window.location.hostname + '/api/graphql', 'graphql-ws');
ws = new WebSocket('wss://' + window.location.host + '/api/graphql', 'graphql-ws');
ws.addEventListener('open', (event) => {
fetch("/jwt/auth", {
method: "GET",
Expand Down
2 changes: 1 addition & 1 deletion frontend/webapp/render/templates/main/hijack.htm
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ <h5 class="modal-title" id="deleteHijacksModalLabel">Delete Hijack</h5>

$(document).ready(function(){

ws = new WebSocket('wss://' + window.location.hostname + '/api/graphql', 'graphql-ws');
ws = new WebSocket('wss://' + window.location.host + '/api/graphql', 'graphql-ws');
ws.addEventListener('open', (event) => {
fetch("/jwt/auth", {
method: "GET",
Expand Down
2 changes: 1 addition & 1 deletion frontend/webapp/render/templates/main/hijacks.htm
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ <h5 class="modal-title" id="deleteHijacksModalLabel">Delete Hijack(s)</h5>
$(document).ready(function(){
display_time_selection(custom_time);

ws = new WebSocket('wss://' + window.location.hostname + '/api/graphql', 'graphql-ws');
ws = new WebSocket('wss://' + window.location.host + '/api/graphql', 'graphql-ws');
ws.addEventListener('open', (event) => {
fetch("/jwt/auth", {
method: "GET",
Expand Down
2 changes: 1 addition & 1 deletion frontend/webapp/render/templates/main/overview.htm
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ <h1 class="page-header">Dashboard</h1>
);

$(document).ready(() => {
const ws = new WebSocket('wss://' + window.location.hostname + '/api/graphql', 'graphql-ws');
const ws = new WebSocket('wss://' + window.location.host + '/api/graphql', 'graphql-ws');
ws.addEventListener('open', (event) => {
fetch("/jwt/auth", {
method: "GET",
Expand Down
1 change: 1 addition & 0 deletions monitor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ RUN mkdir -p /etc/artemis/ && \
mkdir -p /var/log/artemis/

COPY ./configs/* /etc/artemis/
COPY ./supervisor.d/* /etc/supervisor/conf.d/

ENTRYPOINT ["./entrypoint"]
61 changes: 61 additions & 0 deletions testcafe/configs/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
worker_processes 1;

events { worker_connections 1024; }

http {

server {
listen 8080 default_server;
server_name _;
return 301 https://$host$request_uri;
}

server {
listen 8443 ssl;
resolver localhost;
error_page 497 https://$host:$server_port$request_uri;

location = /api/graphql {
proxy_pass http://graphql:8080/v1alpha1/graphql;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Ssl on;
}

location / {
# nginx ACL
# allow <ACCESS_PREFIX_1>;
# ...
# allow <ACCESS_PREFIX_N>;
# deny all;
proxy_pass http://frontend:8000/;
proxy_redirect off;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
}
ssl_certificate /etc/nginx/certs/cert.pem;
ssl_certificate_key /etc/nginx/certs/key.pem;

# let's encrypt configuration
# ssl_certificate /etc/letsencrypt/live/<domain_name>/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/<domain_name>/privkey.pem;
# include /etc/letsencrypt/options-ssl-nginx.conf;
# ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
gzip on;
gzip_proxied any;
gzip_types
text/css
text/javascript
text/xml
text/plain
application/javascript
application/x-javascript
application/json;
}

}
Loading

0 comments on commit e58c206

Please sign in to comment.