simonwep / ocular-docker

Ready-to-use docker compose setup for ocular ✨
https://github.com/simonwep/ocular
8 stars 1 forks source link

ocular-docker-main-backend unhealty #1

Closed smignon612 closed 1 month ago

smignon612 commented 3 months ago

this container starts up but it is unhealty. i can see this fault :

Connecting to localhost:8080 ([::1]:8080) wget: can't connect to remote host: Connection refused --

data is not saved, i can put the admin password in but nothing happens to. (in oculus)

simonwep commented 3 months ago

Did you follow the step-by-step instructions in the readme? https://github.com/simonwep/ocular-docker?tab=readme-ov-file#setup It should work out of the box. I usually test it after each release, just checked, and it does work.

smignon612 commented 3 months ago

well i did a wget of the repo, unzipped the file and followed the steps, is wget the way to go?

simonwep commented 3 months ago

Yeah sure, that should work. What is your environment? What is the output if you run docker compose up? The app should be accessible on localhost:3030 after startup. I need a little more info to be able to help you, sorry for not having issue templates yet haha

smignon612 commented 3 months ago

i run it on a lxc container (debian 12 bookworm,), tried also on alpina. root@ocular:~/ocular-docker-1.1.0# docker compose up -d WARN[0000] /root/ocular-docker-1.1.0/docker-compose.yml: version is obsolete [+] Running 17/17 ✔ nginx Pulled 24.1s ✔ 3c854c8cbf46 Pull complete 7.4s ✔ de5d475193dd Pull complete 9.6s ✔ b407bcc80638 Pull complete 9.8s ✔ da33b1ad0ac4 Pull complete 9.9s ✔ a0fbd691d7c1 Pull complete 10.1s ✔ 16eaaaf5f1c0 Pull complete 10.2s ✔ 5e845cc16269 Pull complete 11.8s ✔ backend Pulled 22.0s ✔ 96526aa774ef Pull complete 7.0s ✔ d351360294b2 Pull complete 7.2s ✔ 99ba685f8f11 Pull complete 15.1s ✔ frontend Pulled 13.8s ✔ d6e6e2f0bb21 Pull complete 6.0s ✔ 90b0f82a5404 Pull complete 6.3s ✔ d76632970659 Pull complete 6.8s ✔ 00dd356aa92e Pull complete 6.9s [+] Running 4/4 ✔ Network ocular-docker-110_ocular Created 0.1s ✔ Container ocular-docker-110-frontend-1 Started 1.1s ✔ Container ocular-docker-110-backend-1 Started 1.2s ✔ Container ocular-docker-110-nginx-1 Started 1.3s

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES c260a245beec nginx:1.24-alpine "/docker-entrypoint.…" 3 minutes ago Up 3 minutes 0.0.0.0:3030->80/tcp ocular-docker-110-nginx-1 4991b82db595 ghcr.io/simonwep/ocular:v1.4.0 "busybox httpd -v -f" 3 minutes ago Up 3 minutes (healthy) 80/tcp ocular-docker-110-frontend-1 30d84d4175c1 ghcr.io/simonwep/genesis:v0.2 "./genesis" 3 minutes ago Up 3 minutes (unhealthy) 8080/tcp ocular-docker-110-backend-1

i can access the webpage via the adress of the server and port, i can give the admin login and pasw, but there it stops :( i noticed the backend container had the same ip as portrainer, so relaunched a lxc container without portrainer but some error

simonwep commented 3 months ago

i can access the webpage via the adress of the server and port, i can give the admin login and pasw, but there it stops :(

What exactly stops? The containers crash? Can you log in? Or is just the container unhealthy? I never worked with LXC containers... so I can't give you any help with that.

i noticed the backend container had the same ip as portrainer, so relaunched a lxc container without portrainer but some error

What error? You can modify the ports in docker-compose.yml and the nginx config as you wish, but normally you won't have to change anything.

simonwep commented 3 months ago

I just noticed that the bridged network is redundant, can you try it with the following docker-compose.yml? Maybe this causes some issues...

services:
  backend:
    image: ghcr.io/simonwep/genesis:v0.2
    restart: unless-stopped
    volumes:
      - ./data:/app/.data
    environment:
      - GENESIS_PORT
      - GENESIS_DB_PATH
      - GENESIS_CREATE_USERS
      - GENESIS_AUTHORIZED_URIS
      - GENESIS_JWT_SECRET
      - GENESIS_JWT_TOKEN_EXPIRATION
      - GENESIS_USERNAME_PATTERN
      - GENESIS_KEY_PATTERN
      - GENESIS_DATA_MAX_SIZE
      - GENESIS_KEYS_PER_USER
      - GENESIS_GIN_MODE
      - GENESIS_LOG_MODE

  frontend:
    image: ghcr.io/simonwep/ocular:v1.4.0
    restart: unless-stopped

  nginx:
    image: nginx:1.24-alpine
    restart: unless-stopped
    ports:
      - "3030:80"
    volumes:
      - ./config/nginx.conf:/etc/nginx/nginx.conf
    depends_on:
      - backend
      - frontend
smignon612 commented 3 months ago

the containers keep on running, the website is loading and showing up but no data is saved. the app accepts the admin login but thats it LXC Container is just like a debian server but virtualized

still got the same error but i will make a new container and redo it (the advantage of LXC :) ) gimme 15min

smignon612 commented 3 months ago

still the same : Connecting to localhost:8080 ([::1]:8080) wget: can't connect to remote host: Connection refused

can it be that your genisis is running on port 80 but the backend try's to connect to 8080?

simonwep commented 3 months ago

Ah you're right, the wget command is hardcoded. I'll fix that, my bad - thank you for reporting that. But what I still don't get, besides that, everything works right? Or how important are these healthchecks for LXC?

smignon612 commented 3 months ago

LXC is like docker but LXC is a complete OS system. So basicly i'm running docker container in a container :) (i run proxmox becaus i have some firewall's, servers,.. virtualized. The healt checks are not importend to the LXC, this runs fine. when i "installed" your app in docker, i noticed when i used your app that nothing was saved, i could not enter the admin page to. on the app itself you dint see any errors, it was only when i checked the containers out on Potrainer that i noticed that the backend container was unhealty and i saw the error blabla: Connection refused. let me now when its fixed, then i will retry. Have to start dinner now :)

simonwep commented 3 months ago

Aah, gotchya. I must say I never heard of it - will definitely have a look at it at some point :) Check out v1.1.1, the health-check issue should be fixed there ^^

smignon612 commented 3 months ago

its fun to work with (and easy) the container is healty now but sadly i must tell you that the data in your app is still not saved, its gone after a refresh. admin either

thedmmatt commented 3 months ago

Indeed, getting the same error here -- have even tried hard locking the data folder so it can't be deleted, but no luck

simonwep commented 3 months ago

the container is healty now but sadly i must tell you that the data in your app is still not saved, its gone after a refresh. admin either

But you're logged in? And the small cloud in the bottom left corner of the app is green? Is there a chance it has something to do with LXC? Have you tried it with docker alone? What is your docker version? Are there any errors in the network tab of your browser?

Indeed, getting the same error here -- have even tried hard locking the data folder so it can't be deleted, but no luck

Does the data folder get deleted? And what "error" are you getting?

Can you both tell me the steps to reproduce this? Because I really can't get it to not work - I have an instance of it running now for over 2 years, recently newly set up with the exact steps listed in the readme. With zero problems... 😕 I even started it yesterday on both the newest mac and windows versions (the instance on https://ocular.reinisch.io/ is running on EC2 Ubuntu) without any problems. All using docker v4.29.0.

smignon612 commented 3 months ago

well i think he is not loggin in. The logo is also red. LXC should not be a problem, this is just a debian 12 bookworm. i do get some errors: :3030/api/login:1

   Failed to load resource: the server responded with a status of 400 (Bad Request)

Docker version 26.1.1, build 4cf5afa

simonwep commented 3 months ago

well i think he is not loggin in. The logo is also red.

Okay, in this case of course nothing is saved.

:3030/api/login:1

That is odd, so the server is reachable but the payload is invalid? Can you give me more details of what the payload is and the response to the request? Can you give me a step-by-step guide on how to reproduce this? For example, you download the latest version, unzip it, run this and that command, open chrome/safari/whatever, type in what login credentials, see that in the UI, that in the network tab...

I'm really confused because I tested it on linux, mac, windows, just by checking out the repo, following all the steps in the readme and it works. So it must be something to do with your environment which I still don't have enough info about...

smignon612 commented 3 months ago

wget off: https://github.com/simonwep/ocular/archive/refs/tags/v1.4.0.zip unzip the file cd into the file cp .env.example .env ./gen-passwords.sh docker compose up -d

this error pops up a lot to: Error in event handler: TypeError: Cannot read properties of undefined (reading 'textElement') at amazonResults (chrome-extension://nfdcnacbhjonmghbbnadkjcejbdlnaep/js/content.js:301:27) at onMessage (chrome-extension://nfdcnacbhjonmghbbnadkjcejbdlnaep/js/content.js:258:4)

simonwep commented 3 months ago

wget off: https://github.com/simonwep/ocular/archive/refs/tags/v1.4.0.zip

You mean https://github.com/simonwep/ocular-docker/releases/tag/v1.1.1? The link you provided is just the frontend...

Error in event handler: TypeError: Cannot read properties of undefined (reading 'textElement') at amazonResults (chrome-extension://nfdcnacbhjonmghbbnadkjcejbdlnaep/js/content.js:301:27) at onMessage (chrome-extension://nfdcnacbhjonmghbbnadkjcejbdlnaep/js/content.js:258:4)

this is not from me. What browser and extensions are you using? There seems to be an extension interfering that you're using?

smignon612 commented 3 months ago

yes sorry 1.1.1 tested is on brave, chrome, firefox and edge

simonwep commented 3 months ago

Alright, look, I still don't have enough information to help you with, the only thing that's afaik different from your and my setup is LXC. It'd be awesome if you find out what exactly is causing issues on your end, if it has something to do with LXC I'd be glad to put that in my README, for anything else I'd try to fix it on my end. Or give me enough information besides that you use chrome, followed the steps and use debian 12 to fully reproduce it. Because as of right now, I just cant.

But there is just very little I can do because the setup is extremely simple and there is nothing more than a little routing and a very, very small docker compose file.

simonwep commented 3 months ago

I'd be great if you could just start it on a different machine of yours, let it be windows, mac, ubuntu and with "normal" docker. Just to see if it is caused by something in your debian setup.

smignon612 commented 3 months ago

i will start up an ubuntu to

smignon612 commented 3 months ago

running on ubuntu now: Failed to load resource: the server responded with a status of 400 (Bad Request) 10.20.0.60/:1 Denying load of chrome-extension://nfdcnacbhjonmghbbnadkjcejbdlnaep/js/vendor/moment.min.js. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.

Failed to load resource: the server responded with a status of 403 (Forbidden) :3030/api/data/data:1

   Failed to load resource: the server responded with a status of 401 (Unauthorized)

:3030/api/data/settings:1

   Failed to load resource: the server responded with a status of 401 (Unauthorized)

Frame-3UdU8eLP.js:7 Uncaught (in promise) Response :3030/api/logout:1

   Failed to load resource: the server responded with a status of 401 (Unauthorized)
simonwep commented 3 months ago

10.20.0.60/:1 Denying load of chrome-extension://nfdcnacbhjonmghbbnadkjcejbdlnaep/js/vendor/moment.min.js. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.

That's not from me, must be an extension you're using. Try a clean chrome profile. The rest is because you're not logged in, use the credentials from your .env to log in.

thedmmatt commented 3 months ago

Hi Simon, thanks for taking the time and I'm sorry for not providing more details earlier. I have solved the issue now, and TL;DR was all my fault. 😅

Before diving into that, however, I looked at Smignon's comments and their case is way different from mine, including the error messages they are getting. To that, I also agree that they might have a browser extension or some parallel work fuzing with the backend data (more on that below).

That said, in my case I'm running Ocular and dependencies on a Docker set upon WSL2, which had been working flawlessly for a couple of weeks until updating to release 1.1.1. Further investigation this morning revealed two things, which I believe neither match Smingon's case but might be of some help (to him or others in the future).

First, my NAS and Google Drive backup routines were clashing with each other, since my Google Drive routine sits behind a security gateway and VPN, leading it to act after my NAS which runs locally (LAN-wise). A bit confusing to explain my specific needs to justify why I have this -- however the issue was that I had set up a particular cron job in the wrong way after updating to the new release. There I allowed GD to overwrite what the local data folder had stored, which led my NAS to come and try to fix that since its data was more recent. With that, they were constantly in a loop that was making the backend container crash and re-pull all the 1.1.1 release due to my Portainer rules.

Although that was solved rather quickly and I could retrieve the backup data, I faced another issue where Docker would state that the container image and its temporary volumes already existed, leading WSL2 to crash trying to recreate it. As usual, the following did the trick, and now everything is working flawlessly again.

docker compose rm --all
docker compose pull
docker compose build --no-cache
docker compose up -d --force-recreate
simonwep commented 3 months ago

@thedmmatt wow, I'm impressed by what all happened haha - glad it's working now :) I hoped I could start a FAQ with some of your issues/resolutions, but you're case seems a tad too complex I believe 😅

smignon612 commented 3 months ago

well after some research i noticed that my docker containers cant communicate with each other :/

thedmmatt commented 3 months ago

well after some research i noticed that my docker containers cant communicate with each other :/

Care to elaborate? You should be able to bind containers using docker.sock daemon even between containers from different stacks. What kind of communication are you trying, and how is this affecting your Ocular deployment?

simonwep commented 1 month ago

Closing this due to inactivity, please re-open a new issue if some of you still having troubles with this - after all we managed to cover a few cases where setting it up according to instructions didn't work, I thank you for that 😄