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/
- name: Check if root user exists
uri:
url: "https://localhost/api/v1/users/root"
url: "https://localhost:3000/api/v1/users/root"
validate_certs: false
status_code: 200, 404
register: root_user_check
@ -58,7 +58,7 @@
no_log: true
- name: Check if gerrit user exists
uri:
url: "https://localhost/api/v1/users/gerrit"
url: "https://localhost:3000/api/v1/users/gerrit"
validate_certs: false
status_code: 200, 404
register: gerrit_user_check
@ -66,7 +66,7 @@
when: gerrit_user_check.status==404
no_log: true
uri:
url: "https://localhost/api/v1/admin/users"
url: "https://localhost:3000/api/v1/admin/users"
validate_certs: false
method: POST
user: root
@ -87,7 +87,7 @@
user: root
password: "{{ gitea_root_password }}"
force_basic_auth: true
url: "https://localhost/api/v1/users/gerrit/keys"
url: "https://localhost:3000/api/v1/users/gerrit/keys"
validate_certs: false
status_code: 200
register: gerrit_key_check
@ -99,7 +99,7 @@
user: root
password: "{{ gitea_root_password }}"
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
method: DELETE
status_code: 204
@ -110,7 +110,7 @@
user: root
password: "{{ gitea_root_password }}"
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
method: POST
status_code: 201

View File

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

View File

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

View File

@ -17,9 +17,9 @@ testinfra_hosts = ['gitea01.opendev.org']
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
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
gitea_ssh = host.socket("tcp://0.0.0.0:222")
assert gitea_ssh.is_listening