the-djmaze / snappymail

Simple, modern & fast web-based email client
https://snappymail.eu
GNU Affero General Public License v3.0
1.01k stars 121 forks source link

migration from rainloop to snappymail #444

Closed andy-mic closed 2 years ago

andy-mic commented 2 years ago

Describe the bug I have recently come across snappymail as rainloop appears to no longer be in development. I have read the install instructions (https://github.com/the-djmaze/snappymail/wiki/Installation-instructions) but am having trouble getting snappymail to work. I have tried both 'over the top' of an existing install, as well as a build from scratch.

I must admit I'm quite new to this, so there is a good chance I've missed something. The documentation is quite brief, so perhaps additional steps/details may need to be included?

To Reproduce I have followed the instructions under "Migration/Upgrade from RainLoop" - I don't use any plugins - when I try to access the admin page, I just get a blank page

I have also tried installing on a new system "General instructions" (fresh OS image, etc.) and still get the same blank page

The URLs I have tried (x.x.x.x is the IP of the server) http://x.x.x.x/webmail?admin - The requested URL was not found on this server. https://x.x.x.x/webmail?admin - The requested URL was not found on this server. http://x.x.x.x/?admin - blank page https://x.x.x.x/?admin - blank page http://x.x.x.x/ - blank page https://x.x.x.x/ - blank page

Sample apache config (after OS + snappymail fresh install)

/etc/apache2/sites-available/webmail.conf

<VirtualHost *:80>
  ServerName my.server
  Redirect / https://my.server
</VirtualHost>

<VirtualHost *:443>
  ServerName my.server
  DocumentRoot "/var/www/webmail/"
  SSLEngine On
  SSLCertificateFile    /etc/ssl/certs/ssl-cert-snakeoil.pem
  SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
  #ServerAdmin postmaster@mydomain.com

  ErrorLog "/var/log/apache2/webmail_error_log"
  TransferLog "/var/log/apache2/webmail_access_log"

<Directory /var/www/webmail>
  DirectoryIndex index.php
  Options -Indexes +ExecCGI
  AllowOverride All
  Order deny,allow
  Allow from all
  Require all granted
</Directory>

</VirtualHost>

Expected behavior Access to the admin page to configure snappymail

Desktop (please complete the following information):

Other info

xgbstar1 commented 2 years ago

Updated 2022/09/01 to note updated releases in RainLoop since they deleted the release artifact and added a new artifact with a different name. Also updated SnappMail version to latest.

Hello. Do you know how to use Docker?

If so, try below steps that I used to get this to work. Otherwise, hopefully these provide you with a sense of steps that work.

  1. Create a working directory and add the following directory structure and files

    — Dockerfile // see step 1. for details
    — start.sh  // see step 2. for details
    — volumes
    —— etc-apache2-sites-available
    ——— snappymail.conf  // see step 3. for details
    —— usr-local-etc-php-conf.d
    ——— increase-upload-size.ini  // see step 4. for details
    —— var-log-apache2
    ——— // optional: migrate log files from Rainloop here
    —— var-www-snappymail-data
    ——— // optional: migrate data files from Rainloop here, includes files like "VERSION", index.html, index.php, etc. and folder named "_data_" 
  2. Create a working directory and add a new file named Dockerfile with the following content. Note, the customizations.css file is optional and you can take out the related lines if you don't plan to customize the css. I'm happy to share my customizations based on Rainloop if you're interested.

FROM php:7.4-apache

RUN apt-get update && \
apt-get install -y unzip wget

RUN  curl -s https://api.github.com/repos/RainLoop/rainloop-webmail/releases/latest \
| grep "browser_download_url.*rainloop-legacy.*zip" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi - 

COPY ./volumes/etc-apache2-sites-available/snappymail.conf /etc/apache2/sites-available/snappymail.conf

RUN unzip rainloop-legacy*zip -d /var/www/snappymail

RUN curl -s https://api.github.com/repos/the-djmaze/snappymail/releases/latest  \
    | grep "browser_download_url.*snappymail.*zip" \
    | cut -d : -f 2,3 \
    | tr -d \" \
    | wget -qi -

RUN unzip -o snappymail*zip -d /var/www/snappymail

COPY css-customizations/customizations.css  /tmp/customizations.css

RUN cat /tmp/customizations.css >> /var/www/snappymail/snappymail/v/2.17.4/static/css/app.min.css

RUN chown www-data:www-data /var/www/snappymail/ -R

RUN a2ensite snappymail.conf

RUN a2enmod rewrite && \
    a2enmod ssl
  1. Add start.sh file
    
    #!/bin/bash

pushd /opt/snappymail

docker build -t snappymail .

docker rm -f snappymail

id=$(docker create snappymail)

docker cp $id:/var/www/snappymail/data/. $(pwd)/volumes/var-www-snappymail-data

docker rm -v $id

find $(pwd)/volumes/var-www-snappymail-data -type d -exec chmod 775 {} \; find $(pwd)/volumes/var-www-snappymail-data -type f -exec chmod 664 {} \;

chown -R 33:33 $(pwd)/volumes/var-www-snappymail-data

docker run -it \ -d \ -p 80:80 \ --restart unless-stopped \ -p 443:443 \ -v $(pwd)/volumes/var-www-snappymail-data:/var/www/snappymail/data \ -v $(pwd)/volumes/etc-apache2-sites-available:/etc/apache2/sites-available \ -v $(pwd)/volumes/var-log-apache2:/var/log/apache2/ \ -v $(pwd)/volumes/usr-local-etc-php-conf.d/increase-upload-size.ini:/usr/local/etc/php/conf.d/increase-upload-size.ini \ -v /etc/letsencrypt/:/etc/letsencrypt/:ro \ --name snappymail \ snappymail

popd


3. Add the `volumes/etc-apache2-sites-available/snappymail.conf` file. These instructions reference an SSL certificate generated for `mail.YOURDOMAIN.com` be `letsencrypt` so update this configuration to your needs. Also, the `ServerName` should be updated accordingly.
```apache
<VirtualHost *:80>
  DocumentRoot "/var/www/snappymail/"
  ServerName mail.YOURDOMAN.com
  LimitRequestLine 65536
  ErrorLog "/var/log/apache2/snappymail_error_log"
  TransferLog "/var/log/apache2/snappymail_access_log"
  Options +Indexes +FollowSymlinks
  RewriteEngine on
  Redirect permanent / https://mail.YOURDOMAN.com/
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://mail.YOURDOMAIN.com%{REQUEST_URI}
</VirtualHost>
<VirtualHost *:443>
  ServerName mail.YOURDOMAIN.com
  DocumentRoot "/var/www/snappymail/"

  LimitRequestLine 65536

  ErrorLog "/var/log/apache2/snappymail_ssl_error_log"
  TransferLog "/var/log/apache2/snappymail_ssl_access_log"

  SSLEngine on
  SSLHonorCipherOrder on
  SSLProtocol all -TLSv1.1 -TLSv1 -SSLv2 -SSLv3
  SSLCipherSuite          ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA
  SSLHonorCipherOrder     on
  SSLCompression          off

  <Directory />
    Options +Indexes +FollowSymLinks +ExecCGI
    AllowOverride All
    Order deny,allow
    Allow from all
    Require all granted
  </Directory>

  <Directory /var/www/snappymail/data>
     Require all denied
  </Directory>

  SSLCertificateFile /etc/letsencrypt/live/mail.YOURDOMAN.com/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/mail.YOURDOMAIN.com/privkey.pem

</VirtualHost>
  1. Add the volumes/usr-local-etc-php-conf.d/increase-upload-size.ini file

    upload_max_filesize = 2000M
    post_max_size = 2000M;
  2. Finally, run start.sh file

    chmod +x run.sh
    ./run.sh

Hope this helps. If you think it useful, let me know and I might add this to a git repo to make it a bit easier to use for others. :-)

andy-mic commented 2 years ago

hey xgbstar1

really appreciate your reply! I don't use docker - in fact I had to google what it is and how it works.

Anyway, when I have some time one weekend I'll give it a shot and see how I go

I can see you're using php 7.4 - I have version 8.1 installed, so I'm not sure if that might be the issue? The steps you have above is more or less what I've been doing, I'm just wondering if there is something else I need to install to make it work?... Rainloop was so much easier in comparison - literally just download the zip and tell apache to serve those pages.

Cheers

the-djmaze commented 2 years ago

Did you check your Apache error logs?