Commit 7b840e1a1cc843dfd12b9c3ae7848d18f6993cbf
1 parent
59743db3
Exists in
master
and in
79 other branches
checkpoint
Showing
1 changed file
with
92 additions
and
22 deletions
Show diff stats
gitlab.spec
| @@ -6,9 +6,9 @@ Group: Development/Tools | @@ -6,9 +6,9 @@ Group: Development/Tools | ||
| 6 | License: Expat | 6 | License: Expat |
| 7 | URL: https://beta.softwarepublico.gov.br/gitlab/softwarepublico/gitlab | 7 | URL: https://beta.softwarepublico.gov.br/gitlab/softwarepublico/gitlab |
| 8 | Source0: %{name}-%{version}.tar.gz | 8 | Source0: %{name}-%{version}.tar.gz |
| 9 | - | ||
| 10 | -BuildRequires: gitlab-deps,postgresql-server, postgresql-devel | ||
| 11 | -Requires: gitlab-deps, postgresql-server, git | 9 | +BuildArch: noarch |
| 10 | +BuildRequires: gitlab-deps | ||
| 11 | +Requires: gitlab-deps, git | ||
| 12 | 12 | ||
| 13 | %description | 13 | %description |
| 14 | GitLab | 14 | GitLab |
| @@ -16,37 +16,106 @@ GitLab | @@ -16,37 +16,106 @@ GitLab | ||
| 16 | %prep | 16 | %prep |
| 17 | %autosetup | 17 | %autosetup |
| 18 | 18 | ||
| 19 | -%pre | ||
| 20 | -adduser git | ||
| 21 | -service postgresql initdb | ||
| 22 | -service postgresql start | ||
| 23 | -sudo -u postgres psql -d template1 << EOF | ||
| 24 | -CREATE USER git CREATEDB; | ||
| 25 | -CREATE DATABASE gitlabhq_production OWNER git; | ||
| 26 | -\q | ||
| 27 | -EOF | ||
| 28 | - | ||
| 29 | %build | 19 | %build |
| 30 | -# make %{?_smp_mflags} | 20 | +cat > config/gitlab.yml <<EOF |
| 21 | +production: &base | ||
| 22 | + gitlab: | ||
| 23 | + host: localhost | ||
| 24 | + port: 80 # Set to 443 if using HTTPS | ||
| 25 | + https: false # Set to true if using HTTPS | ||
| 26 | + email_from: example@example.com | ||
| 27 | + default_projects_limit: 10 | ||
| 28 | + default_projects_features: | ||
| 29 | + issues: true | ||
| 30 | + merge_requests: true | ||
| 31 | + wiki: true | ||
| 32 | + snippets: false | ||
| 33 | + visibility_level: "private" # can be "private" | "internal" | "public" | ||
| 34 | + gravatar: | ||
| 35 | + enabled: true | ||
| 36 | + plain_url: "http://cdn.libravatar.org/avatar/%{hash}?s=%{size}&d=identicon" | ||
| 37 | + ssl_url: "https://seccdn.libravatar.org/avatar/%{hash}?s=%{size}&d=identicon" | ||
| 38 | + omniauth: | ||
| 39 | + # Allow login via Twitter, Google, etc. using OmniAuth providers | ||
| 40 | + enabled: false | ||
| 41 | + allow_single_sign_on: false | ||
| 42 | + block_auto_created_users: true | ||
| 43 | + providers: | ||
| 44 | + # - { name: 'google_oauth2', app_id: 'YOUR APP ID', | ||
| 45 | + # app_secret: 'YOUR APP SECRET', | ||
| 46 | + # args: { access_type: 'offline', approval_prompt: '' } } | ||
| 47 | + satellites: | ||
| 48 | + path: /var/lib/gitlab/satellites | ||
| 49 | + timeout: 30 | ||
| 50 | + backup: | ||
| 51 | + path: /var/lib/gitlab/backups | ||
| 52 | + gitlab_shell: | ||
| 53 | + path: /usr/lib/gitlab-shell | ||
| 54 | + repos_path: /var/lib/gitlab/repositories/ | ||
| 55 | + hooks_path: /usr/lib/gitlab-shell/hooks/ | ||
| 56 | + # Git over HTTP | ||
| 57 | + upload_pack: true | ||
| 58 | + receive_pack: true | ||
| 59 | + git: | ||
| 60 | + bin_path: /usr/bin/git | ||
| 61 | + max_size: 20971520 # 20.megabytes | ||
| 62 | + timeout: 10 | ||
| 63 | + extra: | ||
| 64 | + ## Piwik analytics. | ||
| 65 | + # piwik_url: '_your_piwik_url' | ||
| 66 | + # piwik_site_id: '_your_piwik_site_id' | ||
| 67 | + | ||
| 68 | + ## Text under sign-in page (Markdown enabled) | ||
| 69 | + # sign_in_text: | | ||
| 70 | + #  | ||
| 71 | + # [Learn more about CompanyName](http://www.companydomain.com/) | ||
| 72 | +EOF | ||
| 31 | 73 | ||
| 32 | %install | 74 | %install |
| 33 | -cp config/gitlab.yml.example config/gitlab.yml | ||
| 34 | -cp config/unicorn.rb.example config/unicorn.rb | ||
| 35 | -cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb | ||
| 36 | -cp config/database.yml.postgresql config/database.yml | 75 | +mkdir -p %{buildroot}/etc/gitlab |
| 76 | +cp config/gitlab.yml %{buildroot}/etc/gitlab/gitlab.yml | ||
| 77 | +cp config/unicorn.rb.example %{buildroot}/etc/gitlab/unicorn.rb | ||
| 78 | +cp config/database.yml.postgresql %{buildroot}/etc/gitlab/database.yml | ||
| 37 | 79 | ||
| 38 | mkdir -p %{buildroot}/usr/lib/gitlab | 80 | mkdir -p %{buildroot}/usr/lib/gitlab |
| 39 | cp -r app bin config config.ru db doc GITLAB_SHELL_VERSION lib Procfile public Rakefile vendor VERSION %{buildroot}/usr/lib/gitlab/ | 81 | cp -r app bin config config.ru db doc GITLAB_SHELL_VERSION lib Procfile public Rakefile vendor VERSION %{buildroot}/usr/lib/gitlab/ |
| 82 | +mv %{buildroot}/usr/lib/gitlab/config/initializers/rack_attack.rb.example %{buildroot}/usr/lib/gitlab/config/initializers/rack_attack.rb | ||
| 83 | +for configfile in gitlab.yml unicorn.rb database.yml; do | ||
| 84 | + ln -s /etc/gitlab/$configfile %{buildroot}/usr/lib/gitlab/config | ||
| 85 | +done | ||
| 86 | +ln -s /var/log/gitlab %{buildroot}/usr/lib/gitlab/log | ||
| 87 | +ln -s /var/lib/gitlab/tmp %{buildroot}/usr/lib/gitlab/tmp | ||
| 88 | +ln -s /var/lib/gitlab/.gitlab_shell_secret %{buildroot}/usr/lib/gitlab/.gitlab_shell_secret | ||
| 89 | +ln -s /var/lib/gitlab/.secret %{buildroot}/usr/lib/gitlab/.secret | ||
| 40 | 90 | ||
| 41 | %post | 91 | %post |
| 92 | +groupadd git || true | ||
| 93 | +if ! id git; then | ||
| 94 | + adduser --system --home-dir /usr/lib/gitlab --no-create-home --gid git git | ||
| 95 | +fi | ||
| 96 | +if [ -x /usr/bin/postgres ]; then | ||
| 97 | + service postgresql initdb || true | ||
| 98 | + service postgresql start | ||
| 99 | + service postgresql enable | ||
| 100 | + sudo -u postgres createuser --createdb git || true | ||
| 101 | +fi | ||
| 102 | +mkdir -p /var/log/gitlab | ||
| 103 | +chown -R git:git /var/log/gitlab | ||
| 104 | +mkdir -p /var/lib/gitlab/backups | ||
| 105 | +mkdir -p /var/lib/gitlab/repositories | ||
| 106 | +mkdir -p /var/lib/gitlab/satellites | ||
| 107 | +mkdir -p /var/lib/gitlab/tmp | ||
| 108 | +chown -R git:git /var/lib/gitlab | ||
| 109 | +if [ /usr/bin/redis-server ]; then | ||
| 110 | + service redis start | ||
| 111 | + service redis enable | ||
| 112 | +fi | ||
| 42 | 113 | ||
| 43 | cd /usr/lib/gitlab/ | 114 | cd /usr/lib/gitlab/ |
| 44 | -cp vendor/Gemfile* . | ||
| 45 | -bundle exec rake gitlab:setup RAILS_ENV=production | 115 | +yes yes | sudo -u git bundle exec rake gitlab:setup RAILS_ENV=production |
| 46 | 116 | ||
| 47 | %postun | 117 | %postun |
| 48 | -userdel git | ||
| 49 | - | 118 | +#TODO Remove |
| 50 | sudo -u postgres psql -d template1 << EOF | 119 | sudo -u postgres psql -d template1 << EOF |
| 51 | DROP DATABASE gitlabhq_production; | 120 | DROP DATABASE gitlabhq_production; |
| 52 | DROP USER git; | 121 | DROP USER git; |
| @@ -55,4 +124,5 @@ EOF | @@ -55,4 +124,5 @@ EOF | ||
| 55 | 124 | ||
| 56 | %files | 125 | %files |
| 57 | /usr/lib/gitlab | 126 | /usr/lib/gitlab |
| 127 | +/etc/gitlab | ||
| 58 | %doc | 128 | %doc |