Difference between revisions of "Gogs"

From ArchWiki
Jump to navigation Jump to search
(pacman hook)
Line 68: Line 68:
  
 
The current package (gogs-git* and gogs>=0.4.2) support custom themes. The location for Gogs themes is <code>/usr/share/themes/gogs/</code>. Gogs comes with one default theme, but you can easily create a own theme. Just copy the default <code>theme</code> directory and change what every you want. In the <code>public</code> directory is every javascript, stylesheet and font file and in the <code>template</code> directory are the HTML templates. The current selected theme can be changed over the <code>app.ini</code> configuration parameter <code>STATIC_ROOT_PATH</code>. Changed it with the absolute path to the new theme.
 
The current package (gogs-git* and gogs>=0.4.2) support custom themes. The location for Gogs themes is <code>/usr/share/themes/gogs/</code>. Gogs comes with one default theme, but you can easily create a own theme. Just copy the default <code>theme</code> directory and change what every you want. In the <code>public</code> directory is every javascript, stylesheet and font file and in the <code>template</code> directory are the HTML templates. The current selected theme can be changed over the <code>app.ini</code> configuration parameter <code>STATIC_ROOT_PATH</code>. Changed it with the absolute path to the new theme.
 +
 +
== Restart after Upgrade ==
 +
 +
Gogs needs to be restarted after every upgrade because the paths of javascript/css assets will change and therefor break the website.
 +
To automate this the following pacman hook can be inserted to <code>/etc/pacman.d/hooks/gogs.hook</code>:
 +
 +
  [Trigger]
 +
  Type = File
 +
  Operation = Upgrade
 +
  Target = usr/share/gogs/gogs
 +
  [Action]
 +
  Description = Restart gogs...
 +
  When = PostTransaction
 +
  Exec = /usr/bin/systemctl try-restart gogs.service
  
 
== See also ==
 
== See also ==
 
*[https://gogs.io/docs Official Documentation]
 
*[https://gogs.io/docs Official Documentation]

Revision as of 13:47, 15 August 2016

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Work in progress (Discuss in Talk:Gogs#)

Gogs (Go Git Service) is a Self Hosted Git service, which was written in the Go programming language.

Packages

In all three package is sqlite, redis and memcache activate for compile. To use it, you need to edit the configuration file app.ini (see #Configuration).

Installation

Installing Gogs from the AUR instead of manually has the added benefit that lots of steps have been taken care of for you (e.g. permissions and ownership for files, etc).

Make sure you perform a system upgrade (pacman -Syu) before installing Gogs from AUR and that you have installed the base-devel group, or you may face problems installing Gogs because base-devel packages are not required to be listed as dependencies in PKGBUILD files.

Also before installing the Gogs package from the AUR, you need to choose a database backend if you're planning to host Gogs it on the same machine as the database:

If you plan to use SSH to interact with your repositories, make sure to add the gogs user to the AllowUsers entry in /etc/ssh/sshd_config.

First start

After starting of the Gogs service (systemctl start gogs.service), you can access the running service over the url http://[server]:3000. At the first execute, you will redirect to the installation page. Here you can configure some minor configuration options. In the configuration file /srv/gogs/conf/app.ini, you can change more values (for example the port number).

Configuration

After the first start, Gogs created a own configuration file in the directory /srv/gogs/config. When you want to edit a configuration option, you need to edit this file.

.gitignore and license files

Add the files into the directory /srv/gogs/conf/gitignore or /srv/gogs/conf/license. When the directory not exist, you need to created it in the first step.

You can get or create own .gitignore files on this page.

Database

SQLite

Install sqlite and select SQLite on the installation page.

PostgreSQL

Install postgresql and select Postgresql on the installation page.

# su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'"
# su - postgres -c "createuser --interactive"
# name: gogs
# su - postgres -c "createdb -U gogs gogs"

MariaDB

SMTP

oAuth

Logging

Caching

Theme

The current package (gogs-git* and gogs>=0.4.2) support custom themes. The location for Gogs themes is /usr/share/themes/gogs/. Gogs comes with one default theme, but you can easily create a own theme. Just copy the default theme directory and change what every you want. In the public directory is every javascript, stylesheet and font file and in the template directory are the HTML templates. The current selected theme can be changed over the app.ini configuration parameter STATIC_ROOT_PATH. Changed it with the absolute path to the new theme.

Restart after Upgrade

Gogs needs to be restarted after every upgrade because the paths of javascript/css assets will change and therefor break the website. To automate this the following pacman hook can be inserted to /etc/pacman.d/hooks/gogs.hook:

 [Trigger]
 Type = File
 Operation = Upgrade
 Target = usr/share/gogs/gogs
 [Action]
 Description = Restart gogs...
 When = PostTransaction
 Exec = /usr/bin/systemctl try-restart gogs.service

See also