Skip to content
Snippets Groups Projects
Commit 05defba4 authored by Nils Schneider's avatar Nils Schneider
Browse files

initial commit

parents
No related branches found
No related tags found
No related merge requests found
# Geoblocking
We use nginx geoblocking to restrict access from within nobreakspace. Edit ```nginx/default.conf``` (change default 1 to default 0) during development to gain access.
# Build
Build all docker containers
docker-compose build
# Database management
Data is stored in the ```icebox-data``` directory in the parent directory. Please be careful not to touch anything within this directory!
Start the database
docker-compose up -d database
Import database dump
docker container exec -i $(docker-compose ps -q database) psql -U icebox icebox < icebox.sql
Create a database dump
docker-compose exec -T database pg_dump -U icebox icebox > icebox.sql
Be careful not to commit ```icebox.sql``` by accident if you play around!
If you need to recreate the databse, you can use ```jake db:create```. Refer to icebox documentation for more information about this.
# Start and stop
Just run
docker-compose up
or in the background
docker-compose up -d
or stop it again
docker-compose down
FROM node:8
WORKDIR /code
RUN git clone https://github.com/MotieDesign101/iceBoxAlias.git/ /code
RUN npm install
CMD node alias.js
run jake db:create to create database
FROM node:8
WORKDIR /code
RUN git clone https://github.com/BenBE/icebox-service.git/ /code
RUN npm install
CMD node server.js
run jake db:create to create database
version: '3'
services:
web:
build: web
links:
- backend
environment:
ICEBOX_API_HOST: backend
ICEBOX_API_PORT: 8081
ICEBOX_WEB_PORT: 8080
alias:
build: alias
environment:
- ICEBOX_DB_URL=postgresql://icebox:clubmate42@database/icebox
links:
- database
backend:
build: backend
links:
- database
environment:
ICEBOX_DB_HOST: database
ICEBOX_DB_PORT: 5432
ICEBOX_DB_USER: icebox
ICEBOX_DB_PSW: clubmate42
ICEBOX_DB_NAME: icebox
nginx:
build: nginx
ports:
- "80:80"
- "8081:8081"
- "8085:8085"
links:
- web
- alias
- backend
database:
image: postgres
environment:
POSTGRES_PASSWORD: clubmate42
POSTGRES_USER: icebox
POSTGRES_DB: icebox
volumes:
- ../icebox-data:/var/lib/postgresql/data
FROM nginx
COPY default.conf /etc/nginx/conf.d/default.conf
COPY favicon.ico /usr/share/nginx/html/
geo $icebox_delivery_area {
default 1;
127.0.0.0/8 0;
172.23.208.0/23 0;
fe80::/10 0;
2a01:170:1112::/64 0;
}
# Webinterface
server {
listen 80 default_server;
client_max_body_size 4G;
server_name icebox.nobreakspace.org;
keepalive_timeout 5;
location / {
default_type text/html;
if ( $icebox_delivery_area ) {
add_header Content-Type text/html;
return 451 "<h1>This service is not available in your country!</h1>\n";
}
proxy_buffering off;
proxy_pass http://web:8080/;
proxy_pass_header Server;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
}
location /favicon.ico {
root /usr/share/nginx/html;
}
}
# API
server {
listen 8081 default_server;
client_max_body_size 4G;
server_name icebox.nobreakspace.org;
keepalive_timeout 5;
location / {
default_type text/html;
if ( $icebox_delivery_area ) {
add_header Content-Type text/html;
return 451 "<h1>This service is not available in your country!</h1>\n";
}
proxy_buffering off;
proxy_pass http://backend:8081/;
proxy_pass_header Server;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
}
}
# Alias Service
server {
listen 8085 default_server;
client_max_body_size 4G;
server_name icebox.nobreakspace.org;
keepalive_timeout 5;
location / {
default_type text/html;
if ( $icebox_delivery_area ) {
add_header Content-Type text/html;
return 451 "<h1>This service is not available in your country!</h1>\n";
}
proxy_buffering off;
proxy_pass http://alias:8085/;
proxy_pass_header Server;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
}
}
nginx/favicon.ico

5.3 KiB

FROM node:8
WORKDIR /code
RUN git clone https://github.com/BenBE/IceBoxWebClient.git/ /code
RUN npm install
CMD node website.js
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment