Skip to content

Commit 3335b31

Browse files
committed
First commit for version 2.0, downloads from url
1 parent 03d104b commit 3335b31

3 files changed

Lines changed: 54 additions & 98 deletions

File tree

manifests/init.pp

Lines changed: 13 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# init -> packages -> user -> setup -> install -> config -> service
22
class gitlab (
33

4-
# Manage packages
5-
$gitlab_manage_packages = $gitlab::params::gitlab_manage_packages,
64

75
# Gitlab server settings
86
$gitlab_branch = $gitlab::params::gitlab_branch,
@@ -64,104 +62,27 @@
6462
# Backup
6563
$backup_path = $gitlab::params::backup_path,
6664
$backup_keep_time = $gitlab::params::backup_keep_time,
67-
68-
# Deprecated in 1.0.0
69-
$gitlab_repodir = '',
70-
$gitlab_domain = '',
71-
$user_create_team = '',
72-
73-
# Deprecated in 2.0.0
74-
$project_public_default = ''
7565

76-
) inherits ::gitlab::params {
7766

78-
case $::osfamily {
79-
Debian: {
80-
debug("A debian os was detected: ${::osfamily}")
81-
}
82-
default: {
83-
fail("${::osfamily} not supported yet")
84-
}
85-
}
67+
) inherits ::gitlab::params {
8668

87-
# Check if removed flags are present
88-
if $gitlab_repodir != '' {
89-
fail('The flag, $gitlab_repodir is no longer a valid parameter, please remove from your manifests')
90-
}
91-
if $gitlab_domain != '' {
92-
fail('The flag, $gitlab_domain is no longer a valid parameter, please remove from your manifests')
93-
}
94-
if $user_create_team != '' {
95-
fail('The flag, $user_create_team is no longer a valid parameter, please remove from your manifests')
96-
}
9769

98-
# Check if flags removed in 6-4 are present
99-
if $project_public_default != '' {
100-
if $gitlab_branch >= '6-4-stable' {
101-
fail('Gitlab 6-4 and newer replaced $project_public_default with $visibility_level, please update your manifests. See http://bit.ly/1egMAW2')
102-
}
103-
}
104-
105-
# Test if pupet 3.0, required for scope lookup in erb templates
106-
if $::puppetversion <= '3.0.0' {
107-
fail("Module requires puppet 3.0 or greater, you have ${::puppetversion}")
70+
# Gitlab only supplies omnibus downloads for few select operating systems
71+
# Warn the user they may be using an unsupported OS
72+
# https://about.gitlab.com/downloads/
73+
case $operatingsystemrelease {
74+
'12.04': {}
75+
'14.04': {}
76+
'7.5': {}
77+
'6.5': {}
78+
default: { warning("${operatingsystem} ${operatingsystemrelease} is not on approved list,\
79+
download may fail. See https://about.gitlab.com/downloads/"
80+
) }
10881
}
109-
110-
# Test if running on a non Ubuntu System
111-
# If running on a debian system, disable the PPA's
112-
if $::operatingsystem != 'Ubuntu' {
113-
notice("Gitlab is only supported on Ubuntu systems, disabling 'manage packages' as a precaution'")
114-
$gitlab_manage_packages = false
115-
}
11682

11783

118-
119-
# If false, allows user to install nginx, mysql, git ect.. packages separately
120-
if $gitlab_manage_packages == true {
121-
notice("Gitlab will manage packages because gitlab_manage_packages is: ${gitlab_manage_packages} ")
122-
123-
include gitlab::packages
124-
include gitlab::user
125-
include gitlab::setup
126-
include gitlab::install
127-
include gitlab::config
128-
include gitlab::service
129-
130-
anchor { 'gitlab::begin':}
131-
anchor { 'gitlab::end':}
132-
# Installation order
133-
Anchor['gitlab::begin'] ->
134-
Class['::gitlab::packages'] ->
135-
Class['::gitlab::user'] ->
136-
Class['::gitlab::setup'] ->
137-
Class['::gitlab::install'] ->
138-
Class['::gitlab::config'] ->
139-
Class['::gitlab::service'] ->
140-
Anchor['gitlab::end']
141-
142-
}
143-
else {
144-
notice("You must install packages manually because gitlab_manage_packages is: ${gitlab_manage_packages}, see manifests/packages.pp")
14584

146-
include gitlab::user
147-
include gitlab::setup
148-
include gitlab::install
149-
include gitlab::config
150-
include gitlab::service
151-
152-
anchor { 'gitlab::begin':}
153-
anchor { 'gitlab::end':}
154-
# Installation order
155-
Anchor['gitlab::begin'] ->
156-
Class['::gitlab::user'] ->
157-
Class['::gitlab::setup'] ->
158-
Class['::gitlab::install'] ->
159-
Class['::gitlab::config'] ->
160-
Class['::gitlab::service'] ->
161-
Anchor['gitlab::end']
162-
}
163-
164-
85+
include gitlab::install
16586

16687

16788
}# end gitlab

manifests/install.pp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
class gitlab::install inherits ::gitlab {
2+
3+
# Download links change depending on the OS
4+
# Set variables to make it easy to define $gitlab_url
5+
6+
case $osfamily {
7+
'Debian': {
8+
$omnibus_release = "-omnibus-1_amd64.deb"
9+
$url_separator = "_"
10+
}
11+
'RedHat': {
12+
$omnibus_release = "_omnibus-1.el6x86_64.rpm"
13+
$url_separator = "-"
14+
}
15+
default: {fail("Only RedHat and Debain OS's are supported, you have: ${operatingsystem} ")}
16+
}
17+
18+
# Sets the download url. Examples
19+
# https://downloads-packages.s3.amazonaws.com/centos-6.5/gitlab-7.0.0_omnibus-1.el6.x86_64.rpm
20+
# https://downloads-packages.s3.amazonaws.com/debian-7.5/gitlab_7.0.0-omnibus-1_amd64.deb
21+
# https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.0.0-omnibus-1_amd64.deb
22+
# https://downloads-packages.s3.amazonaws.com/ubuntu-12.04/gitlab_7.0.0-omnibus-1_amd64.deb
23+
$gitlab_url = "https://downloads-packages.s3.amazonaws.com/ubuntu-${operatingsystemrelease}/gitlab${url_separator}${::gitlab::gitlab_branch}${omnibus_release}"
24+
# $gitlab_url = "https://downloads-packages.s3.amazonaws.com/${operatingsystem}-${operatingsystemrelease}/gitlab${url_separator}${::gitlab::gitlab_branch}${omnibus_release}"
25+
26+
notice("Downloading from ${gitlab_url}")
27+
28+
package {'wget':
29+
ensure => present,
30+
}
31+
exec { "download gitlab":
32+
command => "/usr/bin/wget --progress=dot -nv ${gitlab_url} -O /tmp/gitlab${url_separator}${::gitlab::gitlab_branch}${omnibus_release} 2>&1",
33+
creates => "/var/tmp/gitlab${url_separator}${::gitlab::gitlab_branch}${omnibus_release}",
34+
require => Package['wget'],
35+
}
36+
37+
38+
39+
}

manifests/params.pp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@
55
$gitlab_manage_packages = true
66

77
# Gitlab server settings
8-
$gitlab_branch = '6-9-stable'
9-
$gitlabshell_branch = 'v1.9.4'
8+
$gitlab_branch = '7.0.0'
109
$git_user = 'git' # only change if you really know what you are doing
1110
$git_home = '/home/git'
1211
$git_email = 'example@example.com'
1312
$git_comment = 'GitLab'
1413
$git_ssh_port = '22'
15-
$gitlab_sources = 'git://github.com/gitlabhq/gitlabhq.git'
16-
$gitlabshell_sources = 'git://github.com/gitlabhq/gitlab-shell.git'
14+
1715

1816
# Database
19-
$gitlab_dbtype = 'mysql'
2017
$gitlab_dbname = 'gitlabhq_production'
2118
$gitlab_dbuser = 'gitlab'
2219
$gitlab_dbpwd = 'changeme'
@@ -60,7 +57,6 @@
6057
$project_wall = false
6158
$project_snippets = false
6259
$gitlab_projects = '15'
63-
# $project_public_default = Deprecated in 6-4
6460
$visibility_level = 'internal'
6561

6662
# Backup

0 commit comments

Comments
 (0)