Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions distributed_minio/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "minio",
"display_name": "Distributed MinIO",
"description": "MinIO is a high performance object storage server. Users can interact with it through its S3 API.",
"parameters": [
{
"name": "ACCESS_KEY",
"display_name": "Access Key",
"description": "Access key for accessing the S3 cluster",
"type": "string",
"required": true
},
{
"name": "SECRET_KEY",
"display_name": "Secret Key",
"description": "Secret key for accessing the S3 cluster",
"type": "string",
"required": true
},
{
"name": "IPS",
"display_name": "Peer IPs",
"description": "IP addresses to use for cluster communication",
"type": "list",
"required": true
}
],
"main": "distributed_minio/run.sh",
"dependencies": [
"distributed_minio/run.sh",
"utils/cachengo.sh",
"utils/parameters.sh"
]
}
47 changes: 47 additions & 0 deletions distributed_minio/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

source "utils/cachengo.sh"
source "utils/parameters.sh"

function do_install {
set -e
cachengo-cli updateInstallStatus $APPID "Installing"
echo $IPS
local IPS_ARR
array_from_json_list IPS_ARR "$IPS"
export MINIO_ACCESS_KEY=$ACCESS_KEY
export MINIO_SECRET_KEY=$SECRET_KEY

for ((i=0;i<${#IPS_ARR[@]};++i)); do
echo "${IPS_ARR[i]} $GROUPID-$i"
echo "${IPS_ARR[i]} $GROUPID-$i" >> /etc/hosts
done

echo "Total: $i"

docker run -p 9000:9000 \
--name $APPID \
-d \
-e "MINIO_ROOT_USER=$ACCESS_KEY" \
-e "MINIO_ROOT_PASSWORD=$SECRET_KEY" \
-v /data/$GROUPID:/data \
--net host \
--restart unless-stopped \
minio/minio server http://$GROUPID-{0...$((i-1))}/data/

cachengo-cli updateInstallStatus $APPID "Installed"
}

function do_uninstall {
cachengo-cli updateInstallStatus $APPID "Uninstalling"
rm -rf /data/$GROUPID
sed -i "/$GROUPID/d" /etc/hosts
docker stop $APPID
cachengo-cli updateInstallStatus $APPID "Uninstalled"
}


case "$1" in
install) do_install ;;
uninstall) do_uninstall ;;
esac
11 changes: 11 additions & 0 deletions docker-sv/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "bsv-bitcoind",
"display_name": "BSV bitcoind",
"description": "Runs the bitcoind executable from a Docker container.",
"parameters": [],
"main": "docker-sv/run.sh",
"dependencies": [
"docker-sv/run.sh",
"utils/cachengo.sh"
]
}
35 changes: 35 additions & 0 deletions docker-sv/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

source "utils/cachengo.sh"

function do_install {
set -e
cachengo-cli updateInstallStatus $APPID "Installing"
mkdir -p /bitcoin-data
docker run \
--name $APPID \
-d \
-p 8332:8332 \
-p 8333:8333 \
-p 9332:9332 \
-p 9333:9333 \
-p 18332:18332 \
-p 18333:18333 \
-v ~/bitcoin-data:/data \
--restart unless-stopped \
registry.cachengo.com/cachengo/docker-sv-aarch64:0.0
cachengo-cli updateInstallStatus $APPID "Installed"
}

function do_uninstall {
cachengo-cli updateInstallStatus $APPID "Uninstalling"
docker stop $APPID
docker rm $APPID
cachengo-cli updateInstallStatus $APPID "Uninstalled"
}


case "$1" in
install) do_install ;;
uninstall) do_uninstall ;;
esac
11 changes: 11 additions & 0 deletions facerec_example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "facerec_example",
"display_name": "Facerec Demo",
"description": "Runs a facial-recognition inference engine, a nearest-neighbors search database and a webserver exposed on :5001",
"parameters": [],
"main": "facerec_example/run.sh",
"dependencies": [
"facerec_example/run.sh",
"utils/cachengo.sh"
]
}
59 changes: 59 additions & 0 deletions facerec_example/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

source "utils/cachengo.sh"

NETNAME=$APPID-net
DATADIR=/data/$APPID

function do_install {
set -e
cachengo-cli updateInstallStatus $APPID "Installing"

mkdir -p $DATADIR
docker network create -d bridge $NETNAME

cachengo-cli updateInstallStatus $APPID "Installing: Search"
docker run -d \
-v $DATADIR/index256:/db \
-e "ANN_INDEX_LENGTH=256" \
--network=$NETNAME \
--name $APPID-nn_search \
registry.cachengo.com/cachengo/nn_search:2.0

cachengo-cli updateInstallStatus $APPID "Installing: Facerec"
docker run -d \
--network=$NETNAME \
--name=$APPID-facerec \
registry.cachengo.com/cachengo/facerec:1.0

cachengo-cli updateInstallStatus $APPID "Installing: Server"
docker run -d \
-p 5001:5000 \
-v $DATADIR/sso:/db \
-e "NN_SEARCH_ADDRESS=$APPID-nn_search:1323" \
-e "FACEREC_ADDRESS=$APPID-facerec:5000" \
--network=$NETNAME \
--name $APPID-sso \
registry.cachengo.com/cachengo/ford_sso_example:latest

cachengo-cli updateInstallStatus $APPID "Installed"
}

function do_uninstall {
cachengo-cli updateInstallStatus $APPID "Uninstalling"
docker network rm $NETNAME
docker stop $APPID-nn_search
docker rm $APPID-nn_search
docker stop $APPID-facerec
docker rm $APPID-facerec
docker stop $APPID-sso
docker rm $APPID-sso
rm -rf $DATADIR
cachengo-cli updateInstallStatus $APPID "Uninstalled"
}


case "$1" in
install) do_install ;;
uninstall) do_uninstall ;;
esac
21 changes: 18 additions & 3 deletions minio/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
{
"name": "minio",
"display_name": "Min.io",
"description": "Runs a Min.io S3 server",
"parameters": [],
"display_name": "Standalone MinIO",
"description": "MinIO is a high performance object storage server. Users can interact with it through its S3 API.",
"parameters": [
{
"name": "ACCESS_KEY",
"display_name": "Access Key",
"description": "Access key for accessing the S3 cluster. Can be any string.",
"type": "string",
"required": true
},
{
"name": "SECRET_KEY",
"display_name": "Secret Key",
"description": "Secret key for accessing the S3 cluster",
"type": "string",
"required": true
}
],
"main": "minio/run.sh",
"dependencies": [
"minio/run.sh",
Expand Down
8 changes: 7 additions & 1 deletion minio/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ function do_install {
--name $APPID \
-d \
-p 9000:9000 \
cachengo/minio:latest server /data
-e "MINIO_ACCESS_KEY=$ACCESS_KEY" \
-e "MINIO_SECRET_KEY=$SECRET_KEY" \
--restart unless-stopped \
-v /data/minio:/data \
registry.cachengo.com/cachengo/minio:latest server /data
cachengo-cli updateInstallStatus $APPID "Installed"
}

function do_uninstall {
cachengo-cli updateInstallStatus $APPID "Uninstalling"
docker stop $APPID
docker rm $APPID
rm -rf /data/minio/*
cachengo-cli updateInstallStatus $APPID "Uninstalled"
}

Expand Down
26 changes: 26 additions & 0 deletions new_user/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "new_user",
"display_name": "New User",
"description": "Adds a new user account to the target devices",
"parameters": [
{
"name": "TARGET_USER",
"display_name": "User",
"description": "User on which to install the key",
"type": "string",
"required": true
},
{
"name": "IS_SUDOER",
"display_name": "Sudoer?",
"description": "Should this user be added to the sudoers list?",
"type": "boolean",
"required": false
}
],
"main": "new_user/run.sh",
"dependencies": [
"new_user/run.sh",
"utils/cachengo.sh"
]
}
23 changes: 23 additions & 0 deletions new_user/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

source "utils/cachengo.sh"

function do_install {
set -e
cachengo-cli updateInstallStatus $APPID "Installing"
# Remove user@host to add our own identifier
useradd -s /path/to/shell -d /home/{dirname} -m -G sudo
cachengo-cli updateInstallStatus $APPID "Installed"
}

function do_uninstall {
cachengo-cli updateInstallStatus $APPID "Uninstalling"
sed -i "/$APPID/d" /home/*/.ssh/authorized_keys
cachengo-cli updateInstallStatus $APPID "Uninstalled"
}


case "$1" in
install) do_install ;;
uninstall) do_uninstall ;;
esac
11 changes: 11 additions & 0 deletions nginx/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "nginx",
"display_name": "NGINX",
"description": "Docker version of Nginx reverse proxy server. Serves files located in the node's /data/nginx folder",
"parameters": [],
"main": "nginx/run.sh",
"dependencies": [
"nginx/run.sh",
"utils/cachengo.sh"
]
}
29 changes: 29 additions & 0 deletions nginx/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

source "utils/cachengo.sh"

function do_install {
set -e
cachengo-cli updateInstallStatus $APPID "Installing"
docker run \
--name $APPID \
-d \
-p 80:80 \
--restart unless-stopped \
-v /data/nginx:/usr/share/nginx/html:ro \
registry.cachengo.com/library/nginx
cachengo-cli updateInstallStatus $APPID "Installed"
}

function do_uninstall {
cachengo-cli updateInstallStatus $APPID "Uninstalling"
docker stop $APPID
docker rm $APPID
cachengo-cli updateInstallStatus $APPID "Uninstalled"
}


case "$1" in
install) do_install ;;
uninstall) do_uninstall ;;
esac
24 changes: 24 additions & 0 deletions plex/fix_preferences.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import json
import os
import xml.etree.ElementTree as ET

APP_ID = os.environ.get('APPID') or 'plex'
IP_ADDRESSES = json.loads(os.environ.get('IP_ADDRESSES') or '[]')

xmlfile = '/data/{APP_ID}/config/Library/Application Support/Plex Media Server/Preferences.xml'.format(APP_ID=APP_ID)
tree = ET.parse(xmlfile)
root = tree.getroot()

uuid = root.attrib.get('CertificateUUID', 'uuid')
root.set('allowedNetworks', "fc00:0000:0000:0000:0000:0000:0000:0000/7,172.17.0.0/16,127.0.0.1")
custom_connections = [
'https://{ip}.{uuid}.plex.direct:32400'.format(uuid=uuid, ip=ip.replace('.', '-').replace(':', '-'))
for ip in IP_ADDRESSES
]
root.set('customConnections', ','.join(custom_connections))
print(','.join(custom_connections))

header = '<?xml version="1.0" encoding="utf-8"?>\n'
data = ET.tostring(root)
with open(xmlfile, "w") as f:
f.write(header+data)
Loading