You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
pvincent 98dffaebed fix config missing key 3 years ago
common code from amapei 4 years ago
data code from amapei 4 years ago
js cagettepéi 3 years ago
lang/master/tpl simpler config + new logo 3 years ago
src fix config missing key 3 years ago
www simpler config + new logo 3 years ago
.gitignore App.sendMail 3 years ago
.semver_git_tag tagged as 1.11.1 3 years ago
LICENSE code from amapei 4 years ago
Makefile cagettepéi 3 years ago
README.md fix config missing key 3 years ago
cagette.hxml reply-to working 3 years ago
cagetteJs.hxml fix: cagetteJs.hxml 3 years ago
config.xml.dist simpler config + new logo 3 years ago
package.json tagged as 1.11.1 3 years ago
potGeneration.hxml code from amapei 4 years ago

README.md

CAGETTE PEI

Fourche du logiciel [Cagette.net](https://github.com/CagetteNet) à partir de la version 0.9.2 Novembre 2018

Certaines portions du code source de Cagette.net n'étant plus disponibles en téléchargement à partir de cette date, j'ai repris sur la base d'un existant pour adapter au marché local réunionnais et leurs AMAPéi.

PREREQUISITE MARIADB

apt install -y mariadb-server
mysql -u root <<EOF
CREATE DATABASE cagettepei;
GRANT ALL ON cagettepei.* TO 'cagettepei'@'%' IDENTIFIED BY 'cagettepei';
EOF

INSTALL FROM SCRATCH

Rk: Works on any Debian (>=Buster) compatible server!

apt install -y curl 
curl -L https://deb.nodesource.com/setup_8.x | bash -
apt install -y nodejs=8.17.0-1nodesource1
apt install -y sudo haxe apache2 make git imagemagick gettext libapache2-mod-neko mariadb-server sendemail libio-socket-ssl-perl libnet-ssleay-perl

cd /var/www
git clone https://git.artcode.re/cagetters/cagettepei.git
cd cagettepei
make install ENV=dev
vim /etc/apache2/sites-available/cagettepei.conf
<VirtualHost *:80>
  ServerName cagettepei
  DirectoryIndex index.n
  DocumentRoot /var/www/cagettepei/www/

  CustomLog ${APACHE_LOG_DIR}/cagettepei/access.log combined
  ErrorLog ${APACHE_LOG_DIR}/cagettepei/debug.log
  ErrorLogFormat "[%{uc}t] %M"
</VirtualHost>
sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
a2dissite 000-default.conf
a2ensite cagettepei.conf
a2enmod rewrite
mkdir -p /var/log/apache2/cagettepei
systemctl restart apache2

CONFIGURATION

cd /var/www/cagettepei
vim config.xml
<config
host = "<DOMAIN.TLD>"
database = "mysql://cagettepei:cagettepei@localhost/cagettepei"
key = "<SECRET_PHRASE>"
default_email = "<EMAIL>"
webmaster_email = "<EMAIL>"

debug = "0"
sqllog = "0"
maintain = "0"

cache = "1"
cachetpl = "0"
/>

ADMIN RESET PASSWORD

go to http://localhost for ERROR + table regeneration, then

cd /var/www/cagettepei
SECRET=$(grep key config.xml | cut -d= -f2 | cut -d'"' -f2)
echo "insert into User values (1,'fr',MD5('${SECRET}cagettepei'),1,'Administrateur','Cagette Péi', 'admin', null, null, null, null, null, null, null, null, null, now(), now(),6,null, null)" | mysql -h localhost -u cagettepei -pcagettepei cagettepei

then, connect with admin / cagettepei

change admin password

echo "update User set pass=MD5('${SECRET}cagettepei') where id=1" | mysql -h localhost -u cagettepei -pcagettepei cagettepei

SYSTEMD-TIMERS

  • vim /var/www/cagettepei-batch

    #!/bin/bash
    
    case $1 in
        minute);;
        daily);;
        *) echo "expected [minute|daily]" && exit 1;;
    esac
    
    SELECTOR=$1
    
    for i in /var/www/cagettepei* ; do
        if [[ -d $i ]]; then
            cd $i/www
            echo "cron-$SELECTOR in: $i"
            neko index.n cron/$SELECTOR
            echo
        fi
    done
    
    
    
  • chmod +x /var/www/cagettepei-batch

  • vim /etc/systemd/system/cagettepei-batch-minute.service

[Unit]
Description=Run batch cagettepei every minute

[Service]
User=www-data
SyslogIdentifier=cagettepei
ExecStart=/var/www/cagettepei-batch minute

[Install]
WantedBy=multi-user.target
  • vim /etc/systemd/system/cagettepei-batch-day.service
[Unit]
Description=Run batch cagettepei every day

[Service]
User=www-data
SyslogIdentifier=cagettepei
ExecStart=/var/www/cagettepei-batch daily

[Install]
WantedBy=multi-user.target
  • vim /etc/systemd/system/cagettepei-batch-minute.timer
[Unit]
Description=Timer for batch cagettepei every minute
Requires=apache2.service

[Timer]
OnCalendar=minutely
Unit=cagettepei-batch-minute.service

[Install]
WantedBy=timers.target
  • vim /etc/systemd/system/cagettepei-batch-day.timer
[Unit]
Description=Timer for batch cagettepei every day
Requires=apache2.service

[Timer]
OnCalendar=daily
Unit=cagettepei-batch-day.service

[Install]
WantedBy=timers.target
  • systemctl daemon-reload
  • systemctl edit apache2 # bind the 2 timers to apache2 cagette
[Unit]
BindsTo = cagettepei-batch-minute.timer cagettepei-batch-day.timer
  • systemctl enable cagettepei-batch-minute.timer cagettepei-batch-day.timer
  • systemctl start cagettepei-batch-minute.timer cagettepei-batch-day.timer