cSvn-UI for SVN Repositories

cGit-UI – is a web interface for Subversion (SVN) Repositories. cSvn CGI script is writen in C and therefore it's fast enough

15 Commits   0 Branches   1 Tag
     5         kx 
     5         kx # cSvn-UI for SVN Repositories
     5         kx 
     5         kx **cSvn-UI** – is a web interface for Subversion (SVN) Repositories. **cSvn** CGI script is writen in **C**
     5         kx and therefore it's fast enough.
     5         kx 
     5         kx 
     5         kx ## Table of Contents
     5         kx 
     5         kx * [Reqired packages](#reqired-packages)
     5         kx * [Installation](#installation)
     5         kx     * [Bootstrap Script](#bootstrap-script)
     5         kx     * [Configuring Sources](#configuring-sources)
     5         kx     * [Post Install](#post-install)
     5         kx * [uWsgi Configuration](#uwsgi)
     5         kx * [Nginx Configuration](#nginx)
     5         kx * [Configuring SVN Repositories](#configuring-svn-repositories)
     5         kx * [See Also](#see-also)
     5         kx * [Copyright and License](#copyright-and-license)
     5         kx 
     5         kx 
     5         kx ## Reqired packages
     5         kx 
     5         kx **cSvn-ui** depends of following libraries: [libpcre2-8](https://www.pcre.org/),
     5         kx [librt](https://www.gnu.org/software/libc/), [libm](https://www.gnu.org/software/libc/),
     5         kx [libmd4c](https://github.com/mity/md4c/), [libmd4c-html](https://github.com/mity/md4c/),
     5         kx [libmagic](http://darwinsys.com/file/), and [libxml2](http://www.xmlsoft.org/).
     5         kx 
     5         kx From the moment when the **cSvn** package was split into two, so as do not produce
     5         kx unnecessary entities, **cSvn-ui** depends on the **cScm** package. Therefore, before
     5         kx installing **cSvn-ui**, you have to install and configure
    10         kx [**cScm Configuration Daemon**](https://csvn.radix.pro/scm-tools/cscm/trunk/README.md).
     5         kx 
     5         kx To use **cSvn-ui** a web server must be installed and configured on the system. We recommend
     5         kx the [Nginx](https://nginx.org/en/) with [uWsgi](https://uwsgi-docs.readthedocs.io/en/latest/)
     5         kx application server. Of course [Apache Subversion](https://subversion.apache.org/) SCM system
     5         kx should be installed too.
     5         kx 
     5         kx 
     5         kx ## Installation
     5         kx 
     5         kx To obtain sources we have to checkout its from SVN repository:
     5         kx 
     5         kx ```Bash
    10         kx svn checkout svn://radix.pro/scm-tools/csvn-ui/tags/csvn-ui-0.1.3 csvn-ui-0.1.3
     5         kx ```
     5         kx and run the bootstrap script:
     5         kx 
     5         kx ```Bash
     5         kx cd csvn-ui-0.1.3
     5         kx ./bootstrap
     5         kx ```
     5         kx Also **cSvn-ui** source packages are available for download on the
     5         kx [Radix.pro FTP-server](https://ftp.radix.pro/pub/csvn-ui/).
     5         kx 
     5         kx 
     5         kx ### Bootstrap Script
     5         kx 
     5         kx The *bootstrap* script especialy created for *Autotools* install automation. To install
     5         kx *Autotools* into sourse directory on build machine (i.e. when **build** == **host**) the *bootstrap*
     5         kx script can be run without arguments.
     5         kx 
     5         kx ```Bash
     5         kx ./bootstrap
     5         kx ```
     5         kx 
     5         kx I this case *Autotools* will be installed from current root file system.
     5         kx 
     5         kx For the cross environment the `--target-dest-dir` option allows to install some stuff from
     5         kx development root file system:
     5         kx 
     5         kx ```Bash
     5         kx TARGET_DEST_DIR=/home/developer/prog/trunk-672/dist/.s9xx-glibc/enybox-x2 \
     5         kx        ./bootstrap --target-dest-dir=${TARGET_DEST_DIR}
     5         kx ```
     5         kx 
     5         kx For example, in this case the *aclocal.m4* script will be collected from the
     5         kx `${TARGET_DEST_DIR}/usr/share/aclocal` directory.
     5         kx 
     5         kx 
     5         kx ### Configuring Sources
     5         kx 
     5         kx ```Bash
     5         kx ./configure --prefix=/usr \
     5         kx             --with-scriptdir=/var/www/htdocs/csvn
     5         kx ```
     5         kx 
     5         kx 
     5         kx #### Install on the Build Machine
     5         kx 
     5         kx ```Bash
     5         kx make
     5         kx make install
     5         kx ```
     5         kx 
     5         kx 
     5         kx #### Cross Compilation Example
     5         kx 
     5         kx ```Bash
     5         kx #!/bin/sh
     5         kx 
     5         kx TARGET_DEST_DIR=/home/developer/prog/trunk-672/dist/.s9xx-glibc/enybox-x2
     5         kx TOOLCHAIN_PATH=/opt/toolchains/aarch64-S9XX-linux-glibc/1.1.4/bin
     5         kx TARGET=aarch64-s9xx-linux-gnu
     5         kx 
     5         kx ./bootstrap --target-dest-dir=${TARGET_DEST_DIR}
     5         kx 
     5         kx PKG_CONFIG=/usr/bin/pkg-config \
     5         kx PKG_CONFIG_PATH=${TARGET_DEST_DIR}/usr/lib${LIBDIRSUFFIX}/pkgconfig:${TARGET_DEST_DIR}/usr/share/pkgconfig \
     5         kx PKG_CONFIG_LIBDIR=${TARGET_DEST_DIR}/usr/lib${LIBDIRSUFFIX}/pkgconfig:${TARGET_DEST_DIR}/usr/share/pkgconfig \
     5         kx STRIP="${TOOLCHAIN_PATH}/${TARGET}-strip" \
     5         kx CC="${TOOLCHAIN_PATH}/${TARGET}-gcc --sysroot=${TARGET_DEST_DIR}" \
     5         kx ./configure --prefix=/usr
     5         kx   --build=x86_64-pc-linux-gnu \
     5         kx   --host=${TARGET} \
     5         kx   --with-scriptdir=/var/www/htdocs/csvn
     5         kx 
     5         kx make
     5         kx make install DESTDIR=${TARGET_DEST_DIR}
     5         kx ```
     5         kx 
     5         kx Also we can make use of additional variables such as `CFLAGS`, `LDFLAGS`:
     5         kx 
     5         kx ```Bash
     5         kx LDFLAGS="-L${TARGET_DEST_DIR}/lib -L${TARGET_DEST_DIR}/usr/lib"
     5         kx TARGET_INCPATH="-L${TARGET_DEST_DIR}/usr/include"
     5         kx CFLAGS="${TARGET_INCPATH}"
     5         kx CPPFLAGS="${TARGET_INCPATH}"
     5         kx ```
     5         kx 
     5         kx 
     5         kx ### Post Install
     5         kx 
     5         kx The system user, on whose behalf the **Nginx** server is launched, must have permissions to access
     5         kx the directory in which the **cSvn-ui CGI script** was installed:
     5         kx 
     5         kx ```Bash
     5         kx chown -R nginx:nginx /var/www/htdocs/csvn
     5         kx ```
     5         kx 
     5         kx 
     5         kx ## uWsgi
     5         kx 
     5         kx Since we used the *--with-scriptdir=/var/www/htdocs/csvn* option on configuring stage,
     5         kx the **cSvn-ui** CGI script installed in the */var/www/htdocs/csvn/* directory. In this case,
     5         kx the */etc/uwsgi/csvn-ui.ini* file should look like this:
     5         kx 
     5         kx **/etc/uwsgi/csvn-ui.ini:**
     5         kx 
     5         kx ```ini
     5         kx [uwsgi]
     5         kx master          = true
     5         kx plugins         = cgi
     5         kx socket          = /run/uwsgi/%n.sock
     5         kx uid             = nginx
     5         kx gid             = nginx
     5         kx procname-master = uwsgi csvn-ui
     5         kx processes       = 1
     5         kx threads         = 2
     5         kx cgi             = /var/www/htdocs/csvn/csvn-ui.cgi
     5         kx ```
     5         kx 
     5         kx Where */var/www/htdocs/csvn/csvn-ui.cgi* is the full name of installed **cSvn-ui** CGI script.
     5         kx 
     5         kx To run the **uWSGI** daemon for **cSvn-ui** backend we can make use following start/stop script:
     5         kx 
     5         kx **/ets/rc.d/rc.csvn-ui-uwsgi:**
     5         kx 
     5         kx ```Bash
     5         kx #!/bin/sh
     5         kx #
     5         kx # uWSGI daemon control script.
     5         kx #
     5         kx 
     5         kx CONF=csvn-ui
     5         kx BIN=/usr/bin/uwsgi
     5         kx CONFDIR=/etc/uwsgi
     5         kx PID=/var/run/$CONF-uwsgi.pid
     5         kx 
     5         kx uwsgi_start() {
     5         kx   # Sanity checks.
     5         kx   if [ ! -r $CONFDIR/csvn-ui.ini ]; then # no config files, exit:
     5         kx     echo "There are config files in $CONFDIR directory. Abort."
     5         kx     exit 1
     5         kx   fi
     5         kx 
     5         kx   if [ -s $PID ]; then
     5         kx     echo "uWSGI for cSvn-ui appears to already be running?"
     5         kx     exit 1
     5         kx   fi
     5         kx 
     5         kx   echo "Starting uWSGI for cSvn-ui server daemon..."
     5         kx   if [ -x $BIN ]; then
     5         kx     /bin/mkdir -p /run/uwsgi
     5         kx     /bin/chown nginx:nginx /run/uwsgi
     5         kx     /bin/chmod 0755 /run/uwsgi
     5         kx     $BIN --thunder-lock --pidfile $PID --daemonize /var/log/csvn-ui-uwsgi.log --ini $CONFDIR/$CONF.ini
     5         kx   fi
     5         kx }
     5         kx 
     5         kx uwsgi_stop() {
     5         kx   echo "Shutdown uWSGI for cSvn-ui gracefully..."
     5         kx   /bin/kill -INT $(cat $PID)
     5         kx   /bin/rm -f $PID
     5         kx }
     5         kx 
     5         kx uwsgi_reload() {
     5         kx   echo "Reloading uWSGI for cSvn-ui configuration..."
     5         kx   kill -HUP $(cat $PID)
     5         kx }
     5         kx 
     5         kx uwsgi_restart() {
     5         kx   uwsgi_stop
     5         kx   sleep 3
     5         kx   uwsgi_start
     5         kx }
     5         kx 
     5         kx case "$1" in
     5         kx   start)
     5         kx     uwsgi_start
     5         kx     ;;
     5         kx   stop)
     5         kx     uwsgi_stop
     5         kx     ;;
     5         kx   reload)
     5         kx     uwsgi_reload
     5         kx     ;;
     5         kx   restart)
     5         kx     uwsgi_restart
     5         kx     ;;
     5         kx   *)
     5         kx   echo "usage: `basename $0` {start|stop|reload|restart}"
     5         kx esac
     5         kx ```
     5         kx 
     5         kx To run this daemon on systems with BSD-like initialization such as **Slackware**
     5         kx we have to add following lines to the */etc/rc.d/rc.M* and */etc/rc.d/rc.6* scripts
     5         kx correspondingly.
     5         kx 
     5         kx **/etc/rc.d/rc.M:**
     5         kx 
     5         kx ```Bash
     5         kx # Start uWSGI for cSvn-ui server:
     5         kx if [ -x /etc/rc.d/rc.csvn-ui-uwsgi ]; then
     5         kx   /etc/rc.d/rc.csvn-ui-uwsgi start
     5         kx fi
     5         kx ```
     5         kx 
     5         kx **/etc/rc.d/rc.6:**
     5         kx 
     5         kx ```Bash
     5         kx # Stop uWSGI for cSvn-ui server:
     5         kx if [ -x /etc/rc.d/rc.csvn-ui-uwsgi ]; then
     5         kx   /etc/rc.d/rc.csvn-ui-uwsgi stop
     5         kx fi
     5         kx ```
     5         kx 
     5         kx 
     5         kx ## Nginx
     5         kx 
     5         kx First of all we have to add virtual server to the main **Nginx** config file:
     5         kx 
     5         kx **/etc/nginx/nginx.conf:**
     5         kx 
     5         kx ```Nginx
     5         kx     include /etc/nginx/vhosts/csvn.example.org.conf;
     5         kx ```
     5         kx 
     5         kx The following configuration used **uWsgi** and will serve **cSvn-ui** on a subdomain
     5         kx like *csvn.example.org*:
     5         kx 
     5         kx **/etc/nginx/vhosts/csvn.example.org.conf:**
     5         kx 
     5         kx ```Nginx
     5         kx #
     5         kx # cSvn server:
     5         kx #
     5         kx 
     5         kx     server {
     5         kx         listen 80;
     5         kx         server_name csvn.example.org;
     5         kx         return 301 https://csvn.example.org$request_uri;
     5         kx     }
     5         kx 
     5         kx     server {
     5         kx         listen 443 ssl;
     5         kx         server_name csvn.example.org;
     5         kx         root /var/www/htdocs/csvn;
     5         kx 
     5         kx         charset UTF-8;
     5         kx 
     5         kx         #
     5         kx         # see:
     5         kx         #   https://developer.mozilla.org/en-US/docs/Web/Security/HTTP_strict_transport_security ,
     5         kx         #   https://raymii.org/s/tutorials/HTTP_Strict_Transport_Security_for_Apache_NGINX_and_Lighttpd.html
     5         kx         #
     5         kx         # see also: http://classically.me/blogs/how-clear-hsts-settings-major-browsers
     5         kx         # and do not include includeSubdomains; parameter into line:
     5         kx         #
     5         kx         add_header Strict-Transport-Security "max-age=63072000; preload";
     5         kx 
     5         kx         error_log /var/log/nginx/csvn.example.org-error.log;
     5         kx         access_log /var/log/nginx/csvn.example.org-access.log;
     5         kx 
     5         kx         keepalive_timeout        60;
     5         kx         ssl_certificate          /etc/letsencrypt/live/csvn.example.org/fullchain.pem;
     5         kx         ssl_certificate_key      /etc/letsencrypt/live/csvn.example.org/privkey.pem;
     5         kx         ssl_trusted_certificate  /etc/letsencrypt/live/csvn.example.org/chain.pem;
     5         kx         ssl_protocols            SSLv3 TLSv1 TLSv1.1 TLSv1.2;
     5         kx         ssl_ciphers              "RC4:HIGH:!aNULL:!MD5:!kEDH";
     5         kx 
     5         kx         gzip on;
     5         kx         gzip_disable "msie6";
     5         kx         gzip_comp_level 6;
     5         kx         gzip_min_length 1100;
     5         kx         gzip_buffers 16 8k;
     5         kx         gzip_proxied any;
     5         kx         gzip_types text/plain text/css text/js text/xml text/javascript
     5         kx                    image/svg+xml image/gif image/jpeg image/png
     5         kx                    application/json application/x-javascript application/xml application/xml+rss application/javascript
     5         kx                    font/truetype font/opentype application/font-woff application/font-woff2
     5         kx                    application/x-font-ttf application/x-font-opentype application/vnd.ms-fontobject application/font-sfnt;
     5         kx 
     5         kx 
     5         kx         location ~* ^.+(favicon.ico|robots.txt) {
     5         kx             root /var/www/htdocs/csvn;
     5         kx             expires 30d;
     5         kx         }
     5         kx 
     5         kx         location = /robots.txt {
     5         kx             allow all;
     5         kx             log_not_found off;
     5         kx             access_log off;
     5         kx         }
     5         kx 
     5         kx         location / {
     5         kx             try_files $uri @csvn-ui;
     5         kx         }
     5         kx 
     5         kx         location @csvn-ui {
     5         kx             gzip off;
     5         kx             include uwsgi_params;
     5         kx             uwsgi_modifier1 9;
     5         kx             uwsgi_pass unix:/run/uwsgi/csvn-ui.sock;
     5         kx         }
     5         kx     }
     5         kx ```
     5         kx 
     5         kx 
     5         kx ## Configuring SVN Repositories
     5         kx 
     5         kx A detailed description of the configuration file format can be found in the
    10         kx [**csvn-ui.rc(5)**](https://csvn.radix.pro/scm-tools/csvn-ui/trunk/doc/csvn-ui.rc.5.md) manual page:
     5         kx 
     5         kx ```Bash
     5         kx man 5 csvn-ui.rc
     5         kx ```
     5         kx 
     5         kx Here we will give an example of a description of the
     5         kx [Apache Subversion repository](https://svn.apache.org/viewvc/subversion/trunk/).
     5         kx Please note that the Apache server responds very slowly to HTTP requests.
     5         kx 
     5         kx ```dts
     5         kx /**************************
     5         kx   Apache's SVN repository:
     5         kx  */
     5         kx home-page = "https://svn.apache.org/";
     5         kx 
     5         kx section "Subversion" {
     5         kx   repo 'subversion' {
     5         kx     owner = "Apache";
     5         kx     description = "Source repository of the Subversion.";
     5         kx     checkout-prefix-readonly = 'https://svn.apache.org/repos/asf';
     5         kx   }
     5         kx }
     5         kx ```
     5         kx 
     5         kx To access your own repositories, we recommend the **svn+ssh** protocol.
     5         kx 
     5         kx 
     5         kx ## See Also
     5         kx 
    10         kx > [**cscmd(8)**](https://csvn.radix.pro/scm-tools/cscm/trunk/doc/cscmd.8.md), 
    10         kx > [**csvn-ui.rc(5)**](https://csvn.radix.pro/scm-tools/csvn-ui/trunk/doc/csvn-ui.rc.5.md)
     5         kx 
     5         kx 
     5         kx ## Copyright and License
     5         kx 
     5         kx &#169; Andrey V. Kosteltsev, 2019 &#8211; 2020.<br/>
    13         kx Code and documentation released under [the **Radix.pro** License](https://csvn.radix.pro/scm-tools/csvn-ui/trunk/LICENSE).