How to setup an Docker Unraid Template from docker-compose


corgan

Recommended Posts

Hello

 

I'm using an app compreface on my unraid server. I'm running this atm via docker-compose, which runs fine.

https://github.com/exadel-inc/CompreFace

Github: https://github.com/exadel-inc/CompreFace#getting-started-with-compreface

DockerHub: https://hub.docker.com/u/exadel

 

docker-compose.yaml:

version: '3.4'

volumes:
  postgres-data:

services:
  compreface-postgres-db:
    image: postgres:11.5
    container_name: "compreface-postgres-db"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=frs
    volumes:
      - postgres-data:/var/lib/postgresql/data

  compreface-admin:
    image: exadel/compreface-admin:0.6.0
    container_name: "compreface-admin"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_URL=jdbc:postgresql://compreface-postgres-db:5432/frs
      - SPRING_PROFILES_ACTIVE=dev
      - ENABLE_EMAIL_SERVER=false
      - EMAIL_HOST=smtp.gmail.com
      - EMAIL_USERNAME=
      - EMAIL_FROM=
      - EMAIL_PASSWORD=
      - ADMIN_JAVA_OPTS=Xmx8g
    depends_on:
      - compreface-postgres-db
      - compreface-api

  compreface-api:
    image: exadel/compreface-api:0.6.0
    container_name: "compreface-api"
    depends_on:
      - compreface-postgres-db
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_URL=jdbc:postgresql://compreface-postgres-db:5432/frs
      - SPRING_PROFILES_ACTIVE=dev
      - API_JAVA_OPTS=Xmx8g
      - SAVE_IMAGES_TO_DB=true

  compreface-fe:
    image: exadel/compreface-fe:0.6.0
    container_name: "compreface-ui"
    ports:
      - "8000:80"
    depends_on:
      - compreface-api
      - compreface-admin

  compreface-core:
    image: exadel/compreface-core:0.6.0
    container_name: "compreface-core"
    environment:
      - ML_PORT=3000

 

But the app creates 5 different containers and has no icons.

 

Is there a way to transform these into an Unraid Docker Template?

Link to comment
9 hours ago, corgan said:

Hello

 

I'm using an app compreface on my unraid server. I'm running this atm via docker-compose, which runs fine.

https://github.com/exadel-inc/CompreFace

Github: https://github.com/exadel-inc/CompreFace#getting-started-with-compreface

DockerHub: https://hub.docker.com/u/exadel

 

docker-compose.yaml:

version: '3.4'

volumes:
  postgres-data:

services:
  compreface-postgres-db:
    image: postgres:11.5
    container_name: "compreface-postgres-db"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=frs
    volumes:
      - postgres-data:/var/lib/postgresql/data

  compreface-admin:
    image: exadel/compreface-admin:0.6.0
    container_name: "compreface-admin"
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_URL=jdbc:postgresql://compreface-postgres-db:5432/frs
      - SPRING_PROFILES_ACTIVE=dev
      - ENABLE_EMAIL_SERVER=false
      - EMAIL_HOST=smtp.gmail.com
      - EMAIL_USERNAME=
      - EMAIL_FROM=
      - EMAIL_PASSWORD=
      - ADMIN_JAVA_OPTS=Xmx8g
    depends_on:
      - compreface-postgres-db
      - compreface-api

  compreface-api:
    image: exadel/compreface-api:0.6.0
    container_name: "compreface-api"
    depends_on:
      - compreface-postgres-db
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_URL=jdbc:postgresql://compreface-postgres-db:5432/frs
      - SPRING_PROFILES_ACTIVE=dev
      - API_JAVA_OPTS=Xmx8g
      - SAVE_IMAGES_TO_DB=true

  compreface-fe:
    image: exadel/compreface-fe:0.6.0
    container_name: "compreface-ui"
    ports:
      - "8000:80"
    depends_on:
      - compreface-api
      - compreface-admin

  compreface-core:
    image: exadel/compreface-core:0.6.0
    container_name: "compreface-core"
    environment:
      - ML_PORT=3000

 

But the app creates 5 different containers and has no icons.

 

Is there a way to transform these into an Unraid Docker Template?

Can you please create a step-by-step guide for using the above on unRAID?

 

Thanks

Link to comment
On 10/9/2021 at 7:34 PM, Squid said:

You need to set up separate templates for each of the components (the "image" sections) and add in all of the applicable environment variables, paths etc

 

Ok, I understand. But how to deal with dependency?


 

compreface-admin:
  depends_on: - compreface-postgres-db
              - compreface-api

 

With the docker-compose solution, the container starts in random order after a reboot and I have to manually restart them in the correct order.

Link to comment
On 10/9/2021 at 9:15 PM, gshlomi said:

Can you please create a step-by-step guide for using the above on unRAID?

 

Thanks

 

Install docker-compose on your unraid. There are two ways to do that:

 

command line:

ca-app:

 

after that you can login via ssh and follow the instructions from

https://github.com/exadel-inc/CompreFace#getting-started-with-compreface

How to install:

Download CompreFace_0.6.0.zip archive or run:
wget -q -O tmp.zip 'https://github.com/exadel-inc/CompreFace/releases/download/v0.6.0/CompreFace_0.6.0.zip' && unzip tmp.zip && rm tmp.zip

To start CompreFace run:
docker-compose up -d

Open in your browser: http://localhost:8000/login

To stop properly run:
docker-compose stop

To start again run:
docker-compose start

 

  • Like 1
Link to comment
On 10/9/2021 at 6:01 PM, corgan said:

But the app creates 5 different containers and has no icons.

 

Is there a way to transform these into an Unraid Docker Template?

Take a look at docker folder plugin, this can group the icons under a "folder", which you can select an icon and even add context menu entries for custom commands such as docker compose i.e. compose up/down.

It's a little bit more work than setting up an unraid template, but it beats reinventing the wheel with complex compose deployments.

 

 

Link to comment

I already use docker-folder.

 

The icons are only "nice to have".

Much more important are the dependency. In the case of my example, the database container compreface-postgres-db needs longer to start as the other containers, which then failed.

I have to start them manually after a reboot or raid/docker service restart. Is there a solution for this?

 

Link to comment
1 hour ago, corgan said:

I have to start them manually after a reboot or raid/docker service restart. Is there a solution for this?

If you just need the database up before other services, you can use the native unraid docker start ordering and start delay for this.

 

image.thumb.png.e42f3fff5ff9229a11a34d58eb62b44a.png

 

In advanced mode on Docker page, use the arrow hooks on far right to change ordering, just to the left you can change the wait time of that container before starting.

 

So in the example above, my jira database starts before jira application.

Once Jira database starts, the jira application waits 15 seconds, then starts.

 

Edited by tjb_altf4
Link to comment

Thanks, I use unraid now for years, but didn't know that there is something like the wait/delay option. :)

Ok, this is a workaround.

 

I get this running, no problem.

But I still think installing 5 single containers, plus setting up the right order and delay, is not the best way for the normal user.

 

I have not locked into the CA App docs, but Isn't there a way to provide a single app for the community that could do all that at once?

 

  • Like 1
Link to comment
  • 3 weeks later...
On 11/1/2021 at 4:13 AM, DrSpaldo said:

Did you have any luck with this @corgan

 

I am trying docker compose, which appears to run, except I can never log into the web interace. When ever I 'sign up' or login, I just get the error "Sorry, something went wrong"

 

Actually I'm using the docker-compose solution as described here

 

Link to comment
20 hours ago, Iceman24 said:

I would love for this to be added to the Community Appos or at least some kind of template to make it much easier to install. I've shied away from trying this app out because of the complexity of setup.

 

Without Support for docker-compose from the unraid devs, I can't see an easy way to adopt docker-compose based multi-layer app.

It can't be the solution to add 5 different Apps to the CA which can't run on their own. All the posted solutions like the starting order/delay in this thread are just workarounds.

Re-creating or gluing Dockerfiles with copy & paste from the original app Dockerfiles are also not a good option.

 

Or maybe I don't get it and there is an easy solution I overlook.

 

 


 

Link to comment

I would think whatever dependencies were needed for the whole thing to work, that they could be integrated into one app. I have a lot of apps installed and the only time I ever needed to install more than one thing was if it needed to use a separate database like mariadb. I think it would just be a matter of somebody packaging all of that together oh, so hopefully that can be done, as this seems like the best overall option with facial recognition apps from my understanding so far.

Link to comment
3 minutes ago, Iceman24 said:

I would think whatever dependencies were needed for the whole thing to work, that they could be integrated into one app. I have a lot of apps installed and the only time I ever needed to install more than one thing was if it needed to use a separate database like mariadb. I think it would just be a matter of somebody packaging all of that together oh, so hopefully that can be done, as this seems like the best overall option with facial recognition apps from my understanding so far.

 

Look into the First Post in this thread. There are 5 different parts needed to run these app.


 

  compreface-postgres-db:

  compreface-admin:

  compreface-api:

  compreface-fe:

  compreface-core:

 

Besides the postgress-db, that's all parts of the same app. That's the way the developers designed the app structure.

https://github.com/exadel-inc/CompreFace#getting-started-with-compreface

 

The only way I would see ATM, is to write an own Dockerfile with the content of all of these single containers.

 

 

Link to comment
  • 2 weeks later...

@corgan Is it crazy to add each one to the app store? As a novice user, I followed the install and it worked, but I'm scared. I don't see any appdata folder and I don't know how to manipulate ports. I don't even know what I downloaded to where when I ran the "wget" command. I'm scared. 

 

I recently got Double-Take working with Frigate and the home-assistant.io forum thread strongly recommends CompreFace over Deepstack for facial detection.

Link to comment
41 minutes ago, Iceman24 said:

I reached out to the developer of CompreFace and I was told that they're working on getting it to work properly with unraid. They noticed the demand for it.

 

That's great news! I wrote an email to their support team about this some weeks ago, but never got feedback.

Did you write them on GitHub where I could track this topic?

 

Link to comment
1 hour ago, bigbangus said:

@corgan Is it crazy to add each one to the app store? As a novice user, I followed the install and it worked, but I'm scared. I don't see any appdata folder and I don't know how to manipulate ports. I don't even know what I downloaded to where when I ran the "wget" command. I'm scared. 

 

I recently got Double-Take working with Frigate and the home-assistant.io forum thread strongly recommends CompreFace over Deepstack for facial detection.

 

CompreFace definitely produced the best results. Yes, for port changes and data folder, we need a proper template.

Link to comment
28 minutes ago, corgan said:

 

That's great news! I wrote an email to their support team about this some weeks ago, but never got feedback.

Did you write them on GitHub where I could track this topic?

 

https://github.com/exadel-inc/CompreFace/issues/651

 

This was the link I was given that he said he would post in when he finished the work. I didn't reach out through GitHub though. I emailed them.

 

Link to comment

While we wait for a container and for @corgan to make a template presumably... do you guys know where the postgres-db is saved to in the default docker-compose?

 

volumes:
  postgres-data:

services:
  compreface-postgres-db:
    restart: always
    image: postgres:11.5
    restart: always
    container_name: "compreface-postgres-db"
    environment:
      - POSTGRES_USER=${postgres_username}
      - POSTGRES_PASSWORD=${postgres_password}
      - POSTGRES_DB=${postgres_db}
    volumes:
      - postgres-data:/var/lib/postgresql/data

 

I'd like to map /var/lib/postgresql/data to /mnt/user/appdata/postgres-db or something similar. Also how can you specify the network as bridge instead of "root_default"

Edited by bigbangus
Link to comment

Thanks for the GitHub link. I offered my help in the thread. Let's see. :)

 

@bigbangus The DB-Data are stored on an Docker Volume. I have no idea how docker-compose on the unraid console work together with the UI Settings for folder.

But you can make a backup of the database folder and use this data later if we get a working "one-container" solution.

 

Login via ssh:

 

- create folder like backup-compreface
 

mkdir backup-compreface
cd backup-compreface
nano docker-volumes-backup.sh

 

- create backup script

 

#!/bin/bash
# This script allows you to backup a single volume from a container
# Data in given volume is saved in the current directory in a tar archive.
CONTAINER_NAME=$1
VOLUME_NAME=$2

usage() {
  echo "Usage: $0 [container name] [volume name]"
  exit 1
}

if [ -z $CONTAINER_NAME ]
then
  echo "Error: missing container name parameter."
  usage
fi

if [ -z $VOLUME_NAME ]
then
  echo "Error: missing volume name parameter."
  usage
fi

sudo docker run --rm --volumes-from $CONTAINER_NAME -v $(pwd):/backup busybox tar cvf /backup/backup.tar $VOLUME_NAME__

 

- backup db

 

chmod +x docker-volumes-backup.sh
./docker-volumes-backup.sh compreface-postgres-db /var/lib/postgresql/data

 

grafik.thumb.png.93fea4f33a9885854a103206e172ac6b.png

 

  • Like 2
Link to comment

Before seeing your reply I modified the docker compose yml like below and it did the trick. Good to know your method which is probably more robust.

 

All I did was hash out the volumes: at the top then add "/mnt/user/appdata/<xxxx> in the volumes: in the postgres-db.

 

version: '3.4'

#volumes:
#  postgres-data:

services:
  compreface-postgres-db:
    image: postgres:11.5
    restart: always
    container_name: "compreface-postgres-db"
    environment:
      - POSTGRES_USER=${postgres_username}
      - POSTGRES_PASSWORD=${postgres_password}
      - POSTGRES_DB=${postgres_db}
    volumes:
      - /mnt/user/appdata/compreface/postgres:/var/lib/postgresql/data

 

  • Thanks 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.