Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Open Food Supplement Facts - Hackathon - WIP #11085

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
41 changes: 41 additions & 0 deletions conf/apache-2.4/sites-available/ofsf.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# LoadModule perl_module modules/mod_perl.so

ServerAdmin [email protected]

PerlSwitches -I/srv/ofsf/lib

PerlWarn On

# Environment variables that need to be passed to mod_perl
# are passed with PerlPassEnv directives in apache-2.4/mod_perl.conf

PerlRequire /srv/ofsf/lib/startup_apache2.pl

# log the X-Forwarded-For IP address (the client ip) in access_log
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %T/%D" proxy

<Location /cgi>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
Require all granted
</Location>


<VirtualHost *>
DocumentRoot /srv/ofsf/html
ServerName openfoodsupplementsfacts.org
ErrorLog /srv/ofsf/logs/error_log
CustomLog /srv/ofsf/logs/access_log proxy
LogLevel warn
ScriptAlias /cgi/ "/srv/ofsf/cgi/"

<Directory /srv/ofsf/html>
Require all granted
</Directory>

</VirtualHost>

PerlPostReadRequestHandler get_remote_proxy_address

36 changes: 36 additions & 0 deletions conf/ofsf-log.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
log4perl.rootLogger=FATAL, LOGFILE
log4perl.logger.mongodb=FATAL, MONGODB_LOGFILE
log4perl.logger.ratelimiter=INFO, RATELIMITER_LOGFILE
log4perl.logger.requeststats=FATAL, REQUESTSTATS_LOGFILE

log4perl.PatternLayout.cspec.S = sub { my $context = Log::Log4perl::MDC->get_context; use Data::Dumper (); local $Data::Dumper::Indent = 0; local $Data::Dumper::Terse = 1; local $Data::Dumper::Sortkeys = 1; local $Data::Dumper::Quotekeys = 0; local $Data::Dumper::Deparse = 1; my $str = Data::Dumper::Dumper($context); $str =~ s/[\n\r]/ /g; return $str; }
log4perl.PatternLayout.cspec.J = sub { my $context = Log::Log4perl::MDC->get_context; use JSON::MaybeXS; my $json_utf8 = JSON::MaybeXS->new->utf8(1)->allow_nonref->canonical; my $str = $json_utf8->encode($context); return $str; }

log4perl.appender.LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.LOGFILE.filename=/srv/ofsf/logs/log4perl.log
log4perl.appender.LOGFILE.mode=append
# note: autoflush=0 results in multiple log entries being mixed (probably because there are several Apache processes writing to the same file)
log4perl.appender.LOGFILE.autoflush=1
log4perl.appender.LOGFILE.layout=PatternLayout
log4perl.appender.LOGFILE.layout.ConversionPattern=[%d] %F %L %c %S %m{chomp}%n

log4perl.appender.MONGODB_LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.MONGODB_LOGFILE.filename=/srv/ofsf/logs/mongodb_log4perl.log
log4perl.appender.MONGODB_LOGFILE.mode=append
log4perl.appender.MONGODB_LOGFILE.autoflush=1
log4perl.appender.MONGODB_LOGFILE.layout=PatternLayout
log4perl.appender.MONGODB_LOGFILE.layout.ConversionPattern=[%d] %F %L %c %S %m{chomp}%n

log4perl.appender.RATELIMITER_LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.RATELIMITER_LOGFILE.filename=/srv/ofsf/logs/ratelimiter_log4perl.log
log4perl.appender.RATELIMITER_LOGFILE.mode=append
log4perl.appender.RATELIMITER_LOGFILE.autoflush=1
log4perl.appender.RATELIMITER_LOGFILE.layout=PatternLayout
log4perl.appender.RATELIMITER_LOGFILE.layout.ConversionPattern=[%d] %F %L %c %S %m{chomp}%n

log4perl.appender.REQUESTSTATS_LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.REQUESTSTATS_LOGFILE.filename=/srv/ofsf/logs/requeststats_log4perl.log
log4perl.appender.REQUESTSTATS_LOGFILE.mode=append
log4perl.appender.REQUESTSTATS_LOGFILE.autoflush=1
log4perl.appender.REQUESTSTATS_LOGFILE.layout=PatternLayout
log4perl.appender.REQUESTSTATS_LOGFILE.layout.ConversionPattern=%J %n
9 changes: 9 additions & 0 deletions env/env.ofsf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# NOTE: this is an addition to .env file, not a standalone file !
# It should be loaded with: source env/setenv.sh <env>

COMPOSE_PROJECT_NAME=po_ofsf

PRODUCT_OPENER_FLAVOR=openfoodsupplementsfacts
PRODUCT_OPENER_FLAVOR_SHORT=ofsf
ROBOTOFF_URL=https://robotoff.openfoodfacts.org
NUTRIPATROL_URL=https://nutripatrol.openfoodfacts.org/
58 changes: 58 additions & 0 deletions html/images/lang/fr/labels/mise-en-garde-grossesse.90x90.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading