Project One-Click: All-in-One Installations of Docker Extensions and CDVR Custom Channels

Thanks, that's what I thought.

It doesn't, and Docker Desktop for Mac doesn't either.

2 Likes

@bnhf deserves 99% of the credits.

I contacted him originally with the idea and was requesting his help with UI creation in OliveTin.
My plan was to write some of the backend code but I couldn't find enough time to work on it.
In the end, he programmed everything himself with very little help from me.

So kudos to him for doing all the work!
This looks great! :+1:

2 Likes

Another good example: Say you don't have an MLB.tv subscription, but you'd still like to be able to have the free game of the day available. With Project One-Click it's easy days:

Change a variable or two, and put it your MLB.tv credentials -- no subscription required:

And minute or two later, tomorrow's game is available to watch or record:

3 Likes

This is absolutely ridiculous! The ability to potentially have all of these items "just work" due to your hard work in wrangling the config items, etc, is insane. Well done! I'm going to give this a whirl right now!

One question in my head - how will this setup manage updates to the various "child" extensions? And, if it's agnostic to them, what would a best practice be for maintenance?

1 Like

If I'm understanding your question correctly, Watchtower is one of the extensions you can install with Project One-Click.

We're configuring Watchtower in "run once" mode, so whenever you want to check if there are updates to containers, tick the box next to Watchtower in Portainer and click start. Any running container will get updated.

Watchtower sits in "exited" mode in your Portainer-Containers list ready to run.

Thanks!

One oddity - not seeing an "account" item anywhere on my portainer installation (Docker on Mac). I probably borked the installation on docker, but wondering if this differs on Mac?

Edit - i think it's Docker Desktop - my screen looks similar to this old shot:

So this is using the Portainer Docker Desktop extension? I haven't used that before, but I should be able to install it on my laptop, in place of the WebUI version I normally use.

Hopefully token creation is just somewhere else in the UI.

I think it's lack of user: I'm going with this:

I was right. For some reason:

  1. the users menu isn't available on the extension, by default.
  2. The default password isn't what i see all over the place

I got a Users menu by doing this, and then navigating to the web UI on the https port:

# stop the existing Portainer container
docker container stop portainer

# run the helper using the same bind-mount/volume for the data volume
docker run --rm -v portainer_data:/data portainer/helper-reset-password
2020/06/04 00:13:58 Password succesfully updated for user: admin
2020/06/04 00:13:58 Use the following password to login: itwillgiveyouonehere

# restart portainer and use the password above to login
docker container start portainer

Have a token - now on to figuring out mounts...

1 Like

I'm wondering if the extension even has a WebUI. Are you able to access Portainer by URL from another system on your LAN?

2 Likes

That's great. Is the WebUI available on http:// as well? The current version of Project One-Click uses the http port, but it wouldn't be difficult to add https as well.

Looks like only https, at least at first blush

I'll work on https support. In the meantime, if you don't mind tweaking a script, portainerstack.sh should work with these two lines modded:

Current script:

#!/bin/bash

set -x

stackName="$1"
portainerHost="$PORTAINER_HOST"
portainerURL="http://$portainerHost:9000/api/stacks?type=2&method=string&endpointId=2"
portainerToken="$PORTAINER_TOKEN"
cp /config/$stackName.yaml /tmp
stackFile="/tmp/$stackName.yaml"
envFile="/tmp/$stackName.env"

dockerVolume=$(grep 'DVR_SHARE=' $envFile | grep -v '/' | awk -F'=' '{print $2}')
volumeExternal=$(grep 'VOL_EXTERNAL=' $envFile | grep -v '#' | awk -F'=' '{print $2}')
volumeName=$(grep 'VOL_NAME=' $envFile | grep -v '#' | awk -F'=' '{print $2}')

if [[ -n $dockerVolume ]]; then
  sed -i 's/#volumes:/volumes:/' $stackFile
  sed -i 's/#channels-dvr:/'$dockerVolume':/' $stackFile
  [[ -n $volumeExternal ]] && sed -i 's/#external:/external:/' $stackFile
  [[ -n $volumeName ]] && sed -i 's/#name:/name:/' $stackFile
fi

stackContent=$(awk '{printf "%s\\n", $0}' "$stackFile" | sed 's/"/\\"/g')
stackEnvVars="["

while IFS='=' read -r key value
do
  stackEnvVars="${stackEnvVars}{\"name\": \"$key\", \"value\": \"$value\"},"
done < "$envFile"

stackEnvVars="${stackEnvVars%,}]"

stackJSON=$(cat <<EOF
{
  "Name": "$stackName",
  "SwarmID": "",
  "StackFileContent": "$stackContent",
  "Env": $stackEnvVars
}
EOF
)

curl -X POST -H "Content-Type: application/json" -H "X-API-Key: ${portainerToken}" -d "$stackJSON" "$portainerURL"

Lines with changes needed:

portainerURL="https://$portainerHost:9443/api/stacks?type=2&method=string&endpointId=2"
curl -k -X POST -H "Content-Type: application/json" -H "X-API-Key: ${portainerToken}" -d "$stackJSON" "$portainerURL"

Untested, but should work...

EDIT: The script will be in the directory you have bound to /config -- typically, /data/olivetin on your host system.

I'll try that, once i figure out bindings. Honestly pulling my hair out a bit on them...

1 Like

Are your Channels DVR files on this same Mac, or elsewhere on your LAN?

On Mac

Linux and Windows for me, but I would think:

HOST_DIR=/data
DVR_SHARE=<absolute path to your CDVR files>

And then change this line in the docker-compose:

      - ${DVR_SHARE}:/mnt/<hostname or ip of your Mac>-8089 # This can either be a Docker volume or a host directory that's connected via Samba or NFS to your Channels DVR network share
1 Like

I'm building a new version now with https support -- should be available to pull in a few minutes...

EDIT: Done and available to pull as :latest

1 Like

I wish portainer would create volumes like a docker -v switch would. Would save so many headaches.

Are you absolutely sure this needs a preceding / ? I'm using the adbtuner docker example:

docker run -d --init -p 5592:5592 --name adbtuner -v adbtuner_config:/app/.config turtletank99/adbtuner

Bindings that look like this: adbtuner_config:/app/.config (with no slash) are docker volumes, and need to be defined in the volumes: section of a docker-compose. These are managed by Docker.

Bindings that look like this: /adbtuner_config:/app/.config (with a slash) are directory mappings, and are mapped to that exact directory on the docker host. These are not managed by Docker.

Some OS's don't allow new directories at the / level, and need to mapped a level down. Synology, for example, needs /volume1/data rather than just /data -- due to OS restrictions.

1 Like