owntracks / docker-recorder

Docker image for OwnTracks Recorder
151 stars 68 forks source link

[Help] How do I add Friends feature to Docker on Windows? #78

Closed GitHubQueenn closed 7 months ago

GitHubQueenn commented 7 months ago

Code I am using for my Docker server:

version: '3.5'
services:
  owntracks-recorder:
    restart: always
    image: owntracks/recorder
    volumes:
      - C:\Users\User\Desktop\OwnTracks:/store
    environment:
      OTR_PORT: 0
    ports:
      - 8083:8083
  owntracks-frontend:
    restart: always
    image: owntracks/frontend
    environment:
      SERVER_HOST: "owntracks-recorder"
      SERVER_PORT: "8083"
    ports:
      - 80:80

This alone gets me to have the http://localhost:8083/ page work and see my and a friend's phones connected. However, only I can see both phones (on my localhost page on PC) since I am hosting the server. I want us to be able to see each other's on the Friends tab. I am Android, they are iPhone. Is there an easy way to setup Friends on the recorder code above? I've tried adding:

          friends:
            - { tid: AA, username: me, password: 123,  devicename: phone1 }
            - { tid: BB, username: them, password: 123,  devicename: phone2 }

as laid out at https://owntracks.org/booklet/features/qs-config/#friends-list-syntax but when I run "docker-compose up" on the docker-compose YAML file that I added that to, I get an error saying that the "friends" property can't be used there or something. The only thing I have in my OwnTracks server folder is the docker-compose YAML file and then it creates the ghash, last, & rec folders when ran. When my friend connected to my server, it also made a config folder with their config in it. At the link above, it says, "Friends are basically configured like this in the 'configuration.yaml' file:" but I never had that file to begin with, just the previously-mentioned ones I just listed. Have tried researching and figuring this out for prolly 12 hours collectively now and can't figure it out. Am using HTTP mode.

Have tried the quicksetup tutorial on the site/GitHub but it's just too confusing. It mentions DNS but do I literally keep "owntracks.example.com" or no? I keep getting confused on this part. Am I supposed to have my own website or do I use "localhost" even if I am having someone remotely access it? So, the code above at least got me up-and-running and the furthest I've gotten with this. Please help.

jpmens commented 7 months ago

Transferring as off-topic for Quicksetup.

jpmens commented 7 months ago

Quicksetup is not Docker; sadly this is complicated, and the two things have little in common.

You are running a Recorder only (albeit in docker), and apparently in HTTP mode only (which is sad as MQTT is much more capable).

Be that as it may, the documentation for adding friends in HTTP mode is here.

GitHubQueenn commented 7 months ago

Quicksetup is not Docker; sadly this is complicated, and the two things have little in common.

You are running a Recorder only (albeit in docker), and apparently in HTTP mode only (which is sad as MQTT is much more capable).

Be that as it may, the documentation for adding friends in HTTP mode is here.

So, I open my WSL Linux Terminal in the OwnTracks folder directory and then just paste:

$ ocat -S JP --dump=friends
myfriend-iphone ["me/android", "myfriend/iphone"]

or how does this work? It is just my friend and myself using this. Currently, they connect to my server with my home public IP address & the default port. And then do I run any other commands or restart my Docker container after that or? Or do I also need to add myself to the above code, like:

$ ocat -S JP --dump=friends
myfriend-iphone ["me/android", "myfriend/iphone"]
me-android ["myfriend/iphone", "me/android"]

? My server folder looks like this currently: https://i.imgur.com/fKKdyPG.png so I'm not sure what database that documentation refers to by saying, "The Recorder has built-in support for this with the named "friends" lmdb database. Assuming the following content of the friends database"

jpmens commented 7 months ago

Be advised that we've no experience running this on Windows and/or WSL{1,2}, so I'm not going to be able to help you with either.

We've written many a word describing the individual bits and pieces of this project and its components, and while the documentation is likely far from perfect, please read our Booklet and try to understand what's going on. If you then really wish to continue as you've started, you will need to understand Recorder and its moving bits.

That said, our preferred method of installing all this is on a Linux VPS using our Quicksetup method.

For all of this you are going to need more than just a passing glance, and some of the topics involve having knowledge which we cannot give you.

We will help as time permits but expect you do the homework. :-)

GitHubQueenn commented 7 months ago

We will help as time permits but expect you do the homework. :-)

Have definitely been doing homework, haha. Have been stuck on this for over 12hrs total now. :( Have read the booklet a few times now, etc., etc. The Quicksetup was too complicated for me. I did all the steps except I was confused on the DNS part of the config file. Do I literally keep "owntracks.example.com" for the DNS or no? I keep getting confused on this part. Am I supposed to have my own website or do I use "localhost" even if I am having someone remotely access it?

jpmens commented 7 months ago

You do not use example.com (and also not localhost). You will need your own DNS domain.

GitHubQueenn commented 7 months ago

You do not use example.com (and also not localhost). You will need your own DNS domain.

How do I do that part, though? I do happen to own a website, but it is just a domain name that I use for a personal e-mail domain type of thing. That's really the main part I was stuck on with the Quicksetup stuff.

jpmens commented 7 months ago

Let's assume the email domain you own is called example.com, and that you receive mail at githubqueenn@example.com. You registered that domain with somebody, some company or email provider probably.

Ask them what you need to do to add a so-called A record (an address record) to your domain so that the name (this again is an example) myowntracks.example.com points to the IP address of your server. (I am assuming you have a static, i.e. unchaging, address.)

That new DNS record (myowntracks.example.com) would then become the name of your OwnTracks site.

GitHubQueenn commented 7 months ago

Let's assume the email domain you own is called example.com, and that you receive mail at githubqueenn@example.com. You registered that domain with somebody, some company or email provider probably.

Ask them what you need to do to add a so-called A record (an address record) to your domain so that the name (this again is an example) myowntracks.example.com points to the IP address of your server. (I am assuming you have a static, i.e. unchaging, address.)

That new DNS record (myowntracks.example.com) would then become the name of your OwnTracks site.

Yeah, I think I had to mess with A records and all that junk to setup my personal email domain to point to my email provider but it was ages ago. Since I am hosting the server locally, would I point it to my public IP address then if my domain registrar will be trying to connect to my server from the outside (like I am already doing with my friend on the app)?

EDIT: Here are how my settings on my domain are setup under "Host Records" section in my dashboard. What do I put for host (owntracks.mysite.com?) and do I put my public IP for IP address? https://i.imgur.com/N84382L.png (the "Automatic" box in that image is under the "TTL" column and lists 1 to 60mins as other options). Because for my e-mail stuff, some records are "CNAME" and use their own records and then some are "TXT" records and just use "@" as the host.

jpmens commented 7 months ago

Host and IP address are right. You can name your OwnTracks site however you like, it doesn't need to be called owntracks.

You then configure that name in configuration.yaml for Quicksetup (if that's actually the route you wish to take.)

GitHubQueenn commented 7 months ago

Host and IP address are right. You can name your OwnTracks site however you like, it doesn't need to be called owntracks.

You then configure that name in configuration.yaml for Quicksetup (if that's actually the route you wish to take.)

Ok, very cool. Made a few edits to my reply above, not sure if you saw all of those before responding. So, I only use my public IP and don't include a port number or anything in it on the DNS record?

jpmens commented 7 months ago

Correct. When done, you should be able to ping new-dns-domainname and see the IP address (even if the ping doesn't actually work).

GitHubQueenn commented 7 months ago

Correct. When done, you should be able to ping new-dns-domainname and see the IP address (even if the ping doesn't actually work).

Ok, just got back home. So, I setup my A record for my domain and I run into the original problem I had the first time when I used a wrong domain....

PLAY RECAP *************************************************************************************************************
localhost                  : ok=15   changed=4    unreachable=0    failed=1    skipped=5    rescued=0    ignored=0

I'm not sure why it's saying that. In my domain's DNS records, I have "owntracks.mydomain.me" set for host. For IP, I am using my home's public IP. The ports are properly forwarded. Help? When I ping the domain, I get: "Ping request could not find host owntracks.mydomain.me. Please check the name and try again." But not sure if this matters because I ping the regular base domain itself and get the same result too, which can't be right since I am using it everyday as my e-mail domain.

jpmens commented 7 months ago

DNS problem: NXDOMAIN means domainname not found.

Send us the unredacted name of your domain to support@owntracks.org mentioning the issue number in the subject and I'll check.

GitHubQueenn commented 7 months ago

DNS problem: NXDOMAIN means domainname not found.

Send us the unredacted name of your domain to support@owntracks.org mentioning the issue number in the subject and I'll check.

Just sent it.

jpmens commented 7 months ago

Problem identified: a domain name qualified with the domain name. I've responded by email; it became owntracks.example.com.example.com.

GitHubQueenn commented 7 months ago

Problem identified: a domain name qualified with the domain name. I've responded by email; it became owntracks.example.com.example.com.

Ok, so now I can connect to that domain name. Cool. Another issue popped up in Terminal when re-running the bootstrap.sh file.

On: TASK [system: template out sys.info], I am getting:

An exception occurred during task execution. The error was: PermissionError: [Errno 13] Permission denied: b'/mnt/c/Users/User/Desktop/OwnTracks/quicksetup/.ansible_tmpqqwfyzxysys.info' -> b'./sys.info'
fatal: [localhost]: FAILED! => {"changed": false, "checksum": "7a6525c34367y453e7f683ea66f9cb05", "msg": "Unable to make b'/root/.ansible/tmp/ansible-tmp-173463456225.5385394-215081-134365511629082/source' into to ./sys.info, failed final rename from b'/mnt/c/Users/User/Desktop/OwnTracks/quicksetup/.ansible_tmpqqwfyzxysys.info': [Errno 13] Permission denied: b'/mnt/c/Users/User/Desktop/OwnTracks/quicksetup/.ansible_tmpqqwfyzxysys.info' -> b'./sys.info'"}

I am running it as sudo, so not sure why there's a permissions issue (or so it seems?). After running "-vvv" after it, here are the full details of the issue...not sure how to fix:

https://i.imgur.com/bfF4BGI.png

jpmens commented 7 months ago

I am not able to read blue/red on black. Please make sure it's text and paste it here as such.

jpmens commented 7 months ago

Judging by what I read in this issue you seem to have progressed to get a working VPS using Quicksetup, so I will now close this issue.