Community discussions

MikroTik App
 
qwertykolea
just joined
Topic Author
Posts: 5
Joined: Wed Aug 30, 2023 2:43 pm
Location: MDA

Installing ubuntu container on RB5009 [run unifi-cam-proxy on it]

Wed Aug 30, 2023 2:49 pm

Hello,
I need to install an Ubuntu container on RB5009, but I have an issue. Everything downloads and saves, but when I try to start it, it starts and then stops after 2-3 seconds without any information in the logs.
You do not have the required permissions to view the files attached to this post.
Last edited by qwertykolea on Wed Sep 13, 2023 11:57 am, edited 1 time in total.
 
Rox169
Member
Member
Posts: 443
Joined: Sat Sep 04, 2021 1:47 am

Re: Installing ubuntu container on RB5009

Wed Aug 30, 2023 3:05 pm

Why do you need Ubuntu container on RB5009????
 
qwertykolea
just joined
Topic Author
Posts: 5
Joined: Wed Aug 30, 2023 2:43 pm
Location: MDA

Re: Installing ubuntu container on RB5009

Wed Aug 30, 2023 3:08 pm

Why do you need Ubuntu container on RB5009????
Generally, I need to run this.: this unifi-cam-proxy. com
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26419
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: Installing ubuntu container on RB5009

Wed Aug 30, 2023 4:57 pm

Containers are not virtual machines. You don't need to run the whole OS there. You only run specific apps with containers.
In your case they have a docker image: https://unifi-cam-proxy.com/#docker
no need for any ubuntu
 
qwertykolea
just joined
Topic Author
Posts: 5
Joined: Wed Aug 30, 2023 2:43 pm
Location: MDA

Re: Installing ubuntu container on RB5009

Wed Aug 30, 2023 5:14 pm

Containers are not virtual machines. You don't need to run the whole OS there. You only run specific apps with containers.
In your case they have a docker image: https://unifi-cam-proxy.com/#docker
no need for any ubuntu
Yes, I saw it and tried it, but I don't know how to add the .pem file to the container because it stops after running.)
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3605
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Installing ubuntu container on RB5009

Wed Aug 30, 2023 5:28 pm

Containers are not virtual machines. You don't need to run the whole OS there. You only run specific apps with containers.
In your case they have a docker image: https://unifi-cam-proxy.com/#docker
no need for any ubuntu
Yes, I saw it and tried it, but I don't know how to add the .pem file to the container because it stops after running.)
That might be a problem, normally you can use a mount to get that on Mikrotik container. But based on quick look at compose YAML/Dockerfile, it uses a file mapping (not a path) and the .PEM lives in the root so you can't just mount that.

Possible to workaround the lack of file-level mapping in /container. But you'd have to modify the container's code's entrypoint.sh to use a different path the /root, and re-build it locally based on https://github.com/keshavdv/unifi-cam-proxy/tree/main (specifically https://github.com/keshavdv/unifi-cam-p ... rypoint.sh).
 
qwertykolea
just joined
Topic Author
Posts: 5
Joined: Wed Aug 30, 2023 2:43 pm
Location: MDA

Re: Installing ubuntu container on RB5009

Wed Sep 13, 2023 11:55 am

So, I figured out how to run one camera through unifi-cam-proxy. I just put this command on CMD: unifi-cam-proxy --host {NVR IP} --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam'
After the first run, I connected to Mikrotik via SSH and put clien.pem on the app folder. However, I have several cameras. The official instructions suggest using docker-compose with the following code:

version: "3.5"
services:
proxy-1:
restart: unless-stopped
image: keshavdv/unifi-cam-proxy
volumes:
- "./client.pem:/client.pem"
command: unifi-cam-proxy --host {NVR IP} --mac 'AA:BB:CC:00:11:22' --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam'
proxy-2:
restart: unless-stopped
image: keshavdv/unifi-cam-proxy
volumes:
- "./client.pem:/client.pem"
command: unifi-cam-proxy --host {NVR IP} --mac 'AA:BB:CC:33:44:55' --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam'

My question is how to add several proxies (proxy-1, proxy-2, etc.) on the CMD field without running several dockers on Mikrotik.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3605
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Installing ubuntu container on RB5009 [run unifi-cam-proxy on it]

Thu Sep 14, 2023 5:17 pm

I think the idea is you ran one container per proxy, so you can bring up another instance of the unifi-cam-proxy for a 2nd, 3rd, etc. NVR

See https://unifi-cam-proxy.com/#multiple-cameras

FWIW, when you see the Docker Compose for something, if it has multiple children, it's multiple containers, so in their example this is actually TWO container "proxy-1" and "proxy-2":
version: "3.5"
services:
  proxy-1:
    restart: unless-stopped
    image: keshavdv/unifi-cam-proxy
    volumes:
      - "./client.pem:/client.pem"
    command: unifi-cam-proxy --host {NVR IP} --mac 'AA:BB:CC:00:11:22' --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam'
  proxy-2:
    restart: unless-stopped
    image: keshavdv/unifi-cam-proxy
    volumes:
      - "./client.pem:/client.pem"
    command: unifi-cam-proxy --host {NVR IP} --mac 'AA:BB:CC:33:44:55' --cert /client.pem --token {Adoption token} rtsp -s rtsp://192.168.201.15:8554/cam'
 
qwertykolea
just joined
Topic Author
Posts: 5
Joined: Wed Aug 30, 2023 2:43 pm
Location: MDA

Re: Installing ubuntu container on RB5009 [run unifi-cam-proxy on it]

Mon Sep 18, 2023 1:57 pm

So, I have started in two containers and it consumes too many resources: CPU and RAM.
Is there a way to run multiple cameras on a single container?
You do not have the required permissions to view the files attached to this post.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3605
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: Installing ubuntu container on RB5009 [run unifi-cam-proxy on it]

Mon Sep 18, 2023 4:17 pm

Is there a way to run multiple cameras on a single container?
Containers kinda designed to run one "EXE", so unifi-cam-proxy follows that model. So you can download source, modifying it, and re-build the container locally using Docker Build. There are techniques like using http://supervisord.org in Dockertfile/enterpoint.sh to have it launch multiple processes...

But I'm thinking it'a the video transcoding that's using the CPU/memory, than the containers themselves. The FFMPEG library it uses is resource intensive. So I'm not sure it's going to be dramatically different CPU with two-proxys-in-one container. Memory likely be lower if combined since it doesn't have the container 2nd image in RAM.

Who is online

Users browsing this forum: No registered users and 1 guest