Skip to content

Commit

Permalink
Fixes #13852: Merge packages into one
Browse files Browse the repository at this point in the history
  • Loading branch information
peckpeck committed Dec 14, 2018
1 parent 12b5874 commit 242ca1e
Show file tree
Hide file tree
Showing 14 changed files with 3,040 additions and 118 deletions.
18 changes: 18 additions & 0 deletions rudder-webapp/SOURCES/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ MAVEN_PROXY := $(if $(PROXY), $(shell echo "$(PROXY)" | perl -ne ' \

RUDDER_VERSION_TO_PACKAGE = <put Rudder version or version-snapshot here>
RUDDER_MAJOR_VERSION := $(shell echo ${RUDDER_VERSION_TO_PACKAGE} | cut -d'.' -f 1-2)
VIRTUALENV_RELEASE = 16.0.0
VIRTUALENV_SHA256 = ca07b4c0b54e14a91af9f34d0919790b016923d157afda5efdde55c96718f752


# GENERIC_GET: do not remove this line
# This is a generic get code that is common to many of our Makefiles.
Expand Down Expand Up @@ -82,6 +85,9 @@ localdepends: ./rudder-sources ./maven/bin/mvn ./rudder-users.xml ./rudder-doc .
./rudder-sources: ./rudder-sources.tar.bz2
tar -xjf rudder-sources.tar.bz2
mv rudder-sources-*/ rudder-sources/
# Remove tests folders we don't want to package
find rudder-sources/rudder-techniques -name "tests" -type d | xargs -r rm -r


./rudder-doc: /usr/bin/wget
# Get user manual from rudder-project.org and rename directory containing it to rudder-doc
Expand All @@ -93,6 +99,15 @@ localdepends: ./rudder-sources ./maven/bin/mvn ./rudder-users.xml ./rudder-doc .
./rudder-users.xml: ./rudder-sources
cp ./rudder-sources/rudder/rudder-web/src/main/resources/demo-rudder-users.xml ./rudder-users.xml

./virtualenv.tgz: /usr/bin/wget
# Original URL: https://pypi.python.org/packages/source/v/virtualenv/virtualenv-12.0.7.tar.gz
$(GET) virtualenv.tgz https://repository.rudder.io/build-dependencies/virtualenv/virtualenv-$(VIRTUALENV_RELEASE).tar.gz $(VIRTUALENV_SHA256)

./virtualenv/virtualenv.py: ./virtualenv.tgz
tar -xzf ./virtualenv.tgz
mv ./virtualenv-$(VIRTUALENV_RELEASE)/ virtualenv/


./.gitignore: ./configuration-repository-gitignore
cp ./configuration-repository-gitignore ./.gitignore

Expand All @@ -104,9 +119,12 @@ localclean:
rm -rf ./rudder-doc
rm -rf ./.gitignore
rm -rf ./settings-external.xml
rm -rf virtualenv/
rm -rf ncf-api-virtualenv

veryclean:
rm -f ./rudder-sources.tar.bz2
rm -rf ./maven.tgz
rm -f virtualenv.tgz

.PHONY: localclean localdepends veryclean
25 changes: 25 additions & 0 deletions rudder-webapp/SOURCES/filter-reqs.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/perl -w
use strict;
use IPC::Open2;

# This scripts takes at least 2 arguments:
# - 1) the string "true" or "false" to tell us whether to *not* exclude LMDB from list of requires (ie, if argument == false, then exclude it)
# - 2) The command and it's arguments to run to auto-detect requirements (original RPM behaviour)
my $dont_exclude_tc = $ARGV[0];
my @command = @ARGV[1 .. $#ARGV];

# This will run the original find-requires script
# and then remove requirements we don't want
open2(\*IN, \*OUT, @command);
print OUT while (<STDIN>);
close(OUT);
my $list = join('', <IN>);

# Apply our exclude filters
$list =~ s/^perl\(.*?$//mg;
$list =~ s/^perl .*?$//mg;
$list =~ s/^\/opt\/rudder\/bin\/perl.*?$//mg;

$list =~ s/^.*lmdb.*?$//mg unless ($dont_exclude_tc eq "true");

print $list;
31 changes: 31 additions & 0 deletions rudder-webapp/SOURCES/ncf-api-virtualenv.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# ncf settings for Apache (for ncf builder, using ncf-api-virtualenv)

## Set up an alias to reach ncf builder itself
Alias /ncf-builder /usr/share/ncf/builder

## Set up a WSGI serving process named ncf_api_flask_app
WSGIDaemonProcess ncf_api_flask_app threads=5 user=ncf-api-venv umask=0007
WSGISocketPrefix /var/run/wsgi

## Make the API available on /ncf using the .wsgi file bundled with the package
WSGIScriptAlias /ncf /usr/share/ncf-api-virtualenv/ncf_api_flask_app.wsgi

## Set directory access permissions
<Directory /usr/share/ncf/builder>
# Allow access from anybody
Require all granted
</Directory>

<Directory /usr/share/ncf/api>
# Allow access from anybody
Require all granted
</Directory>

<Directory /usr/share/ncf-api-virtualenv>
# WSGI parameters
WSGIProcessGroup ncf_api_flask_app
WSGIApplicationGroup %{GLOBAL}

# Allow access from anybody
Require all granted
</Directory>
1 change: 1 addition & 0 deletions rudder-webapp/SOURCES/ncf-api-virtualenv.fc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/var/lib/ncf-api-venv(/.*)? gen_context(system_u:object_r:httpd_sys_rw_content_t,s0)
19 changes: 19 additions & 0 deletions rudder-webapp/SOURCES/ncf-api-virtualenv.te
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module ncf-api-virtualenv 1.1;

require {
type httpd_t;
type var_t;
type init_exec_t;
type init_t;
type usr_t;
class dir { read getattr open search };
class file { execute read ioctl execute_no_trans write getattr unlink open append };
}

#============= httpd_t =============
allow httpd_t var_t:file { execute read getattr execute_no_trans write ioctl unlink open append };
allow httpd_t init_exec_t:file getattr;
allow httpd_t init_t:dir { read getattr open search };
allow httpd_t init_t:file { read getattr open };
allow httpd_t usr_t:file { write execute execute_no_trans };

23 changes: 23 additions & 0 deletions rudder-webapp/SOURCES/ncf_api_flask_app.wsgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This is ncf_api_flask_app.wsgi
#
# It is the main entry point for the ncf api WSGI environment,
# importing the necessary elements like the Python virtualenv
# and the ncf api itself.
#

# Import core modules
import sys

# Set up paths
ncf_path = '/usr/share/ncf/api'
virtualenv_path = '/usr/share/ncf-api-virtualenv'

# Virtualenv initialization
activate_this = virtualenv_path + '/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))

# Append ncf API path to the current one
sys.path.append(ncf_path)

# Launch ncf_api_flask_app
from ncf_api_flask_app import app as application
Loading

0 comments on commit 242ca1e

Please sign in to comment.