This is a Puppet module to install Gogs (Go Git Service, see: http://gogs.io).
Gogs(Go Git Service) is a painless self-hosted Git Service written in Go. The goal of the Gogs project is to make the easiest, fastest and most painless way to set up a self-hosted Git service. With Go, this can be done in independent binary distribution across ALL platforms that Go supports, including Linux, Mac OS X, and Windows.
This Puppet module allows you to manage the Gogs service on linux operating systems. Currently only Debian and RedHat family linux is tested/supported.
In order to use this Gogs module you should be able to simply include it:
include ::gogs
or:
class { '::gogs':
ensure => present,
}
Configure it to your needs using the parameters below.
Boolean indicating wheter or not the gogs package repository should be added to the hosts package manager configuration. Default: false.
Value to pass through to the package
resource when installing Gogs. Defaults to
present
.
The environment this Gogs instance is running for. Allowed values are: 'dev', 'test' or 'prod'. Default: 'prod'
Root directory that will contain all Git repositories. If this directory does not exist, it will be created. Please note that the parent directory for the repository root must already exist! Default: '/home/gogs/gogs-repositories'
The domain name the Gogs service should serve/listen to. Default: 'localhost'.
The port the Gogs service should listen on. Default: 6000.
Boolean indicating wheter or not (http) gzip compression should be used. Default: false.
The type of database back-end to be used by Gogs. Allowed values are: 'postgres', 'mysql' or 'sqlite3'. Please note that the packages from packager.io, used by this module when you select install_repo = true don't support sqlite3. Also note that this module does not install a database for Gogs. Please use another module e.g. the Puppetlabs/Postgresql module from the forge to install one. Default: 'postgres'.
The hostname of the machine where the Gogs database is running. Default: 'localhost'.
The port of the Gogs database. Default: 5432.
Name of the Gogs database. Default: 'gogs'.
The username credential used for connecting to the Gogs database. Default: 'gogs'.
The password credential used for connecting to the Gogs database. DefaulT: 'gogs'.
For postgres only. Valid values are: 'disable', 'require' or 'verify-full'. Default: 'disable'
Path where sqlite3 should store its data. Only used when db_type = 'sqlite3'.
The secret key. You should provide one for each Gogs instance. When not passed a default secret key will be used.
This module is far from done. I will add more parameters/customization options. This version will just get you up and running with the bare essentials.
This module does not install a database required by Gogs. Please provide your own wrapper or server role module to install either a Postgresql or MySql database. Sqlite3 is not supported by the packages provided on packager.io. If you provide your own package (install_repo = false), you can ofcourse set the db_type to sqlite3.
Another Gogs quirk is that it does not install an admin user by default. Normally this is done by the first time installer, which configures an admin user in the database. Since this module deliberately does not install a database, you should either add a Gogs admin user to the database with another module or manually. An example SQL insert for this is:
INSERT INTO "user" VALUES (1, 'admin', 'admin', '', '[email protected]', 'someverylongPDKDF2passwordhash', 0, 0, '', 0, '', '', 'randomsecret', 'randomsaltstring', '2015-01-07 13:58:37', '2015-01-07 13:58:37', true, true, false, '9075fd3adc2d47bc1ae87100e0686399', '[email protected]', false, 0, 0, 0, 0, '', 0, 0);
The password must be a PDKDF2 encrypted string, using 10000 iterations, keylength 50, the salt value (in this case 'randomsaltstring') and SHA-256 HMAC. You could use the following Go program to generate a password hash:
package main
import (
"fmt"
"os"
"crypto/sha256"
"github.com/gogits/gogs/modules/base"
)
func main() {
newPasswd := base.PBKDF2([]byte(os.Args[1]), []byte(os.Args[2]), 10000, 50, sha256.New)
fmt.Printf("%x\n", newPasswd)
}
This simple program takes the password as the first argument and the salt value as the second argument. This code is an actual copy of the Gogs code responsible for inserting/updating passwords in the database.