From d481a60a8097be8f7b28593af156dcb5ac299721 Mon Sep 17 00:00:00 2001 From: Adrien Luxey Date: Thu, 7 May 2020 09:07:40 +0200 Subject: [PATCH] now gitea works --- deployer/group_vars/all/vars.yml | 2 +- .../templates/gitea/docker-compose.yml.j2 | 19 +---- .../roles/build/templates/gitea/nginx.host.j2 | 2 +- .../build/templates/gitea/nginx/Dockerfile.j2 | 5 -- .../build/templates/gitea/nginx/nginx.conf.j2 | 79 ------------------- 5 files changed, 3 insertions(+), 104 deletions(-) delete mode 100644 deployer/roles/build/templates/gitea/nginx/Dockerfile.j2 delete mode 100644 deployer/roles/build/templates/gitea/nginx/nginx.conf.j2 diff --git a/deployer/group_vars/all/vars.yml b/deployer/group_vars/all/vars.yml index b97ab00..f963dbd 100644 --- a/deployer/group_vars/all/vars.yml +++ b/deployer/group_vars/all/vars.yml @@ -116,7 +116,7 @@ sites: # Subnet addresses subnet_cidr_address: 172.27.6.0/24 subnet_gateway_ip: 172.27.6.1 - subnet_nginx_ip: 172.27.6.2 + # subnet_nginx_ip: 172.27.6.2 subnet_site_ip: 172.27.6.3 # User ID (git on remote) user_uid: 1007 diff --git a/deployer/roles/build/templates/gitea/docker-compose.yml.j2 b/deployer/roles/build/templates/gitea/docker-compose.yml.j2 index 48e82a4..69e6e5e 100644 --- a/deployer/roles/build/templates/gitea/docker-compose.yml.j2 +++ b/deployer/roles/build/templates/gitea/docker-compose.yml.j2 @@ -2,7 +2,6 @@ version: '3' # Generated by ansible for site {{ site.url }} # On network {{ site.subnet_cidr_address }}: -# - web server (nginx) at {{ site.subnet_nginx_ip }} # - site (gitea) at {{ site.subnet_site_ip }} services: @@ -12,8 +11,7 @@ services: restart: always environment: APP_NAME: "Gitea: git with a cup of coffee" - # DOMAIN: "{{ site.url }}" - # ROOT_URL: "{{ site.url }}" + DOMAIN: "{{ site.url }}" USER_UID: "{{ site.user_uid }}" USER_GID: "{{ site.user_gid }}" DB_TYPE: mysql @@ -29,24 +27,9 @@ services: net: ipv4_address: "{{ site.subnet_site_ip }}" - nginx: - build: nginx - restart: always - depends_on: - - site - volumes: - - "{{ site_data_path }}:/data" - networks: - net: - ipv4_address: "{{ site.subnet_nginx_ip }}" - - networks: net: ipam: driver: default config: - subnet: "{{ site.subnet_cidr_address }}" - -volumes: - html_data: diff --git a/deployer/roles/build/templates/gitea/nginx.host.j2 b/deployer/roles/build/templates/gitea/nginx.host.j2 index 96af935..7a335d1 100644 --- a/deployer/roles/build/templates/gitea/nginx.host.j2 +++ b/deployer/roles/build/templates/gitea/nginx.host.j2 @@ -49,6 +49,6 @@ server { location / { include snippets/header-params_location.conf; - proxy_pass http://{{ site.subnet_nginx_ip }}:80; + proxy_pass http://{{ site.subnet_site_ip }}:3000; } } diff --git a/deployer/roles/build/templates/gitea/nginx/Dockerfile.j2 b/deployer/roles/build/templates/gitea/nginx/Dockerfile.j2 deleted file mode 100644 index 1201821..0000000 --- a/deployer/roles/build/templates/gitea/nginx/Dockerfile.j2 +++ /dev/null @@ -1,5 +0,0 @@ -FROM nginx:latest -COPY nginx.conf /etc/nginx/nginx.conf - -# Should be UID & GID=33 -# USER www-data:www-data \ No newline at end of file diff --git a/deployer/roles/build/templates/gitea/nginx/nginx.conf.j2 b/deployer/roles/build/templates/gitea/nginx/nginx.conf.j2 deleted file mode 100644 index c08bc69..0000000 --- a/deployer/roles/build/templates/gitea/nginx/nginx.conf.j2 +++ /dev/null @@ -1,79 +0,0 @@ -user www-data www-data; -worker_processes 1; - -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - - -http { - charset utf-8; - - include /etc/nginx/mime.types; - default_type application/octet-stream; - - set_real_ip_from {{ site.subnet_gateway_ip }}; - log_format main '$http_x_real_ip - $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; - - ## - # Basic Settings - ## - - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 15s; - types_hash_max_size 2048; - server_tokens off; - client_max_body_size 10M; - client_body_timeout 60; - # server_names_hash_bucket_size 64; - server_name_in_redirect off; - - - ## - # Gzip Settings - ## - - gzip on; - gzip_disable "msie6"; - - gzip_vary on; - gzip_proxied any; - gzip_comp_level 6; - gzip_buffers 16 8k; - gzip_http_version 1.1; - gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; - - - include /etc/nginx/conf.d/*.conf; - - - server { - listen 80; - listen [::]:80; - server_name {{ site.url }} www.{{ site.url }}; - - root /data; - - location / { - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $http_host; - proxy_set_header X-Url-Scheme $scheme; - proxy_redirect off; - proxy_max_temp_file_size 0; - proxy_read_timeout 120; - - proxy_pass http://{{ site.subnet_site_ip }}:3000; - } - } -} \ No newline at end of file