Skip to content

Docker deploy support #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: iKy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,37 @@ Visit the Gitlab Page of the [Project](https://kennbroorg.gitlab.io/ikyweb/)
<img alt="twitch" src="https://img.shields.io/badge/module-twitch-blue.svg?style=flat-square">
</div>

## Docker deploy

### Clone repository

```shell
git clone https://gitlab.com/kennbroorg/iKy.git
```
### Create credentials

```shell
sudo sh -c "echo -n 'user1:' >> auth/nginx.htpasswd"
sudo sh -c "openssl passwd -apr1 >> auth/nginx.htpasswd"
```

### Install tor (optional, for Darkpass)

```shell
apt install tor
nano /etc/proxychains.conf
add # on strict_chain
remove # from dynamic_chain
service tor restart
```

### Run docker

```shell
docker-compose up --build
```
Open browser at: http://[public-ip]:4201

<h1 id="installation">Installation</h1>

<div align="left" style="margin-bottom: 10px;">
Expand Down
69 changes: 69 additions & 0 deletions auth/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
events {
worker_connections 1024;
}

http {

upstream docker-frontend {
server frontend:4200;
}

upstream docker-backend {
server backend:5000;
}

map $upstream_http_docker_distribution_api_version $docker_distribution_api_version {
'' 'registry/2.0';
}

server {
listen 4201;

client_max_body_size 0;

chunked_transfer_encoding on;

location / {

if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
}

auth_basic "Registry realm";
auth_basic_user_file /etc/nginx/conf.d/nginx.htpasswd;

add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;

proxy_pass http://docker-frontend;
proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
}

location /backend/ {

if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
}

auth_basic "Registry realm";
auth_basic_user_file /etc/nginx/conf.d/nginx.htpasswd;

add_header 'Docker-Distribution-Api-Version' $docker_distribution_api_version always;

proxy_pass http://docker-backend/;
proxy_set_header Host $http_host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
}
}

}
21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
version: '3'
services:
nginx:
image: "nginx:alpine"
ports:
- "4201:4201"
- "5001:5001"
links:
- registry:registry
volumes:
- ./auth:/etc/nginx/conf.d
- ./auth/nginx.conf:/etc/nginx/nginx.conf:ro

registry:
image: registry:2
volumes:
- ./data:/var/lib/registry

tor:
image: dperson/torproxy
ports:
- "8118:8118"
- "9050:9050"
frontend:
build:
context: .
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/@core/data/data-gather-info.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class DataGatherInfoService {
/* Http Service */
// private readonly gatherUrl: string = environment.apiUrl + 'pub/items';
// TODO : Use environment to set gatherUrl
private readonly gatherUrl: string = 'http://127.0.0.1:5000/';
private readonly gatherUrl: string = 'http://' + window.location.host.split(":")[0] + ':4201/backend/';

// Get test
public postTest$(): Observable<any> {
Expand Down