HelloZeroNet / ZeroNet

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network
https://zeronet.io
Other
18.37k stars 2.27k forks source link

python not found during docker-compose up #2500

Open rubo77 opened 4 years ago

rubo77 commented 4 years ago

I tried to start a zeronode with this docker-compose.yml file, I found here:

version: '3'
services:

  proxy:
    container_name: proxy.zites.cf
    image: nofish/zeronet
    restart: always
    environment:
      ENABLE_TOR: "true"
    volumes:
      - ./data:/root/data
      - ./log:/root/log
      - ./zeronet.conf:/root/zeronet.conf
    ports:
      - "26552:26552"
      - "127.0.0.1:43110:43110"
    command: "sh -c ' ( [ -e /root/plugins/disabled-Multiuser ] && rm -rf /root/plugins/Multiuser && mv /root/plugins/disabled-Multiuser /root/plugins/Multiuser ) && (/usr/bin/tor &) && python zeronet.py --ui_host proxy.zites.cf 127.0.0.1:43110 --ui_ip 0.0.0.0 --fileserver_port 26552'"

but when I run

docker-compose up

It exits with an error:



Creating network "zeronet_default" with the default driver
Pulling proxy (nofish/zeronet:)...
latest: Pulling from nofish/zeronet
aad63a933944: Pull complete
01a00972849f: Pull complete
9bddbe39f010: Pull complete
ea7ed6b444e6: Pull complete
Digest: sha256:19aac3fbb8dd7eedf05423e7c6f69a2090a5ee85f21ff6cc50d2e425b469a777
Status: Downloaded newer image for nofish/zeronet:latest
Creating proxy.zites.cf ... done
Attaching to proxy.zites.cf
proxy.zites.cf | sh: python: not found
proxy.zites.cf exited with code 1
filips123 commented 4 years ago

You probably need to use python3 instead of just python.

rubo77 commented 4 years ago

This made it work, that it installs, but the docker container is restarting every minute now:

6b6e0937b8f8        nofish/zeronet      "sh -c ' ( [ -e /roo…"   15 minutes ago      Restarting (1) 5 seconds ago    proxy.zites.cf

docker logs proxy.zites.cf sais:



[16:21:06] ConnServer Server port opened ipv4: False, ipv6: None      
[16:21:49] - Shutting down (reason: SIGTERM)...                           
[16:21:49] - All server stopped                                   
rubo77 commented 4 years ago

If I remove the last line command: "sh -c ' ( [ -e /root/... then the docker runs fine and I can reach zeronet locally by http://0.0.0.0:43110

Now I only have to figure out, how to allow nginx to proxy it to the outside. Other docker services I can just proxy out by configuring the port, docker serves its service to the VM, but it doesn_t work on my zeronet.

Is there a special option, that I have to enable for this?

HelloZeroNet commented 4 years ago

Here is an example config for locally running ZeroNet client + nginx proxy:

server {

    server_name my.domain;

    location / {
        proxy_pass http://127.0.0.1:43110;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_read_timeout 1h;  # for long live websocket connetion
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Do you see any error displayed or it just not reachable?

rubo77 commented 4 years ago

The docker container runs fine, and I can connect to it locally via

w3m http://127.0.0.1:43110

I tried to add a zeronet.conf file, but It complained, that it must be a directory:

ERROR: for zeronet_zeronet_1  Cannot start service zeronet: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/var/kunden/docker-services/zeronet/zeronet.conf\\\" to rootfs \\\"/var/lib/docker/devicemapper/mnt/ebfe2a34e40cd9a614f576aeafd2caa7ab1ace015375f213eef57373cdb1d995/rootfs\\\" at \\\"/var/lib/docker/devicemapper/mnt/ebfe2a34e40cd9a614f576aeafd2caa7ab1ace015375f213eef57373cdb1d995/rootfs/root/zeronet.conf\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

so I added zeronet.conf/zeronet.conf

[global]
ui_ip = '*'

But still I cannot reach it from outside the VM not even via the main IP of the VM:

 w3m http://10.77.77.106:43110
rubo77 commented 4 years ago

It seems like in your docker-image, there is a folder already at /root/zeronet.conf/ which prevents mounting of a file there

filips123 commented 4 years ago

How did you mount zeronet.conf file? I think that Docker doesn't support mounting files so it failed.

You can instead just specify --ui_ip as command argument, like in official Docker image:

CMD (! ${ENABLE_TOR} || tor&) && python3 zeronet.py --ui_ip 0.0.0.0 --fileserver_port 26552

So, because you are using docker-compose.yml you can probably use:

command: "(! ${ENABLE_TOR} || tor&) && python3 zeronet.py --ui_ip 0.0.0.0 --fileserver_port 26552"
rubo77 commented 4 years ago

Docker Supports mounting files, it should work with the path before the filename like I did

rubo77 commented 3 years ago

Any Idea, how I can fix the nginx-setup? I used your snippet, but I cannot access it from outside