Commit c3f3f67e0b73f363c1d5b2432288d6abce411833

Authored by Alexandre Barbosa
1 parent 9a7842e1

Copying files to /usr/lib/gitlab

Signed-off-by: Alexandre Barbosa <alexandreab@live.com>
Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com>
Showing 1 changed file with 32 additions and 2 deletions   Show diff stats
@@ -7,8 +7,8 @@ License: Expat @@ -7,8 +7,8 @@ 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 9
10 -BuildRequires: gitlab-deps  
11 -Requires: gitlab-deps 10 +BuildRequires: gitlab-deps,postgresql-server, postgresql-devel
  11 +Requires: gitlab-deps, postgresql-server
12 12
13 %description 13 %description
14 GitLab 14 GitLab
@@ -16,13 +16,43 @@ GitLab @@ -16,13 +16,43 @@ 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 +
19 %build 29 %build
20 # make %{?_smp_mflags} 30 # make %{?_smp_mflags}
21 31
22 %install 32 %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
  37 +
23 mkdir -p %{buildroot}/usr/lib/gitlab 38 mkdir -p %{buildroot}/usr/lib/gitlab
24 cp -r app bin config config.ru db doc GITLAB_SHELL_VERSION lib Procfile public Rakefile vendor VERSION %{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/
25 40
  41 +%post
  42 +
  43 +cd /usr/lib/gitlab/
  44 +cp vendor/Gemfile* .
  45 +bundle exec rake gitlab:setup RAILS_ENV=production
  46 +
  47 +%postun
  48 +userdel git
  49 +
  50 +sudo -u postgres psql -d template1 << EOF
  51 +DROP DATABASE gitlabhq_production;
  52 +DROP USER git;
  53 +\q
  54 +EOF
  55 +
26 %files 56 %files
27 /usr/lib/gitlab 57 /usr/lib/gitlab
28 %doc 58 %doc