first commit
1
dockers/jirafeau/.env
Symbolic link
@ -0,0 +1 @@
|
||||
../../config/dockers.env
|
75
dockers/jirafeau/Dockerfile
Normal file
@ -0,0 +1,75 @@
|
||||
FROM php:7.4-apache
|
||||
|
||||
########################################
|
||||
# APT local cache
|
||||
# work around because COPY failed if no source file
|
||||
COPY .dummy .apt-mirror-confi[g] .proxy-confi[g] /
|
||||
RUN cp /.proxy-config /etc/profile.d/proxy.sh 2> /dev/null || true
|
||||
RUN if [ -f /.apt-mirror-config ] ; then . /.apt-mirror-config && sed -i \
|
||||
-e "s%s\?://deb.debian.org%://${APT_MIRROR_DEBIAN}%g" \
|
||||
-e "s%s\?://security.debian.org%://${APT_MIRROR_DEBIAN_SECURITY}%g" \
|
||||
-e "s%s\?://archive.ubuntu.com%://${APT_MIRROR_UBUNTU}%g" \
|
||||
-e "s%s\?://security.ubuntu.com%://${APT_MIRROR_UBUNTU_SECURITY}%g" \
|
||||
/etc/apt/sources.list; fi
|
||||
|
||||
########################################
|
||||
RUN apt-get update --quiet && apt-get install -y \
|
||||
libicu-dev libpq-dev zlib1g-dev libicu-dev \
|
||||
libzip-dev wget zip patch mailutils sendmail
|
||||
|
||||
RUN apt-get install -y emacs php-elisp telnet
|
||||
|
||||
RUN sed -i 's/127.0.0.1/smtp/' /etc/mail/submit.mc
|
||||
RUN echo "define(\`SMART_HOST',\`smtp')" >> /etc/mail/sendmail.mc
|
||||
RUN m4 /etc/mail/submit.mc > /etc/mail/submit.cf
|
||||
RUN m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
|
||||
|
||||
#install composer setup script
|
||||
COPY dockers/jirafeau/composer-setup.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/composer-setup.sh
|
||||
|
||||
#install internationalization libs
|
||||
RUN docker-php-ext-configure intl
|
||||
RUN docker-php-ext-install intl
|
||||
RUN docker-php-ext-install zip
|
||||
|
||||
########################################
|
||||
#install jirafeau
|
||||
RUN mkdir /var/jirafeau/ /var/jirafeauData/
|
||||
WORKDIR /var/jirafeau
|
||||
COPY --chown=www-data git/Jirafeau/ .
|
||||
COPY --chown=www-data git/depollueur/src/Jirafeau/[aft].php ./
|
||||
COPY --chown=www-data dockers/jirafeau/media/kaz media/kaz
|
||||
RUN sed -i -e '1i\<p>La limite des téléversements est actuellement de <?php echo ini_get("post_max_size"); ?></p>' lib/template/footer.php
|
||||
RUN sed -i -e '/<div id="jyraphe">/i\<div id="kaz">' lib/template/footer.php
|
||||
|
||||
COPY dockers/jirafeau/config/composer.json .
|
||||
RUN /usr/local/bin/composer-setup.sh
|
||||
RUN php composer.phar install
|
||||
|
||||
RUN echo '\n\
|
||||
upload_max_filesize = 1024M\n\
|
||||
post_max_size = 1024M\n\
|
||||
[mail function]\n\
|
||||
SMTP = smtp\n\
|
||||
smtp_port = 25\n\
|
||||
sendmail_path=/usr/sbin/sendmail -t -i\n\
|
||||
sendmail_from = no-reply@kaz.local\n\
|
||||
' > /usr/local/etc/php/php.ini
|
||||
|
||||
RUN chown -R www-data.www-data . /var/jirafeauData/
|
||||
RUN chmod o=,ug=rwX -R . /var/jirafeauData/
|
||||
RUN rm -rf .git .gitignore .gitlab-ci.yml CONTRIBUTING.md README.md Dockerfile
|
||||
|
||||
VOLUME ["/var/jirafeauData", "/etc/apache2/sites-available"]
|
||||
|
||||
RUN echo "#!/bin/sh" >> /entrypoint.sh
|
||||
RUN echo "chown -R www-data: /var/jirafeauData/" >> /entrypoint.sh
|
||||
RUN echo "/usr/sbin/apache2ctl -D FOREGROUND" >> /entrypoint.sh
|
||||
RUN chmod u=+x /entrypoint.sh
|
||||
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
|
32
dockers/jirafeau/build.sh
Executable file
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
SERV_DIR=$(cd $(dirname $0); pwd)
|
||||
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd)
|
||||
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
|
||||
setKazVars
|
||||
|
||||
cd "${SERV_DIR}"
|
||||
CONF_FILE="config/config.local.php"
|
||||
touch "${CONF_FILE}"
|
||||
chown 33:33 "${CONF_FILE}"
|
||||
|
||||
SRC_JIR="https://gitlab.com/mojo42/Jirafeau.git"
|
||||
JIR_VER="4.3.0"
|
||||
|
||||
"${KAZ_BIN_DIR}/installDepollueur.sh"
|
||||
|
||||
printKazMsg "\n *** Création du Dockerfile Jirafeau"
|
||||
|
||||
printKazMsg "\n - GIT Jirafeau "
|
||||
cd "${KAZ_GIT_DIR}"
|
||||
if [ ! -d "Jirafeau" ]; then
|
||||
git clone "${SRC_JIR}" --branch ${JIR_VER}
|
||||
fi
|
||||
|
||||
cd "${KAZ_GIT_DIR}/Jirafeau" && git reset --hard && git checkout ${JIR_VER}
|
||||
|
||||
printKazMsg "\n - Dockefile"
|
||||
cd "${KAZ_ROOT}"
|
||||
# Pour permettre la copy de git il faut que le répertoire soit visible de la racine qui lance la construction
|
||||
docker build -t filekaz . -f dockers/jirafeau/Dockerfile
|
||||
|
18
dockers/jirafeau/composer-setup.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
|
||||
|
||||
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
|
||||
then
|
||||
>&2 echo 'ERROR: Invalid installer signature'
|
||||
rm composer-setup.php
|
||||
exit 1
|
||||
fi
|
||||
|
||||
php composer-setup.php --quiet
|
||||
RESULT=$?
|
||||
rm composer-setup.php
|
||||
exit $RESULT
|
||||
|
5
dockers/jirafeau/config/composer.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"require": {
|
||||
"phpmailer/phpmailer": "^6.5"
|
||||
}
|
||||
}
|
24
dockers/jirafeau/config/jirafeau.conf
Normal file
@ -0,0 +1,24 @@
|
||||
<VirtualHost *:80>
|
||||
ServerName file.kaz.bzh
|
||||
DocumentRoot /var/jirafeau/
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
ServerSignature Off
|
||||
|
||||
<Location / >
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
Options FollowSymLinks MultiViews
|
||||
<IfModule mod_dav.c>
|
||||
Dav off
|
||||
</IfModule>
|
||||
</Location>
|
||||
|
||||
<FilesMatch "^\.ht.*">
|
||||
deny from all
|
||||
satisfy all
|
||||
ErrorDocument 403 "Access denied."
|
||||
</FilesMatch>
|
||||
|
||||
</VirtualHost>
|
||||
|
44
dockers/jirafeau/docker-compose.yml
Normal file
@ -0,0 +1,44 @@
|
||||
# jirafeauDir doit être déclaré dans .env qui pointe sur ../../config/docker.env
|
||||
# car les variables déclarées dans env_file: ne sont pas encore connues dans volumes:
|
||||
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
jirafeau:
|
||||
image: filekaz
|
||||
build: .
|
||||
container_name: ${jirafeauServName}
|
||||
restart: always
|
||||
networks:
|
||||
- jirafeauNet
|
||||
- postfixNet
|
||||
external_links:
|
||||
- ${smtpServName}:${smtpHost}
|
||||
# ports:
|
||||
# - 8081:80
|
||||
env_file:
|
||||
- ../../secret/env-${jirafeauServName}
|
||||
volumes:
|
||||
- ./config/jirafeau.conf:/etc/apache2/sites-available/000-default.conf
|
||||
- fileData:${jirafeauDir}
|
||||
- ./config/config.local.php:/var/jirafeau/lib/config.local.php
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.${jirafeauServName}-admin.rule=Host(`${fileHost}.${domain}`) && PathPrefix(`/admin.php`)"
|
||||
- "traefik.http.routers.${jirafeauServName}-admin.middlewares=test-adminipwhitelist@file"
|
||||
- "traefik.http.routers.${jirafeauServName}.rule=Host(`${fileHost}.${domain}`) && ! PathPrefix(`/admin.php`)"
|
||||
- "traefik.docker.network=jirafeauNet"
|
||||
|
||||
volumes:
|
||||
fileData:
|
||||
config:
|
||||
|
||||
networks:
|
||||
jirafeauNet:
|
||||
external: true
|
||||
name: jirafeauNet
|
||||
postfixNet:
|
||||
external: true
|
||||
name: postfixNet
|
25
dockers/jirafeau/download.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
SERV_DIR=$(cd $(dirname $0); pwd)
|
||||
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd)
|
||||
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
|
||||
setKazVars
|
||||
|
||||
SRC_JIR="https://gitlab.com/mojo42/Jirafeau.git"
|
||||
JIR_VER="4.5.0"
|
||||
|
||||
printKazMsg "\n *** Download Jirafeau"
|
||||
|
||||
mkdir -p "${KAZ_GIT_DIR}"
|
||||
cd "${KAZ_GIT_DIR}"
|
||||
if [ ! -d "Jirafeau" ]; then
|
||||
git clone "${SRC_JIR}" --branch ${JIR_VER}
|
||||
fi
|
||||
|
||||
cd "${KAZ_GIT_DIR}/Jirafeau"
|
||||
if [ -z "$(git branch | grep "${JIR_VER}")" ]; then
|
||||
printKazMsg " checkout branch ${JIR_VER}"
|
||||
git fetch -a
|
||||
git reset --hard
|
||||
git checkout ${JIR_VER}
|
||||
fi
|
50
dockers/jirafeau/first.sh
Executable file
@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
KAZ_ROOT=$(cd $(dirname $0)/../..; pwd)
|
||||
. "${KAZ_ROOT}/bin/.commonFunctions.sh"
|
||||
setKazVars
|
||||
|
||||
JIR_VER=4.5.0
|
||||
|
||||
cd $(dirname $0)
|
||||
. "${DOCKERS_ENV}"
|
||||
. "${KAZ_KEY_DIR}/env-${jirafeauServName}"
|
||||
|
||||
CONF_FILE="${DOCK_VOL}/jirafeau_config/_data/config.local.php"
|
||||
|
||||
if ! grep -q "'installation_done'\s*=>\s*true" "${CONF_FILE}" 2>/dev/null ; then
|
||||
printKazMsg "\n *** Premier lancement de Jirafeau"
|
||||
|
||||
checkDockerRunning "${jirafeauServName}" "Jirafeau" || exit
|
||||
curl -X POST \
|
||||
-d "jirafeau=${JIR_VER}" \
|
||||
-d "step=1" \
|
||||
-d "admin_password=${HTTPD_PASSWORD}" \
|
||||
-d "next=1" \
|
||||
"${httpProto}://${fileHost}.${domain}/install.php"
|
||||
curl -X POST -d "jirafeau=${JIR_VER}" \
|
||||
-d "step=2" \
|
||||
-d "web_root=${httpProto}://${fileHost}.${domain}/" \
|
||||
-d "var_root=${jirafeauDir}" \
|
||||
-d "next=1" \
|
||||
"${httpProto}://${fileHost}.${domain}/install.php"
|
||||
fi
|
||||
|
||||
updatePhpVar(){
|
||||
# $1 key
|
||||
# $2 val
|
||||
# $3 file
|
||||
if grep -q "$1" "$3" ; then
|
||||
sed -i \
|
||||
-e "s%\([\"']$1[\"']\s*=>\s*\)[^,]*,%\1$2,%" \
|
||||
"$3"
|
||||
fi
|
||||
}
|
||||
|
||||
updatePhpVar "style" "'kaz'" "${CONF_FILE}"
|
||||
updatePhpVar "organisation" "'KAZ'" "${CONF_FILE}"
|
||||
|
||||
#updatePhpVar "web_root" "'${httpProto}://${fileHost}.${domain}/'" "${CONF_FILE}"
|
||||
#updatePhpVar "admin_password" "'$(echo -n "${HTTPD_PASSWORD}" | sha256sum | awk '{print $1}')'" "${CONF_FILE}"
|
||||
#updatePhpVar "var_root" "'${jirafeauDir}'" "${CONF_FILE}"
|
||||
#updatePhpVar "installation_done" "true" "${CONF_FILE}"
|
BIN
dockers/jirafeau/media/kaz/bandeau.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
dockers/jirafeau/media/kaz/email.png
Normal file
After Width: | Height: | Size: 596 B |
BIN
dockers/jirafeau/media/kaz/error.png
Normal file
After Width: | Height: | Size: 525 B |
BIN
dockers/jirafeau/media/kaz/favicon.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
dockers/jirafeau/media/kaz/jyraphe.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
dockers/jirafeau/media/kaz/kaz.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
dockers/jirafeau/media/kaz/ok.png
Normal file
After Width: | Height: | Size: 492 B |
205
dockers/jirafeau/media/kaz/style.css.php
Normal file
@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/*
|
||||
* Jyraphe, your web file repository
|
||||
* Copyright (C) 2008 Julien "axolotl" BERNARD <axolotl@magieeternelle.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This stylesheet is the default stylesheet for Jyraphe.
|
||||
* The content is dynamically generated for easier handling.
|
||||
*/
|
||||
|
||||
$dark = '#8B4513';
|
||||
|
||||
header('Content-type: text/css');
|
||||
|
||||
?>
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
text-align: center;
|
||||
margin: 2ex auto;
|
||||
background: white;
|
||||
/* border: <?php echo $dark; ?> 5px solid; */
|
||||
}
|
||||
|
||||
fieldset {
|
||||
text-align: left;
|
||||
width: 40em;
|
||||
margin: auto;
|
||||
background: #E2f5ff;
|
||||
border: 2px solid #02233f;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
fieldset legend {
|
||||
color: white;
|
||||
background: #02233f;
|
||||
border: 2px solid #02233f;
|
||||
padding: 1px 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
background: url('bandeau.png') left top repeat-x;
|
||||
height: 70px;
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
h1 a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
|
||||
fieldset p {
|
||||
margin-left: 25%;
|
||||
}
|
||||
|
||||
.jyraphe_info {
|
||||
font-size: small;
|
||||
margin-left: 30%;
|
||||
}
|
||||
|
||||
label {
|
||||
float: left;
|
||||
width: 12em;
|
||||
}
|
||||
|
||||
input[type=text], input[type=submit], select {
|
||||
color: black;
|
||||
width: 15em;
|
||||
border: 1px #02233f solid;
|
||||
background: white;
|
||||
}
|
||||
|
||||
input:hover {
|
||||
color: white;
|
||||
background: #02233f;
|
||||
}
|
||||
|
||||
#jyraphe {
|
||||
background: url('jyraphe.png') right bottom no-repeat;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
#kaz {
|
||||
background: url('kaz.png') right bottom no-repeat;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 10px;
|
||||
height: 64px;
|
||||
width: 64px;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
#copyright {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.error, .message {
|
||||
width: 50em;
|
||||
margin: 5ex auto;
|
||||
}
|
||||
|
||||
.error {
|
||||
padding-bottom: 1ex;
|
||||
border: red 2px solid;
|
||||
background-color: #FBB;
|
||||
}
|
||||
|
||||
.error p:before {
|
||||
content: url('error.png');
|
||||
padding-right: 1ex;
|
||||
}
|
||||
|
||||
.message {
|
||||
padding: 1ex;
|
||||
border: green 2px solid;
|
||||
background-color: #BFB;
|
||||
}
|
||||
|
||||
.message p:before {
|
||||
content: url('ok.png');
|
||||
padding-right: 1ex;
|
||||
}
|
||||
|
||||
.info {
|
||||
text-align: left;
|
||||
width: 40em;
|
||||
margin: auto;
|
||||
background: #E2f5ff;
|
||||
border: 2px solid #02233f;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.info h2 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.info h3 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.info p {
|
||||
margin-left: 5%;
|
||||
margin-right: 5%;
|
||||
}
|
||||
|
||||
#upload {}
|
||||
|
||||
#uploading {
|
||||
text-align: center;
|
||||
width: 30em;
|
||||
background: #E2f5ff;
|
||||
border: 2px solid #02233f;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#upload_finished {
|
||||
text-align: center;
|
||||
width: 60em;
|
||||
background: #E2f5ff;
|
||||
border: 2px solid #02233f;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#self_destruct {
|
||||
font-weight: bold;
|
||||
color: red;
|
||||
}
|
||||
|
||||
#upload_link_email {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#upload_image_email {
|
||||
padding-left: 20px;
|
||||
padding-bottom: 15px;
|
||||
background: url(email.png) no-repeat;
|
||||
}
|