Skip to content

Commit

Permalink
[!] change svr ip
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhongFuze committed May 24, 2024
1 parent 785e776 commit 2a30ba7
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 3 deletions.
14 changes: 12 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ services:
- "9002:9001"
depends_on:
- id_allocation
networks:
put_net:
ipv4_address: 192.168.100.2

id_allocation:
image: ghcr.io/zhongfuze/id_allocation:main
Expand All @@ -23,6 +26,13 @@ services:
- ~/app/log:/app/log
ports:
- "9001:9001"
networks:
put_net:
ipv4_address: 192.168.100.3

networks:
default:
driver: bridge
put_net:
driver: bridge
ipam:
config:
- subnet: 192.168.100.0/24
28 changes: 28 additions & 0 deletions docker-compose.yml.bak2
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3.9"
services:
nginx:
image: nginx
container_name: nginx
volumes:
- ~/app/nginx/nginx.conf:/etc/nginx/nginx.conf
- ~/app/nginx/conf.d:/etc/nginx/conf.d
- ~/app/nginx/logs:/var/log/nginx
- ~/app/nginx/ssl:/etc/ssl
ports:
- "9002:9001"
depends_on:
- id_allocation

id_allocation:
image: ghcr.io/zhongfuze/id_allocation:main
container_name: id_allocation
volumes:
- ~/app/data:/app/data
- ~/app/config:/app/config
- ~/app/log_tmp:/tmp
- ~/app/log:/app/log
ports:
- "9001:9001"
networks:
default:
driver: bridge
47 changes: 47 additions & 0 deletions src/config/nginx/nginx.conf.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;

keepalive_timeout 65;

include /etc/nginx/conf.d/*.conf;

server {
listen 9001;
server_name ec2-18-167-19-252.ap-east-1.compute.amazonaws.com;

# Deny access to all resources by default
location / {
deny all;
return 403;
}

# Allow access to the specific endpoint
location /id_allocation/allocation {
allow all;
proxy_pass http://192.168.100.3:9001;
proxy_set_header Host $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;
}
}
}
2 changes: 1 addition & 1 deletion src/httpsvr/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class HttpSvrConfig():
"""config is an toml object"""
def __init__(self, config):
self.ip = ""
self.ip = config["server"]["ip"]
self.port = config["server"]["port"]
self.work_path = config["server"]["work_path"]
self.server_name = config["server"]["server_name"]
Expand Down

0 comments on commit 2a30ba7

Please sign in to comment.