Done
This commit is contained in:
18
deploy/docker/Dockerfile
Normal file
18
deploy/docker/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
FROM golang:1.20 AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN go build -o firewall
|
||||
|
||||
FROM debian:bullseye
|
||||
RUN apt-get update && apt-get install -y sqlite3
|
||||
|
||||
COPY --from=builder /app/firewall /usr/local/bin/
|
||||
COPY scripts/init_admin.sh .
|
||||
|
||||
RUN sqlite3 /var/lib/firewall.db < scripts/init_db.sql && \
|
||||
chmod +x init_admin.sh && \
|
||||
./init_admin.sh && \
|
||||
rm init_admin.sh
|
||||
|
||||
CMD ["firewall"]
|
14
deploy/nginx/firewall.conf
Normal file
14
deploy/nginx/firewall.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name firewall.example.com;
|
||||
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /var/www/firewall-frontend;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
}
|
12
deploy/systemd/firewall-frontend.service
Normal file
12
deploy/systemd/firewall-frontend.service
Normal file
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Firewall Frontend Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/opt/firewall/frontend
|
||||
ExecStart=/usr/bin/npm run preview -- --port 3000 --host 0.0.0.0
|
||||
Restart=always
|
||||
User=www-data
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
13
deploy/systemd/firewall.service
Normal file
13
deploy/systemd/firewall.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Firewall Management Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/opt/firewall/config/.env
|
||||
WorkingDirectory=/opt/firewall/backend
|
||||
ExecStart=/usr/local/bin/firewall
|
||||
Restart=always
|
||||
User=firewall-user
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user