From 860652fedfe106e02b64f07e49bbc9018b72e1d6 Mon Sep 17 00:00:00 2001
From: "James E. Blair" <jeblair@redhat.com>
Date: Fri, 24 May 2019 11:20:01 -0700
Subject: [PATCH] Add gitea docs

This is based on the recently removed cgit document, but updated
for gitea.

Change-Id: I4bb1f4b9485d15c412e4882ccc0baf031aeba87b
---
 doc/source/gitea.rst   | 61 ++++++++++++++++++++++++++++++++++++++++++
 doc/source/systems.rst |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 doc/source/gitea.rst

diff --git a/doc/source/gitea.rst b/doc/source/gitea.rst
new file mode 100644
index 0000000000..8e294e3bd9
--- /dev/null
+++ b/doc/source/gitea.rst
@@ -0,0 +1,61 @@
+:title: Gitea
+
+.. _gitea:
+
+Gitea
+#####
+
+Gitea is running on opendev.org
+
+At a Glance
+===========
+
+:Hosts:
+  * https://opendev.org/
+  * gitea*.opendev.org
+:Ansible:
+  * :git_file:`playbooks/roles/gitea`
+  * :git_file:`playbooks/roles/haproxy`
+:Configuration:
+  * :git_file:`playbooks/group_vars/gitea-lb.yaml`
+:Projects:
+  * https://gitea.io/
+:Bugs:
+  * https://storyboard.openstack.org/#!/project/748
+  * https://github.com/go-gitea/gitea/issues
+
+Overview
+========
+
+The OpenDev Git repositories are hosted on a pool of servers.  They
+are served via https using Gitea behind HAProxy which handles load
+balancing across the nodes.
+
+Backend Maintenance
+===================
+
+To temporarily remove a git backend from the HAProxy load balancer,
+you can put it in "maintenance" mode.  This can be done interactively
+on the HAProxy host.  Note that long-term changes to the topology
+should be made via configuration management.  These commands must be
+run as root.
+
+To see the current status of all servers::
+
+  echo "show stat" | socat /var/haproxy/run/stats stdio
+
+To disable a server (eg, gitea08)::
+
+  echo "disable server balance_git_http/gitea08.opendev.org" | socat /var/haproxy/run/stats stdio
+  echo "disable server balance_git_https/gitea08.opendev.org" | socat /var/haproxy/run/stats stdio
+
+To re-enable a server::
+
+  echo "enable server balance_git_http/gitea08.opendev.org" | socat /var/haproxy/run/stats stdio
+  echo "enable server balance_git_https/gitea08.opendev.org" | socat /var/haproxy/run/stats stdio
+
+To run these commands and others interactively, issue the prompt
+command to haproxy::
+
+  socat readline /var/haproxy/run/stats
+  prompt
diff --git a/doc/source/systems.rst b/doc/source/systems.rst
index 84e9e96557..f839144065 100644
--- a/doc/source/systems.rst
+++ b/doc/source/systems.rst
@@ -10,6 +10,7 @@ Major Systems
    certificate_authority
    dns
    gerrit
+   gitea
    grafana
    grafyaml
    zuul