CI Package Server
A sattelite system of the CI server to deliver built packages in other networks. The file access is protected with a dynamic authorization to prevent public access.
An example client was coded in Bash (using curl)
SOURCE https://git-repo.iml.unibe.ch/iml-open-source/ci-pkg
License
GNU GPL 3.0
Requirements
- Webserver with xsentfile module
- Set filepath to [approot]/packages
- Rewrite rule for [ur]/packages/
- an account to receive packages from ci server with ssh
Installation on server
Xsentfile module
On Apache Webserver install xsendfile module.
i.e. on CentOS
yum install mod_xsendfile
Configuration of vhost
In the Apache vhost for cipkg server set the XSendFilePath - it is an absolute path on your websever.
Redirect all requests to /packages/[whatever] to /packages/index.php
Example snippet
XSendFile On
XSendFilePath "/var/www/cipkg.example.com/packages/"
<Location "/packages">
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</Location>
Configuration of secret on server
if [approot]/public_html/ copy inc_config.php.dist to inc_config.php.dist. set a secret behind key apikey.
return array(
// define a secret aka pi key
'apikey'=>'our-package-server-secret',
// local directory of synched ci packages
'packagedir'=>dirname(__DIR__).'/packages',
// allow directory listing when accessing a path of a package
'showdircontent'=>true,
);
Prepare receive of packages
- Create an deployment account package server that can be used to be connected via SSH by the ci server
- add the public key of www-data of the ci server into /home/deployment/.ssh/authorized keys
- Set permissions that the deployment user can write into
/var/www/cipkg.example.com/packages/
and the user of the webeservice can read it
chown deployment:apache /var/www/cipkg.example.com/packages/
andchmod 750 /var/www/cipkg.example.com/packages/
Ci server: add a sync target
TODO
Getting files
An example client to access files from this package server is available as bash script (using curl).
See deployment project https://git-repo.iml.unibe.ch/iml-open-source/imldeployment-client
The download script is bin/getfile.sh.