many changes

This commit is contained in:
l 2024-06-25 11:00:22 +05:00
parent 6ed21a40cf
commit 2485a85515
13 changed files with 129 additions and 165 deletions

1
dev.sh
View File

@ -1 +0,0 @@
docker compose --env-file .env.dev -f traefik.yml up

View File

@ -1,81 +0,0 @@
name: "server"
services:
traefik:
extends:
file: traefik.yml
service: traefik
networks:
- proxynet
nginx:
extends:
file: nginx.yml
service: nginx
networks:
- proxynet
nginx-demo:
extends:
file: nginx-demo.yml
service: nginx-demo
networks:
- proxynet
node-demo:
extends:
file: node-demo.yml
service: node-demo
networks:
- proxynet
#- internal
postgres:
extends:
file: postgres.yml
service: postgres
networks:
- proxynet
#- internal
pgadmin:
extends:
file: pgadmin.yml
service: pgadmin
networks:
- proxynet
gitea:
extends:
file: gitea.yml
service: gitea
networks:
- proxynet
gitea-cache:
extends:
file: gitea-cache.yml
service: gitea-cache
networks:
- proxynet
initContainers:
container_name: volume-permissions
image: busybox:1.36.1-glibc
command: >
sh -c "touch /letsencrypt/acme.json &&
chmod -Rv 600 /letsencrypt/* &&
chown 65532:65532 /letsencrypt/acme.json &&
chmod 755 /init-db/init-database.sh"
#command: ["sh", "-c", "touch /letsencrypt/acme.json && chmod -Rv 600 /letsencrypt/* && chown 65532:65532 /letsencrypt/acme.json && chmod 755 /init-db/init-database.sh"]
volumes:
- ./secrets/letsencrypt:/letsencrypt
- ./init-db:/init-db
networks:
proxynet:
driver: bridge
external: false
#internal:

View File

@ -1,16 +0,0 @@
services:
gitea-cache:
container_name: gitea-cache
image: redis:7.2.5-alpine3.20
restart: always
networks:
- proxynet
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 15s
timeout: 3s
retries: 30
logging:
driver: "json-file"
options:
max-size: "1m"

View File

@ -17,7 +17,6 @@ services:
- ROOT_URL=https://gitea.${DOMAIN}
- SSH_PORT=222
- SSH_LISTEN_PORT=22
#- DB_TYPE=sqlite3
- GITEA__cache__ENABLED=true
- GITEA__cache__ADAPTER=redis
- GITEA__cache__HOST=redis://gitea-cache:6379/0?pool_size=100&idle_timeout=180s
@ -54,4 +53,20 @@ services:
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "222:22"
- "222:22"
gitea-cache:
container_name: gitea-cache
image: redis:7.2.5-alpine3.20
restart: always
networks:
- proxynet
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 15s
timeout: 3s
retries: 30
logging:
driver: "json-file"
options:
max-size: "1m"

View File

@ -1,19 +0,0 @@
services:
gitlab:
image: gitlab/gitlab-ce:17.1.0-ce.0
container_name: gitlab
restart: always
hostname: 'gitlab.corp.hm'
environment:
GITLAB_OMNIBUS_CONFIG: |
# Add any other gitlab.rb configuration here, each on its own line
external_url 'https://gitlab.corp.hm'
ports:
- '80:80'
- '443:443'
- '22:22'
volumes:
- '$GITLAB_HOME/config:/etc/gitlab'
- '$GITLAB_HOME/logs:/var/log/gitlab'
- '$GITLAB_HOME/data:/var/opt/gitlab'
shm_size: '256m'

View File

@ -1,3 +0,0 @@
CREATE DATABASE checkers;
CREATE USER checkers WITH ENCRYPTED PASSWORD '477iyetc44i2th6za8r7';
GRANT ALL PRIVILEGES ON DATABASE checkers TO checkers;

View File

@ -13,10 +13,17 @@ services:
POSTGRES_DB: postgres
volumes:
- ./data/pgdata:/var/lib/postgresql/data
#- ./init-db:/docker-entrypoint-initdb.d
- ./init-db/init-database.sh:/docker-entrypoint-initdb.d/init-database.sh
labels:
- "traefik.enable=true"
- "traefik.tcp.routers.postgresql.rule=HostSNI(`*`)"
- "traefik.tcp.services.postgresql.loadbalancer.server.port=5432"
- "traefik.tcp.routers.postgresql.entrypoints=postgres"
- "traefik.tcp.routers.postgresql.entrypoints=postgres"
initContainers:
container_name: volume-permissions
image: busybox:1.36.1-glibc
command: >
sh -c "chmod 755 /init-db/init-database.sh"
volumes:
- ./init-db:/init-db

View File

@ -1 +0,0 @@
docker compose --env-file .env.prod -f docker-compose.yml up

View File

@ -1 +1,63 @@
Srerver Docker Config
Init:
sudo git clone git@rozenlab.com:leo/repo-server.git && sudo docker network create proxynet && sudo chmod +x ./repo-server/start.sh
---------------------------------------------------------------------
All run:
sudo ./start.sh
---------------------------------------------------------------------
Traefik run:
Development:
sudo docker compose --env-file .env.dev -f traefik.yml up -d
Production:
sudo docker compose --env-file .env.prod -f traefik.yml up -d
---------------------------------------------------------------------
Gitea run:
Development:
sudo docker compose --env-file .env.dev -f gitea.yml up -d
Production:
sudo docker compose --env-file .env.prod -f gitea.yml up -d
---------------------------------------------------------------------
Postgres run:
Development:
sudo docker compose -f postgres.yml up -d
Production:
sudo docker compose -f postgres.yml up -d
---------------------------------------------------------------------
Pgadmin run:
Development:
sudo docker compose --env-file .env.dev -f pgadmin.yml up -d
Production:
sudo docker compose --env-file .env.prod -f pgadmin.yml up -d
---------------------------------------------------------------------
Nginx run:
Development:
sudo docker compose --env-file .env.dev -f nginx.yml up -d
Production:
sudo docker compose --env-file .env.prod -f nginx.yml up -d
---------------------------------------------------------------------

View File

@ -1,25 +0,0 @@
PORT=5000
POSTGRES_HOST=postgres
POSTGRES_USER=checkers
POSTGRES_DB=checkers
POSTGRESS_PASSWORD=477iyetc44i2th6za8r7
POSTGRES_PASSWORD=477iyetc44i2th6za8r7
POSTGRESS_PORT=5432
POSTGRES_PORT=5432
PRIVATE_KEY=secret_key_safasf
JWT_ACCESS_SECRET=7xTJ7WmRGZHGZGRih9w6pLSLvcbz2jpM
JWT_REFRESH_SECRET=ikuwEkxy2xctmSpQLpfw4vdGs6bk9dq3
SMTP_HOST="smtp.beget.com"
SMTP_PORT=465
X_SMTP_USER=checkers@rozenlab.com
SMTP_USER=messenger@rozenlab.com
X_SMTP_PASSWORD=X$sory79bak3yen3jzba
SMTP_PASSWORD=M$sory79bak3yen3jzba
API_URL=https://chback.rozenlab.com:7878
XCLIENT_URL=https://192.168.1.2:9500
CLIENT_URL=https://localhost
ACCESS_TOKEN_MAX_AGE=70d
REFRESH_TOKEN_MAX_AGE=70d
COOKIE_REFRESH_TOKEN_MAX_AGE=6048000000
XHTTPS_ENABLE=false
HTTPS_ENABLE=true

29
start.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo "Please provide the environment type as an argument"
exit 1
fi
ENV_TYPE="$1" # dev / prod
echo "Start server on environment $ENV_TYPE..."
#Traefik run:
sudo docker compose --env-file .env.$ENV_TYPE -f traefik.yml up -d
#Gitea run:
sudo docker compose --env-file .env.$ENV_TYPE -f gitea.yml up -d
#Postgres run:
sudo docker compose -f postgres.yml up -d
#Pgadmin run:
sudo docker compose --env-file .env.$ENV_TYPE -f pgadmin.yml up -d
#Nginx run:
sudo docker compose --env-file .env.$ENV_TYPE -f nginx.yml up -d
echo "All successfully started to environment $ENV_TYPE."

View File

@ -8,10 +8,6 @@ services:
env_file:
- ./secrets/vars.env
command:
#tls:
#certificates:
#- certFile: /secrets/selfsigned/selfsigned.crt
#keyFile: /secrets/selfsigned/selfsigned.key
- "--providers.file.filename=/traefik/certs.yml"
- "--api.insecure=false"
- "--api.dashboard=true"
@ -56,6 +52,17 @@ services:
options:
max-size: "1m"
initContainers:
container_name: volume-permissions
image: busybox:1.36.1-glibc
command: >
sh -c "touch /letsencrypt/acme.json &&
chmod -Rv 600 /letsencrypt/* &&
chown 65532:65532 /letsencrypt/acme.json &&
volumes:
- ./secrets/letsencrypt:/letsencrypt
networks:
proxynet:
driver: bridge

View File

@ -1,10 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Docker Nginx</title>
</head>
<body>
<h2>DEMO</h2>
</body>
</html>