Skip to content
This repository has been archived by the owner on Jul 10, 2022. It is now read-only.

How do I start it on a Virtual machine? #920

Closed
moblesmarti opened this issue May 26, 2019 · 30 comments
Closed

How do I start it on a Virtual machine? #920

moblesmarti opened this issue May 26, 2019 · 30 comments
Assignees
Labels

Comments

@moblesmarti
Copy link

moblesmarti commented May 26, 2019

Hi, everyone, first of all, I have a server with Proxmox and I have installed in a virtual machine Ubuntu Server 18.04, docker, docker composer and the latest version of PaperWork 2 software according to the instructions.

It seems that it's installed correctly, but I don't know how to start it because it is a virtual machine and it is on the address 192.168.1.XXX, not localhost. I can not see where the error is.

Can somebody help me?

Thanks in advance.

@mrusme
Copy link
Member

mrusme commented May 26, 2019

Simply add a DNS entry which points paperwork.local, api.paperwork.local and www.paperwork.local to your IP, e.g. 192.168.1.123. Also make sure that you allow your Docker Swarm to bind port 80 onto 0.0.0.0 and you don't have any iptables/firewall rule that blocks incoming TCP connections on that port. That should basically get it working for you.

@mrusme mrusme self-assigned this May 26, 2019
@sandzhaj
Copy link

I created digitalocean's droplet with ubuntu+docker, added "127.0.0.1 localhost paperwork.local api.paperwork.local www.paperwork.local" in my /etc/hosts, then i run:

  1. docker swarm init --advertise-addr my-external-ip
  2. make deploy

And after that i got "404 page not found" on the 80 port

@mrusme
Copy link
Member

mrusme commented May 26, 2019

The DNS needs to point to the Docker Swarm. If you don't run Docker Swarm locally, pointing the DNS to 127.0.0.1 makes no sense.

@sandzhaj
Copy link

Oh, i see. I don't know enough about docker swarm, But it seems that i have to go trough it if i want to test this app.
By the way, on the paperwork.cloud i read "The Makefile then takes care of initializing Swarm, in case you haven’t done that already, creating the encrypted network (papernet) and deploying the Paperwork stack on top of it." But if i run makefile on the fresh install ubuntu, i'll get this error:
root@docker-s-4vcpu-8gb-sgp1-01:~/paperwork# make deploy docker stack deploy --orchestrator=swarm --prune --compose-file paperwork.yml paperwork this node is not a swarm manager. Use "docker swarm init" or "docker swarm join" to connect this node to swarm and try again Makefile:31: recipe for target 'deploy' failed make: *** [deploy] Error 1 root@docker-s-4vcpu-8gb-sgp1-01:~/paperwork#

@mrusme
Copy link
Member

mrusme commented May 26, 2019

@sandzhaj thanks for pointing out. I've adjusted the Makefile, so that make init is now being performed within make deploy. Pull the latest version and you'll get the initialisation done for you.

@mrusme
Copy link
Member

mrusme commented May 26, 2019

@sandzhaj as for the rest: Unfortunately, yes. I've tried to make it clearer here. As of right now, v2 really is not suited for the average Joe who'd simply like a sneak-peek of Paperwork. However, in order to communicate the current state in a better way, I've updated the existing screenshots and even added a couple of more. I'm also working to upload a short gif that demonstrate the current state of Paperwork v2. :)

@moblesmarti
Copy link
Author

Hello again, I made a clean installation and I made the modifications indicated in the file /etc/hosts, but when I put the url 192.168.1.xxx I get the following error "404 page not found"

Some help.

Thanks in advance.

@moblesmarti
Copy link
Author

Hi, I'm still trying things, but I can not start the paperwork website.

http://url:8080 show me this... I think all is correct, but I cannot start web

Traefik

@mrusme
Copy link
Member

mrusme commented May 28, 2019

@moblesmarti what does docker service ls say? Have you checked docker service logs paperwork_web and maybe docker service logs paperwork_gatekeeper?
The Traefik config looks fine.

@moblesmarti
Copy link
Author

docker service ls
Termius_-___114__paperwork

docker service logs paperwork_service_gatekeeper
2

docker service logs paperwork_web
nothing

@mrusme
Copy link
Member

mrusme commented May 28, 2019

That's weird. Are you sure you're accessing the correct URL/IP?

@moblesmarti
Copy link
Author

This is my /etc/hosts file

3

http://192.168.1.114:8080 goes to Traefik, but http://192.168.1.114 doesn't go to web, I don't undersand it too

@sandzhaj
Copy link

sandzhaj commented May 28, 2019

I have got the same result. Traefik works, paperwork - doesn't.

That's weird.

You can also check it with every virtual machine, on fresh install, Ubuntu 18.04, behavior will be the same

@sandzhaj
Copy link

The DNS needs to point to the Docker Swarm. If you don't run Docker Swarm locally, pointing the DNS to 127.0.0.1 makes no sense.

I ran swarm on the same machine where I tried paperwork to start

@mrusme
Copy link
Member

mrusme commented Jun 3, 2019

This is my /etc/hosts file

3

http://192.168.1.114:8080 goes to Traefik, but http://192.168.1.114 doesn't go to web, I don't undersand it too

@moblesmarti first of all, you're not supposed to have duplicated entries in there. Either configure *.paperwork.local for 127.0.0.1 (if you run it on your localhost) or on 192.168.... (if you run it on that specific host).

Second (cc @sandzhaj), please make sure that:

  • the user that you're starting your docker container with has the permission to allocate port 80
  • the docker host process has the permission to allocate port 80
  • you don't have an nginx/apache/whatever-httpd running on port 80 that occupies port 80

After having Paperwork started, you can check netstat -tnlp (under Linux) to see what services are running on which tcp ports.

@moblesmarti
Copy link
Author

moblesmarti commented Jun 3, 2019

Hi @mrusme I have tried it in different ways and I always get the error 404 page not found
Now just point to the 192.168.1.114 url and I have error 404.

@mrusme
Copy link
Member

mrusme commented Jun 3, 2019

@moblesmarti I understand that. However, I'm trying to figure out where the issue might be. For that I need a little bit more information from your side, otherwise I really can't help you there.

So, have you made sure that there is no other process on that machine running on port 80? Also, have you adjusted your /etc/hosts to only include paperwork.local, api.paperwork.local and www.paperwork.local for one IP address?

Could you run these two commands and show me the output of them?

$ curl -v api.paperwork.local
$ curl -v www.paperwork.local

@mrusme
Copy link
Member

mrusme commented Jun 3, 2019

@moblesmarti you could also try this request, which would register a new user account on your Paperwork instance:

curl -vX "POST" "http://api.paperwork.local/registration" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "email": "test@example.com",
  "name": {
    "first_name": "John",
    "last_name": "Doe"
  },
  "password": "hunter2!hunter2"
}'

@moblesmarti
Copy link
Author

@mrusme Here you have the answers to what you have requested, thanks in advance.

$ curl -v api.paperwork.local
paperwork 1

$ curl -v www.paperwork.local
paperwork 2

$ ufw status
paperwork 3

$ cat /etc/hosts
paperwork 4

@moblesmarti
Copy link
Author

moblesmarti commented Jun 3, 2019

paperwork 5

@mrusme
Copy link
Member

mrusme commented Jun 3, 2019

@moblesmarti thanks for providing that information. As you can see yourself on the $ curl -v www.paperwork.local output, you're retrieving a valid HTML response (status code 200 OK) with the actual Angular web UI as content. I do not understand why your browser would tell you 404 page not found. Could you please try a different browser? It really doesn't make sense from the information I see here, because everything seems to be running just fine, from an infrastructure perspective.

@mrusme
Copy link
Member

mrusme commented Jun 3, 2019

@moblesmarti is it possible that your web browser would try to automatically redirect you towards 443 (HTTPS)? Because HTTPS is not working at the very moment, since this setup does not auto-generate SSL certificates.

@moblesmarti
Copy link
Author

@mrusme Hi! I've tried a new one on another server, and the same.

http://api.paperwork.local (Chrome, Firefox and Safari) all error 404
http://www.paperwork.local (Chrome, Firefox and Safari) all error 404
http://192.168.1.60 (Chrome, Firefox and Safari) all error 404

Menubar_y_Mozilla_Firefox_y_Docker

@mrusme
Copy link
Member

mrusme commented Jun 4, 2019

@moblesmarti could you open the web inspector / console in either of these browsers and maybe check if it shows any useful info?

Also: When was the last time you docker pulled the images?

@moblesmarti
Copy link
Author

moblesmarti commented Jun 5, 2019

@mrusme Sorry to be heavy on the topic.

This is what I get in different browsers
Chrome_error

And this is what I have in the docker
Docker ps

I have turned off and rebooted the image, but I still can not get it.

I deleted the image and reinstalled it with this script

#!/bin/bash
echo -e "\n==== Add Docker’s GPG key ===="
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

echo -e "\n==== Verify the fingerprint of the GPG key ===="
sudo apt-key fingerprint 0EBFCD88

echo -e "\n==== Add the stable Docker repository ===="
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

echo -e "\n==== Update your package index and install Docker CE ===="
sudo apt update
sudo apt install docker-ce -y

echo -e "\n==== Download the latest version of Docker Compose ===="
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

echo -e "\n==== Install software necessary ===="
sudo apt install make -y
sudo apt install make-guile -y

echo -e "\n==== Download Paperwork from github ===="
git clone --recursive https://github.com/paperwork/paperwork.git /opt/paperwork

echo -e "\n==== Install software ===="
cd /opt/paperwork
make deploy

but the same error always comes out.

@moblesmarti
Copy link
Author

I've researched in the logs docker and I've seen this:

paperwork/service-gatekeeper:latest
Running server on V4(0.0.0.0:8080)
Not found: Request { method: GET, uri: /, version: HTTP/1.1, headers: {"host": "api.paperwork.local", "user-agent": "curl/7.58.0", "accept": "/", "x-forwarded-for": "10.255.0.2", "x-forwarded-host": "api.paperwork.local", "x-forwarded-port": "80", "x-forwarded-proto": "http", "x-forwarded-server": "76f57f2363d6", "x-real-ip": "10.255.0.2", "accept-encoding": "gzip"}, body: Body }

paperwork/service-notes:latest
09:12:36.382 [info] Starting Elixir.Paperwork.Notes with Elixir.Plug.Cowboy under supervisor tree on http://0.0.0.0:8080

09:12:36.387 [error] Mongo.Protocol (#PID<0.1631.0>) failed to connect: ** (Mongo.Error) tcp connect: connection refused - :econnrefused
warning: deprecated time unit: :milliseconds. A time unit should be :second, :millisecond, :microsecond, :nanosecond, or a positive integer
(mongodb) lib/mongo/monitor.ex:110: Mongo.Monitor.call_is_master/2
(mongodb) lib/mongo/monitor.ex:122: Mongo.Monitor.is_master/3
(mongodb) lib/mongo/monitor.ex:93: Mongo.Monitor.check/1
(stdlib) gen_server.erl:637: :gen_server.try_dispatch/4

warning: deprecated time unit: :milliseconds. A time unit should be :second, :millisecond, :microsecond, :nanosecond, or a positive integer
(elixir) lib/calendar/iso.ex:703: Calendar.ISO.from_unix/2
(elixir) lib/calendar/datetime.ex:118: DateTime.from_unix/3
(elixir) lib/calendar/datetime.ex:166: DateTime.from_unix!/3
(mongodb) lib/bson/decoder.ex:72: BSON.Decoder.type/2

warning: deprecated time unit: :milliseconds. A time unit should be :second, :millisecond, :microsecond, :nanosecond, or a positive integer
(elixir) lib/calendar/iso.ex:717: Calendar.ISO.precision_for_unit/1
(elixir) lib/calendar/iso.ex:708: Calendar.ISO.from_unix/2
(elixir) lib/calendar/datetime.ex:118: DateTime.from_unix/3
(elixir) lib/calendar/datetime.ex:166: DateTime.from_unix!/3

@mrusme
Copy link
Member

mrusme commented Jun 6, 2019

[error] Mongo.Protocol (#PID<0.1631.0>) failed to connect: ** (Mongo.Error) tcp connect: connection refused - :econnrefused

This should not be the case, hm. Maybe there's some issue with networking on your machine? You could check docker network ls and see whether there was an encrypted overlay named papernet created. Also, you could try to docker exec -it <id> /bin/sh into any of the containers and check, if you can ping the other containers through their DNS namens (those should be the names that are specified in the Docker stack .yml, e.g. service_users).

However, I wanted to take on this task soon, so maybe just wait until there is a demo up and running - maybe during the setup I'll experience similar issues to yours and will find out what's wrong. As of right now I'm only running the Docker stack on Docker Desktop for Mac. There it works without any issues.

@mrusme
Copy link
Member

mrusme commented Jun 18, 2019

The Paperwork demo is now running at http://www.demo.paperwork.cloud, using the latest paperwork.yml from this repository. It's running on a pure Docker host, no magic configured whatsoever.

That's basically the proof that deployment works, locally on my Mac but also on a Linux server - exactly the way you appear to want to deploy it.

Please update all images and try deploying on a fresh VM that is only running Docker and doesn't block anything through its firewall. Deployment should work out of the box.

@mrusme mrusme closed this as completed Jun 18, 2019
@moblesmarti
Copy link
Author

I'm sorry, but it's still the same. I have created a new VM on my Proxmox server, clean, just Docker.
I have tried all the instructions that mention, and it seems that everything works correctly, so entering the VM IP indicates error 404, but the IP: 8080 works correctly.
Don't worry, I'll try the demo and when the software is finished, and I will return to fight me with this.

@mrusme
Copy link
Member

mrusme commented Jun 19, 2019

@moblesmarti I'm sorry to be unable to help you further on this topic. I see that you have some other components (Proxmox -> KVM?) in between, which might play into this topic. However, if you have the chance maybe give it a go on your local machine, using Docker Desktop.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants