From 9d685ab7a585220ff747cb14366b12f1b9356f24 Mon Sep 17 00:00:00 2001 From: Thomas Maurice Date: Wed, 11 Jan 2017 08:01:37 +0100 Subject: [PATCH] Add the support for mysql and postgres databases and documentation --- README.md | 12 ++++++++++-- defaults/main.yml | 8 ++++++++ templates/gitea.ini.j2 | 14 +++++++------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 555984e..149635e 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,16 @@ The following have been tested with Debian 8, it should work on Ubuntu as well. * `gitea_start_ssh`: Do you start the SSH server ? (true/false) * `gitea_ssh_port`: SSH bind port +### Database configuration + +* `gitea_db_type`: Database type, can be `mysql`, `postgres` or `sqlite3` +* `gitea_db_host`: Database host string `host:port` +* `gitea_db_name`: Database name +* `gitea_db_user`: Database username +* `gitea_db_passord`: Database password +* `gitea_db_ssl`: Use SSL ? (postgres only!). Can be `required`, `disable`, `verify-full` +* `gitea_db_path`: DB path, if you use `sqlite3`. The default is good enough to work though. + ## Disclaimer This module is currently a work in progress. For now it is only able to install gitea from the Github Release, in a fixed version for Linux amd64, on systems @@ -97,8 +107,6 @@ using systemd. This said, it should work on every major Linux distribution, it has been tested successfully on Debian Jessie 64 bits. -Also it only supports the sqlite3 driver for now, but I'll improve soon. - ## Contributing Do not hesitate to make me a pull request, and when in doubt you can reach me on Twitter [@thomas_maurice](https://twitter.com/thomas_maurice). diff --git a/defaults/main.yml b/defaults/main.yml index 1adb439..dc9b083 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -12,6 +12,14 @@ gitea_http_port: 3000 gitea_disable_http_git: false gitea_offline_mode: true +gitea_db_type: sqlite3 +gitea_db_host: 127.0.0.0:3306 +gitea_db_name: root +gitea_db_user: gitea +gitea_db_passord: lel +gitea_db_ssl: disable +gitea_db_path: "{{ gitea_home }}/data/gitea.db" + gitea_ssh_listen: 0.0.0.0 gitea_ssh_domain: localhost gitea_start_ssh: true diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 9bb7ca3..88f7a08 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -148,15 +148,15 @@ DSA = 1024 [database] ; Either "mysql", "postgres" or "sqlite3", it's your choice -DB_TYPE = sqlite3 -HOST = 127.0.0.1:3306 -NAME = gitea -USER = root -PASSWD = +DB_TYPE = {{ gitea_db_type }} +HOST = {{ gitea_db_host }} +NAME = {{ gitea_db_name }} +USER = {{ gitea_db_user }} +PASSWD = {{ gitea_db_passord }} ; For "postgres" only, either "disable", "require" or "verify-full" -SSL_MODE = disable +SSL_MODE = {{ gitea_db_ssl }} ; For "sqlite3" and "tidb", use absolute path when you start as service -PATH = {{ gitea_home }}/data/gitea.db +PATH = {{ gitea_db_path }} [admin]