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.

171 lines
4.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. CAGETTE PEI
  2. ===========
  3. Fourche du logiciel [Cagette.net](https://github.com/CagetteNet) à partir de la version 0.9.2 Novembre 2018
  4. Certaines portions du code source de Cagette.net n'étant plus disponibles en téléchargement,
  5. j'ai repris sur la base d'un existant pour adapter au marché local réunionnais et leurs AMAPéi.
  6. ## INSTALL FROM SCRATCH (debian-buster)
  7. * apt install -y curl
  8. * curl -sL https://deb.nodesource.com/setup_8.x | bash -
  9. * apt install -y nodejs=8.17.0-1nodesource1
  10. * apt install -y sudo haxe apache2 make git imagemagick gettext libapache2-mod-neko mariadb-server
  11. * mysql -u root <<EOF
  12. CREATE DATABASE cagettepei;
  13. GRANT ALL ON cagettepei.* TO 'cagettepei'@'%' IDENTIFIED BY 'cagettepei';
  14. EOF
  15. * cd /var/www
  16. * git clone https://git.artcode.re/cagetters/cagettepei.git
  17. * cd cagettepei
  18. * make install ENV=dev # first time
  19. * make compile # classes
  20. * make templates # templates + i18n
  21. * vim /etc/apache2/sites-available/cagettepei.conf
  22. ```
  23. <VirtualHost *:80>
  24. ServerName cagettepei
  25. DirectoryIndex index.n
  26. DocumentRoot /var/www/cagettepei/www/
  27. </VirtualHost>
  28. ```
  29. * sed -i '/<Directory \/var\/www\/>/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
  30. * a2dissite 000-default.conf
  31. * a2ensite cagettepei.conf
  32. * a2enmod neko rewrite
  33. * systemctl restart apache2
  34. ## CONFIGURATION
  35. * cd /var/www/cagettepei
  36. * vim config.xml
  37. ```
  38. <config
  39. host="<DOMAIN.TLD>"
  40. key="<SECRET_PHRASE>"
  41. name = "CagettePéi"
  42. default_email = "<EMAIL>"
  43. webmaster_email = "<EMAIL>"
  44. database="mysql://cagettepei:cagettepei@localhost/cagettepei"
  45. smtp_host="localhost"
  46. smtp_port="25"
  47. smtp_user=""
  48. smtp_pass=""
  49. lang="fr"
  50. langs="fr"
  51. langnames="Français"
  52. maintain="0"
  53. debug="0"
  54. sqllog="0"
  55. cache="1"
  56. cachetpl="0"
  57. />
  58. ```
  59. ADMIN RESET PASSWORD
  60. --------------------
  61. go to http://localhost for ERROR + table regeneration, then
  62. * cd /var/www/cagettepei
  63. * SECRET=$(grep key= config.xml | cut -d= -f2 | cut -d'"' -f2)
  64. * 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
  65. then, connect with admin / cagettepei
  66. ### change admin password
  67. * echo "update User set pass=MD5('${SECRET}cagettepei') where id=1" | mysql -h localhost -u cagettepei -pcagettepei cagettepei
  68. SYSTEMD-TIMERS
  69. --------------
  70. * vim /var/www/cagettepei-batch
  71. ```
  72. #!/bin/bash
  73. case $1 in
  74. minute);;
  75. daily);;
  76. *) echo "expected [minute|daily]" && exit 1;;
  77. esac
  78. SELECTOR=$1
  79. for i in /var/www/cagettepei-* ; do
  80. if [[ -d $i ]]; then
  81. cd $i/www
  82. echo "cron-$SELECTOR in: $i"
  83. neko index.n cron/$SELECTOR
  84. echo
  85. fi
  86. done
  87. ```
  88. * chmod +x /var/www/cagettepei-batch
  89. * vim /etc/systemd/system/cagettepei-batch-minute.service
  90. ```
  91. [Unit]
  92. Description=Run batch cagettepei every minute
  93. [Service]
  94. User=www-data
  95. SyslogIdentifier=cagettepei
  96. ExecStart=/var/www/cagettepei-batch minute
  97. [Install]
  98. WantedBy=multi-user.target
  99. ```
  100. * vim /etc/systemd/system/cagettepei-batch-day.service
  101. ```
  102. [Unit]
  103. Description=Run batch cagettepei every day
  104. [Service]
  105. User=www-data
  106. SyslogIdentifier=cagettepei
  107. ExecStart=/var/www/cagettepei-batch daily
  108. [Install]
  109. WantedBy=multi-user.target
  110. ```
  111. * vim /etc/systemd/system/cagettepei-batch-minute.timer
  112. ```
  113. [Unit]
  114. Description=Timer for batch cagettepei every minute
  115. Requires=apache2.service
  116. [Timer]
  117. OnCalendar=minutely
  118. Unit=cagettepei-batch-minute.service
  119. [Install]
  120. WantedBy=timers.target
  121. ```
  122. * vim /etc/systemd/system/cagettepei-batch-day.timer
  123. ```
  124. [Unit]
  125. Description=Timer for batch cagettepei every day
  126. Requires=apache2.service
  127. [Timer]
  128. OnCalendar=daily
  129. Unit=cagettepei-batch-day.service
  130. [Install]
  131. WantedBy=timers.target
  132. ```
  133. * systemctl daemon-reload
  134. * systemctl edit apache2 # bind the 2 timers to apache2 cagette
  135. ```
  136. [Unit]
  137. BindsTo = cagettepei-batch-minute.timer cagettepei-batch-day.timer
  138. ```
  139. * systemctl enable cagettepei-batch-minute.timer cagettepei-batch-day.timer
  140. * systemctl start cagettepei-batch-minute.timer cagettepei-batch-day.timer