diff --git a/README.markdown b/README.md similarity index 50% rename from README.markdown rename to README.md index 6b71332..e0ce1b2 100644 --- a/README.markdown +++ b/README.md @@ -3,4 +3,8 @@ Lutim for YunoHost [Yunohost project](https://yunohost.org/#/) +...Description... + https://lut.im + +Le script installe le paquet *perlmagick* et le module perl *carton* via cpan. diff --git a/conf/cron_leed b/conf/cron_leed deleted file mode 100644 index ab38f60..0000000 --- a/conf/cron_leed +++ /dev/null @@ -1,3 +0,0 @@ -# Mise a jour de leed toutes les 2 heures. - -0 */2 * * * __ADMIN__ wget -q -O - "https://__DOMAIN____PATH__/action.php?action=synchronize&code=__CODESYNC__" > /dev/null 2>&1 diff --git a/conf/cron_lutim b/conf/cron_lutim new file mode 100644 index 0000000..f734874 --- /dev/null +++ b/conf/cron_lutim @@ -0,0 +1,11 @@ +# Génération des statistiques. Tous les jours, à 5h. +0 5 * * * www-data carton exec script/lutim cron stats && carton exec hypnotoad script/lutim + +# Suppression des adresses IP obsolètes. Tous les jours, à 6h. +0 6 * * * www-data carton exec script/lutim cron cleanbdd + +# Suppression des images dont le délai a expiré. Tous les jours, à 6h. +0 6 * * * www-data carton exec script/lutim cron cleanfiles + +# Vérification de l'occupation du dossier des images. Tous les jours, à 7h. +0 7 * * * www-data carton exec script/lutim cron watch diff --git a/conf/lutim.default b/conf/lutim.default new file mode 100644 index 0000000..3c305d8 --- /dev/null +++ b/conf/lutim.default @@ -0,0 +1,3 @@ +# LDIR is the path where you installed Lutim +# It has to end with a final / +LDIR=__FINALPATH__ diff --git a/conf/nginx.conf b/conf/nginx.conf index d8c6cf5..319bab8 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,19 +1,72 @@ -location PATHTOCHANGE { - alias ALIASTOCHANGE ; - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - index index.php; - try_files $uri $uri/ index.php; - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm.sock; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - } - +#location __PATH__ { +# alias __FINALPATH__; +# if ($scheme = http) { +# rewrite ^ https://$server_name$request_uri? permanent; +# } +# index index.php index.html index.htm; +# default_type text/html; +# location ~ [^/]\.php(/|$) { +# fastcgi_split_path_info ^(.+?\.php)(/.*)$; +# fastcgi_pass unix:/var/run/php5-fpm.sock; +# fastcgi_index index.php; +# include fastcgi_params; +# fastcgi_param REMOTE_USER $remote_user; +# fastcgi_param PATH_INFO $fastcgi_path_info; +# } +# # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; -} +# include conf.d/yunohost_panel.conf.inc; +#} + + + + +#server { +# listen 80; +# root /path/to/lutim/public; + + # This is important for user's privacy ! +# access_log off; +# error_log /var/log/nginx/lutim.error.log; + + # This is important ! Make it OK with your Lutim configuration + client_max_body_size 40M; + + location ~* ^/(img|css|font|js)/ { + try_files $uri @lutim; + add_header Expires "Thu, 31 Dec 2037 23:55:55 GMT"; + add_header Cache-Control "public, max-age=315360000"; + + # HTTPS only header, improves security + #add_header Strict-Transport-Security "max-age=15768000"; + } + +# location / { + location __PATH__ { +#alias __FINALPATH__; + try_files $uri @lutim; + + # HTTPS only header, improves security + #add_header Strict-Transport-Security "max-age=15768000"; + } + + location @lutim { + # Adapt this to your configuration + # My advice: put a varnish between nginx and Lutim, it's really useful when images are widel$ + proxy_pass http://127.0.0.1:8080; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # If you want to log the remote port of the image senders, you'll need that + proxy_set_header X-Remote-Port $remote_port; + + # Lutim reads this header and understands that the current session is actually HTTPS. + # Enable it if you run a HTTPS server (in this case, don't forgot to change the listen port $ + #proxy_set_header X-Forwarded-Proto https; + + # We expect the downsteam servers to redirect to the right hostname, so don't do any rewrite$ + proxy_redirect off; + } +#} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 2d36808..f066d19 100644 --- a/manifest.json +++ b/manifest.json @@ -6,10 +6,11 @@ "fr": "Leed est un agrégateur RSS minimaliste qui permet la consultation de flux RSS de manière rapide et non intrusive." Lutim est un logiciel d’hébergement d’images. Il s’agit aussi du nom du logiciel (libre) qui fournit ce service. }, - "developer": { + "version": "0.6", + "url": "https://lut.im", + "maintainer": { "name": "Maniack Crudelis", - "email": "maniack@crudelis.fr", - "url": "https://lut.im/" + "email": "maniackc_dev@crudelis.fr" }, "multi_instance": "true", "arguments": { diff --git a/scripts/install b/scripts/install index 18050ed..4f09a22 100644 --- a/scripts/install +++ b/scripts/install @@ -29,9 +29,6 @@ sudo mkdir -p $final_path sudo cp -a ../sources/lutim-master/* $final_path sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/lutim.conf -# Set right permissions for curl install -# sudo chown -R www-data: $final_path - # Installation du module perl carton yes | sudo cpan Carton # Installation de perlmagick, interface perl pour imagemagick @@ -43,30 +40,26 @@ cd $final_path sudo carton install ## Copie et configuration du fichier de conf. +sudo cp ../conf/lutim.conf.template $final_path/lutim.conf +sudo sed -i "s@__DOMAIN__@$domain@g" $final_path/lutim.conf # Mise en place des scripts init -sudo cp $final_path/utilities/lutim.init /etc/init.d/lutim -sudo cp $final_path/utilities/lutim.default /etc/default/lutim +sudo cp ../sources/lutim-master/utilities/lutim.init /etc/init.d/lutim +sudo cp ../conf/lutim.default /etc/default/lutim sudo chmod +x /etc/init.d/lutim chown root:root /etc/init.d/lutim /etc/default/lutim -## vim /etc/default/lutim - -## /etc/init.d/lutim start +sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/default/lutim ## Démarrage auto des scripts init +sudo update-rc.d lutim defaults +# sudo update-rc.d -f lutim remove + +# Change variables in nginx configuration +sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/lutim.conf +sudo sed -i "s@__FINALPATH__@$final_path/@g" /etc/nginx/conf.d/$domain.d/lutim.conf ## Voir les crons et les mettre en place. -## Reverse proxy nginx à configurer - - - - -# Change variables in lutim configuration -sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/lutim.conf -sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/lutim.conf - - # Files owned by root, www-data can just read # sudo find $final_path -type f | xargs sudo chmod 644 @@ -74,6 +67,8 @@ sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/lutim.c # sudo chown -R root: $final_path # www-data can write on plugins and cache # sudo chown -R www-data $final_path/cache $final_path/plugins +# Set right permissions +sudo chown -R www-data: $final_path # Make app public or private sudo yunohost app setting lutim is_public -v "$is_public"