From a692c729f8cba55b75e3c68dc45e4cb724e3f700 Mon Sep 17 00:00:00 2001
From: Leopere <colin@nixc.us>
Date: Tue, 2 Oct 2018 16:33:20 -0400
Subject: [PATCH] Adding start.sh with some defaults With permissions
 assertions to boot. Added a few arguments to start with.  I may change how
 this is done but I likely won't change the user facing side.

---
 lbrycrd/start.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100644 lbrycrd/start.sh

diff --git a/lbrycrd/start.sh b/lbrycrd/start.sh
new file mode 100644
index 0000000..61814a0
--- /dev/null
+++ b/lbrycrd/start.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+## Ensure perms are correct prior to running main binary
+chown -R 1000:1000 /data
+chmod -R 755 /data
+chown -R 1000:1000 /etc/lbrycrdd
+chmod -R 755 /etc/lbrycrdd
+rm -f /var/run/lbrycrdd.pid
+
+## For now keeping this simple. Potentially eventually add all command args as envvars for the Dockerfile or use safe way to add args via docker-compose.yml
+~/lbrycrdd \
+  -conf=${CONF_PATH:-/etc/lbrycrdd/lbrycrdd.conf} \
+  -data=${DATA_DIR:-/data/} \
+  -port=${PORT:-9246} \
+  -pid=${PID_FILE:/var/run/lbrycrdd.pid} \
+  -printtoconsole \
+  -rpcport=${RPC_PORT:-9245} \
+  -rpcpassword=${RPC_PASSWORD:-changeme} \
+  -rpcallowip=${RPC_ALLOW_IP:-10.5.0.2} \
+  -rpcuser=${RPC_USER:-lbryrpc}