bilde2910 / Hauk

Open-source realtime location sharing
Apache License 2.0
583 stars 58 forks source link

Memcache is not running in docker and viewing shared location shows "Location expired" error #211

Open kowalcj0 opened 1 week ago

kowalcj0 commented 1 week ago

Hi,

First of all, thank you for this application. It's a really handy!

Unfortunately, I can't get the latest version of server to work properly in docker. It looks like memcache is not starting and as a result, when I view the location I'm getting following error:

Location expired
The shared location you tried to access was not found on the server. If this link worked before, the share might have expired.

Here's how I'm trying to get it to work:

docker pull bilde2910/hauk:v1.6.2

# get example config
curl https://raw.githubusercontent.com/bilde2910/Hauk/master/backend-php/include/config-sample.php -o ~/hauk_config/config.php

# Generate password hash and set it in config.php under `password_hash`
htpasswd -nBC 10 "" | tail -c +2

# set the domain public_url in config.php

# start the container
docker run -d --name hauk -p 36367:80 -v ~/hauk_config:/etc/hauk -t bilde2910/hauk:v1.6.2

I can't see any obvious error the container logs:

$ docker logs hauk 
Started
Can't start logger thread: Operation not permitted
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.3. Set the 'ServerName' directive globally to suppress this message
[Mon Jul 01 21:10:48.136810 2024] [mpm_prefork:notice] [pid 15] AH00163: Apache/2.4.57 (Debian) PHP/8.2.8 configured -- resuming normal operations
[Mon Jul 01 21:10:48.137171 2024] [core:notice] [pid 15] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'

Memcache is not running in the container:

$ docker exec -it hauk sh
# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.1  0.2   3920  2824 pts/0    Ss+  21:10   0:00 /bin/bash ./start.sh
root         7  0.0  0.0   2572   896 pts/0    S+   21:10   0:00 /bin/sh /usr/sbin/apachectl -D FOREGROUND
root        15  0.2  2.4  84912 25076 pts/0    S+   21:10   0:00 /usr/sbin/apache2 -D FOREGROUND
www-data    16  0.0  0.7  84944  7924 pts/0    S+   21:10   0:00 /usr/sbin/apache2 -D FOREGROUND
www-data    17  0.0  0.7  84944  7924 pts/0    S+   21:10   0:00 /usr/sbin/apache2 -D FOREGROUND
www-data    18  0.0  0.7  84944  7924 pts/0    S+   21:10   0:00 /usr/sbin/apache2 -D FOREGROUND
www-data    19  0.0  0.7  84944  7924 pts/0    S+   21:10   0:00 /usr/sbin/apache2 -D FOREGROUND
www-data    20  0.0  0.7  84944  7924 pts/0    S+   21:10   0:00 /usr/sbin/apache2 -D FOREGROUND
root        21  0.5  0.0   2572   896 pts/1    Ss   21:11   0:00 sh
root        26  0.0  0.3   8084  3852 pts/1    R+   21:11   0:00 ps aux

When I try to start memcache manually, I'm getting this error:

$ docker exec -it hauk sh
# memcached -u memcache
Can't start logger thread: Operation not permitted
Aborted

Here's my nginx config for hauk:

cat /etc/nginx/conf.d/hauk.example.com.conf 
server {
    listen        80;
    server_name   hauk.example.com;
    server_tokens off;
    # Discourage deep links by using a permanent redirect to home page of HTTPS site
    return        301 https://hauk.example.com;
}

server {
    listen        443 ssl http2;
    server_name   hauk.example.com;
    server_tokens off;

    #ssl_protocols TLSv1.2;
    #ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305';
    ssl_session_cache shared:SSL:1m;
    ssl_stapling on;
    ssl_stapling_verify on;

    ssl_ecdh_curve 'secp521r1:secp384r1';
    ssl_prefer_server_ciphers on;
    ssl_session_timeout 10m;
    ssl_session_tickets off;

    ssl_certificate           "/etc/letsencrypt/live/example.com-0002/fullchain.pem";
    ssl_certificate_key       "/etc/letsencrypt/live/example.com-0002/privkey.pem";
    ssl_ciphers               PROFILE=SYSTEM;

    # Enable various OWASP Secure headers
    # https://www.owasp.org/index.php/OWASP_Secure_Headers_Project
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
    add_header X-Frame-Options "DENY";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";
    #add_header Content-Security-Policy "script-src 'self'; object-src 'self'";
    add_header X-Permitted-Cross-Domain-Policies "none";
    add_header Referrer-Policy same-origin always;
    add_header X-Robots-Tag "noindex, nofollow" always;

    location / {
        proxy_set_header    Host $host;
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto $scheme;
        proxy_read_timeout  90;
        proxy_pass          http://139.60.145.128:36367/;
    } 
}

Thanks