Use host networking for gitea

Change-Id: If706c6f85022919add93e46eeb6eae1b6d948d75
This commit is contained in:
James E. Blair 2019-02-15 15:59:26 -08:00
parent f74ff2bdb7
commit 480c7ebe37
4 changed files with 12 additions and 15 deletions

View File

@ -43,7 +43,7 @@
chdir: /etc/gitea-docker/ chdir: /etc/gitea-docker/
- name: Check if root user exists - name: Check if root user exists
uri: uri:
url: "https://localhost/api/v1/users/root" url: "https://localhost:3000/api/v1/users/root"
validate_certs: false validate_certs: false
status_code: 200, 404 status_code: 200, 404
register: root_user_check register: root_user_check
@ -58,7 +58,7 @@
no_log: true no_log: true
- name: Check if gerrit user exists - name: Check if gerrit user exists
uri: uri:
url: "https://localhost/api/v1/users/gerrit" url: "https://localhost:3000/api/v1/users/gerrit"
validate_certs: false validate_certs: false
status_code: 200, 404 status_code: 200, 404
register: gerrit_user_check register: gerrit_user_check
@ -66,7 +66,7 @@
when: gerrit_user_check.status==404 when: gerrit_user_check.status==404
no_log: true no_log: true
uri: uri:
url: "https://localhost/api/v1/admin/users" url: "https://localhost:3000/api/v1/admin/users"
validate_certs: false validate_certs: false
method: POST method: POST
user: root user: root
@ -87,7 +87,7 @@
user: root user: root
password: "{{ gitea_root_password }}" password: "{{ gitea_root_password }}"
force_basic_auth: true force_basic_auth: true
url: "https://localhost/api/v1/users/gerrit/keys" url: "https://localhost:3000/api/v1/users/gerrit/keys"
validate_certs: false validate_certs: false
status_code: 200 status_code: 200
register: gerrit_key_check register: gerrit_key_check
@ -99,7 +99,7 @@
user: root user: root
password: "{{ gitea_root_password }}" password: "{{ gitea_root_password }}"
force_basic_auth: true force_basic_auth: true
url: "https://localhost/api/v1/user/keys/{{ gerrit_key_check.json[0].id }}" url: "https://localhost:3000/api/v1/user/keys/{{ gerrit_key_check.json[0].id }}"
validate_certs: false validate_certs: false
method: DELETE method: DELETE
status_code: 204 status_code: 204
@ -110,7 +110,7 @@
user: root user: root
password: "{{ gitea_root_password }}" password: "{{ gitea_root_password }}"
force_basic_auth: true force_basic_auth: true
url: "https://localhost/api/v1/admin/users/gerrit/keys" url: "https://localhost:3000/api/v1/admin/users/gerrit/keys"
validate_certs: false validate_certs: false
method: POST method: POST
status_code: 201 status_code: 201

View File

@ -19,11 +19,10 @@ CERT_FILE = /certs/cert.pem
KEY_FILE = /certs/key.pem KEY_FILE = /certs/key.pem
REDIRECT_OTHER_PORT = true REDIRECT_OTHER_PORT = true
PORT_TO_REDIRECT = 3080 PORT_TO_REDIRECT = 3080
LOCAL_ROOT_URL = https://gitea-web:3000/
[database] [database]
DB_TYPE = mysql DB_TYPE = mysql
HOST = mariadb:3306 HOST = localhost:3306
NAME = gitea NAME = gitea
USER = {{ gitea_db_username }} USER = {{ gitea_db_username }}
PASSWD = {{ gitea_db_password }} PASSWD = {{ gitea_db_password }}

View File

@ -5,6 +5,7 @@ version: '2'
services: services:
mariadb: mariadb:
image: mariadb image: mariadb
network_mode: host
restart: always restart: always
environment: environment:
MYSQL_ROOT_PASSWORD: "{{ gitea_root_db_password }}" MYSQL_ROOT_PASSWORD: "{{ gitea_root_db_password }}"
@ -17,6 +18,7 @@ services:
depends_on: depends_on:
- mariadb - mariadb
image: opendevorg/gitea:latest image: opendevorg/gitea:latest
network_mode: host
restart: always restart: always
environment: environment:
- USER_UID=1000 - USER_UID=1000
@ -26,16 +28,12 @@ services:
- /var/gitea/conf:/custom/conf - /var/gitea/conf:/custom/conf
- /var/gitea/logs:/logs - /var/gitea/logs:/logs
- /var/gitea/certs:/certs - /var/gitea/certs:/certs
ports:
- "443:3000"
- "80:3080"
gitea-ssh: gitea-ssh:
depends_on: depends_on:
- mariadb - mariadb
image: opendevorg/gitea-openssh image: opendevorg/gitea-openssh
network_mode: host
restart: always restart: always
ports:
- "222:22"
volumes: volumes:
- /var/gitea/data:/data - /var/gitea/data:/data
- /var/gitea/conf:/custom/conf - /var/gitea/conf:/custom/conf

View File

@ -17,9 +17,9 @@ testinfra_hosts = ['gitea01.opendev.org']
def test_gitea_listening(host): def test_gitea_listening(host):
gitea_https = host.socket("tcp://0.0.0.0:443") gitea_https = host.socket("tcp://0.0.0.0:3000")
assert gitea_https.is_listening assert gitea_https.is_listening
gitea_http = host.socket("tcp://0.0.0.0:80") gitea_http = host.socket("tcp://0.0.0.0:3080")
assert gitea_http.is_listening assert gitea_http.is_listening
gitea_ssh = host.socket("tcp://0.0.0.0:222") gitea_ssh = host.socket("tcp://0.0.0.0:222")
assert gitea_ssh.is_listening assert gitea_ssh.is_listening