# Recompiling Git with Gitweb in jail



## andrewm659 (Aug 4, 2016)

I need some help. I want to get gitweb working in my jail instance (ezjail).  I don't know how to recompile from within the jaill.  Do I need to download the ports package in the jail or from the host system?  Is there a separate package that has this compiled in?  

FreeBSD 10.3

```
pkg query -e "%n=git" "%n-%v %Ok %Ov"
git-2.9.0 CONTRIB on
git-2.9.0 CURL on
git-2.9.0 CVS on
git-2.9.0 GITWEB off  <---TURN THAT ON
git-2.9.0 GUI off
git-2.9.0 HTMLDOCS off
git-2.9.0 ICONV on
git-2.9.0 NLS on
git-2.9.0 P4 on
git-2.9.0 PERL on
git-2.9.0 SEND_EMAIL on
git-2.9.0 SVN off
```


----------



## SirDice (Aug 4, 2016)

andrewm659 said:


> I don't know how to recompile from within the jail.


It works exactly the same way, why would it be different?



> Do I need to download the ports package in the jail or from the host system?


There is no ports "package". There's a ports tree though, you can get it using portsnap(8) for example.



> Is there a separate package that has this compiled in?


No, not unless you build it yourself.


----------



## tobik@ (Aug 4, 2016)

Honestly I don't understand why GITWEB isn't turned on by default.  GITWEB requires PERL (which is enabled by default) and adds maybe ~ 330kb to the installed size.  I've opened a bug for this asking for it to be enabled by default: PR 211573.


----------



## andrewm659 (Aug 4, 2016)

Sorry, 
I meant downloading the ports tree within the jail.


There is no ports "package". There's a ports tree though, you can get it using portsnap(8) for example.


No, not unless you build it yourself.[/QUOTE]


----------



## SirDice (Aug 4, 2016)

andrewm659 said:


> I meant downloading the ports tree within the jail.


There are several ways of doing this. Some people simply download (svnlite(1), svn(1) or portsnap(8)) the ports tree within the jail itself. Others use nullfs(5) to mount the host's copy in the jail.


----------



## andrewm659 (Aug 4, 2016)

I was able to do a `portsnap fetch`

```
root@rancid3git:~ # portsnap extract
mkdir: /usr/ports: No such file or directory
```


----------



## SirDice (Aug 4, 2016)

The directory needs to exist prior to running portsnap(8).


----------



## andrewm659 (Aug 4, 2016)

Ok.  I guess shame on me for _assuming_ that it would create it!


----------



## andrewm659 (Aug 4, 2016)

root@rancid3git:~ # mkdir /usr/ports
mkdir: /usr/ports: File exists
root@rancid3git:~ #


----------



## andrewm659 (Aug 4, 2016)

I think I see where I went wrong!

http://www.rhyous.com/2011/03/21/how-ive-been-using-the-pc-bsd-ports-jail/


----------



## talsamon (Aug 5, 2016)

Another way could be `portnsnap -p portsdir`. Or edit   PORTSDIR in /etc/portsnap.conf.


----------



## andrewm659 (Aug 5, 2016)

It took to long to compile and I ran out of swap space on my host.  :-(

I've never compiled or recompiled from ports so i'm new to this.  Any tips would be great.  Recompiling/Compiling git with GITWEB.


----------



## SirDice (Aug 5, 2016)

How "small" is the machine? I mean, how much memory? How much disk space? How large is your swap?


----------



## andrewm659 (Aug 5, 2016)

```
root@asm-freebsd01:~ # df -hT
Filesystem           Type       Size    Used   Avail Capacity  Mounted on
zroot/ROOT/default   zfs        109G    8.0G    101G     7%    /
devfs                devfs      1.0K    1.0K      0B   100%    /dev
zroot/tmp            zfs        101G    120K    101G     0%    /tmp
zroot/usr/home       zfs        101G     39M    101G     0%    /usr/home
zroot/usr/ports      zfs        105G    3.5G    101G     3%    /usr/ports
zroot/usr/src        zfs        102G    547M    101G     1%    /usr/src
zroot/var/audit      zfs        101G     96K    101G     0%    /var/audit
zroot/var/crash      zfs        101G     96K    101G     0%    /var/crash
zroot/var/log        zfs        101G    328K    101G     0%    /var/log
zroot/var/mail       zfs        101G    160K    101G     0%    /var/mail
zroot/var/tmp        zfs        101G     96K    101G     0%    /var/tmp
zroot                zfs        101G     96K    101G     0%    /zroot
/usr/jails/basejail  nullfs     109G    8.0G    101G     7%    /jails/rancid3svn.borg.local/basejail
devfs                devfs      1.0K    1.0K      0B   100%    /jails/rancid3svn.borg.local/dev
fdescfs              fdescfs    1.0K    1.0K      0B   100%    /jails/rancid3svn.borg.local/dev/fd
procfs               procfs     4.0K    4.0K      0B   100%    /jails/rancid3svn.borg.local/proc
/usr/jails/basejail  nullfs     109G    8.0G    101G     7%    /jails/rancid3git.borg.local/basejail
devfs                devfs      1.0K    1.0K      0B   100%    /jails/rancid3git.borg.local/dev
fdescfs              fdescfs    1.0K    1.0K      0B   100%    /jails/rancid3git.borg.local/dev/fd
procfs               procfs     4.0K    4.0K      0B   100%    /jails/rancid3git.borg.local/proc
/usr/jails/basejail  nullfs     109G    8.0G    101G     7%    /jails/proxy01.borg.local/basejail
devfs                devfs      1.0K    1.0K      0B   100%    /jails/proxy01.borg.local/dev
fdescfs              fdescfs    1.0K    1.0K      0B   100%    /jails/proxy01.borg.local/dev/fd
procfs               procfs     4.0K    4.0K      0B   100%    /jails/proxy01.borg.local/proc
/usr/jails/basejail  nullfs     109G    8.0G    101G     7%    /jails/nagios.borg.local/basejail
devfs                devfs      1.0K    1.0K      0B   100%    /jails/nagios.borg.local/dev
fdescfs              fdescfs    1.0K    1.0K      0B   100%    /jails/nagios.borg.local/dev/fd
procfs               procfs     4.0K    4.0K      0B   100%    /jails/nagios.borg.local/proc
/usr/jails/basejail  nullfs     109G    8.0G    101G     7%    /jails/mta1.borg.local/basejail
devfs                devfs      1.0K    1.0K      0B   100%    /jails/mta1.borg.local/dev
fdescfs              fdescfs    1.0K    1.0K      0B   100%    /jails/mta1.borg.local/dev/fd
procfs               procfs     4.0K    4.0K      0B   100%    /jails/mta1.borg.local/proc
root@asm-freebsd01:~ # 

root@asm-freebsd01:~ # sysctl hw.physmem
hw.physmem: 1044865024
root@asm-freebsd01:~ #
```


----------



## SirDice (Aug 5, 2016)

1 GB? Am I reading this correctly? That's not a lot, especially since you're also using ZFS. 

You could circumvent it by building your own packages using ports-mgmt/synth or ports-mgmt/poudriere. Just set up a VM at home, have it build all the packages you need and configure your jails to download it from your home system. That's how I update my VPS


----------



## andrewm659 (Aug 5, 2016)

This really isn't production. I'm just messing around w/ FBSD.  So I didn't know.


----------



## SirDice (Aug 5, 2016)

In that case I definitely recommend setting up your own repository. Makes it a lot easier to adjust various default settings while keeping the ease of using packages.


----------



## Oko (Aug 5, 2016)

andrewm659 said:


> I need some help. I want to get gitweb working in my jail instance (ezjail).


I am not sure if you are dead set on gitweb but unlike GitLab which is pain in the rear end to set up (even with the new port) I have great experience with Gogs. I run it out of Jail on the top of ZFS pool (check out old iocage 1.74 written in shell) for a group of about 60 researchers, Ph.D. students, and programmers.


----------



## andrewm659 (Aug 5, 2016)

Isn't Gogs also a replacement for Git?  Or is JUST the web interface?  I really just need an interface to show me my changes do a compare.  I was using WebSVN with Subversion which is great.


----------



## Oko (Aug 5, 2016)

andrewm659 said:


> Isn't Gogs also a replacement for Git?  Or is JUST the web interface?  I really just need an interface to show me my changes do a compare.  I was using WebSVN with Subversion which is great.


Gogs is just a web interface GitHub style for Git. The only feature which is present in GitLab (full blown clone of GitHub) and GitHub we are missing is integration with continuous integration services (think of Jenkins). Everything else works exactly the same as GitHub and if you just want to use vanilla Git you can do it as well.


----------



## andrewm659 (Aug 5, 2016)

Sweet!  how hard is it to setup?  Do I have to pull it from Github and install it that way?


----------



## SirDice (Aug 5, 2016)

I've set up devel/phabricator, just for fun, a while a go. Setting it up was actually quite easy, using it properly however was something else


----------



## andrewm659 (Aug 5, 2016)

SirDice said:


> I've set up devel/phabricator, just for fun, a while a go. Setting it up was actually quite easy, using it properly however was something else


I've read that is a bit of a pain to maintain.


----------



## Oko (Aug 5, 2016)

andrewm659 said:


> Sweet!  how hard is it to setup?  Do I have to pull it from Github and install it that way?


It is not very hard. I am half year overdue to write up notes for my own documentation. If you are not in the hurry I might post howto on this forum by the end of next week for example. The good starting point is

https://gogs.io/docs/installation/install_from_source

I use PostgreSQL as a backend which made things little more complicated (Google PostgreSQL, Jail, FreeBSD to see what I am talking about). With sqlite which should be OK (data base stores only credentials if you are using local authentication) for about 50 people. You will also need to setup proxy (Nginx in my case) which is 3 minute thing if you have done things like that in the past. I tested Gogs also on DragonFly BSD and OpenBSD. Works fantastic.


----------

