Need some help writing gitlab and gitlab-shell specs

Axilleas Pipinellis axilleaspi at ymail.com
Thu Sep 19 18:42:25 UTC 2013


Cross posting this in ruby-sig since this concerns ruby packaging and in 
devel since I have some more generic questions. Excuse me if I created 
unecessary noise. For those not familiar with the project, you'll find 
some info here [http://axilleas.me/tag/gsoc.html].

Let me start with the directory structure of these packages.
We have two locations:
1) where the main gitlab and gtlab-shell rails apps reside,
2) where git repositories and their satellites[0] are.

I have asked in #fedora-infra what FHS they use with the git repos in 
fedorahosted and we concluded that the rails apps would go to 
/usr/share/ and git repos and satellites to /usr/lib/. Now, when 
specifing %{_libdir} in a spec, it gets /usr/lib64/ on a x86_64 machine. 
I wouldn't want to install gitlab in different dirs when different 
arches, so for now I used /var/lib/ for that purpose. I guess I could 
excplicitly say /usr/lib/gitlab/ but anyway.

So the current structure is:

|-- /usr/share/gitlab/
|     |-- gitlab/
|     |-- gitlab-shell/
|
|-- /var/lib/gitlab/
|     |-- satellites/
|     |-- repositories/
|     |-- .ssh/authorized_keys
|
|-- /etc/gitlab/
|	|-- gitlab.yml
|	|-- shell.yml
|	|-- database.yml
|	|-- unicorn.rb

In /etc there will be configuration files with symlinks in the rails app 
dirs. What are your thoughts on the directory locations? Do you agree?


And now my questions about the specs.
FYI I have seen the katello.spec and took some info from there[1].

gitlab-shell.spec
-----------------

This is kinda finished.

SPEC: 
https://github.com/axilleas/fedora/blob/master/packages/gitlab-shell/gitlab-shell.spec


I tested the package and the appropriate user and group are created when 
install/upgrade but when uninstalling, the homedir doesn't get removed. 
I suspect this has something to do with useradd and protecting the 
homedir of the user?


gitlab.spec
-----------

This is a draft, I didn't test to install yet.

SPEC: 
https://github.com/axilleas/fedora/blob/master/packages/gitlab/gitlab.spec

## Ruby specific

- rake tasks

Many jobs, like the backup, initial database seed, etc. are done with 
rake tasks. How do we invoke them without getting in the app root dir 
every time? Is there some sort of mechanism for that?

- Are Gemfile and Gemfile.lock really needed for the app to work? If yes 
how can we avoid this? Using bundler_ext? If yes, how?

This is an interesting question as katello uses bundler_ext but I 
haven't yet understood how that works. Any tip would be appreciated. For 
now, in the test instance I set up, unicorn checks the Gemfile and if 
not found it doesn't spawn. Here is an entry in its log when I removed 
the Gemfile:

   I, [2013-09-19T21:00:13.056391 #18224]  INFO -- : Refreshing Gem list

and then an error occured.

## Generic

- symlink logs to /var/log/gitlab/

Not all logs' directory is configurable. GitLab uses the logs found in 
app_dir/log/ and displays them via its ui to the admin users. Should I 
symlink these logs to /var/log/ for ease of access?

- pids: move to /var/run/gitlab/ (?)

GitLab is practically running using unicorn and sidekiq. These two 
create each its own pid file in app_dir/tmp/pids/ by default. Luckily 
this is configurable via their configs or systemd services. Also unicorn 
creates a gitlab.socket which uses to speak with the app. If we use 
apache this isn't needed, but with nginx we can use it. I was thinking 
it could go under /var/run/gitlab/ too.

- how to support both databases. Is it feasible?

GitLab supports mysql(mariadb for us) and postgres. How do we deal with 
these cases inside a spec file? For now, I have added a comment about 
the postgres config and made mariadb the default one.

- ownership of directories

In upstream installation guide, gitlab and gitlab-shell reside in the 
same location that's why I decided to have them both under 
/usr/share/gitlab/. And my question is, which package owns 
/usr/share/gitlab/? Both?

Thanks for reading, it took me quite a few hours to compose :)

[0] satellites is a directory where it is stored information about the 
merge requests, forks, etc of each git repository.
[1] 
https://github.com/axilleas/fedora/blob/master/packages/SPECS/katello.spec

-- 
FAS : axilleas
GPG : 0xABF99BE5
Blog: http://axilleas.me


More information about the devel mailing list