From d264e1ec8c5466c00541d03433dd41e3237ae47f Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Mon, 19 Jun 2017 20:24:50 +0200
Subject: [PATCH] Initial commit

---
 .gitignore         |  3 +++
 README.md          | 13 +++++++++++++
 api-env            |  1 +
 download-tracks.sh | 18 ++++++++++++++++++
 front-env          |  1 +
 music/list         |  8 ++++++++
 setup-demo.sh      | 37 +++++++++++++++++++++++++++++++++++++
 7 files changed, 81 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 api-env
 create mode 100755 download-tracks.sh
 create mode 100644 front-env
 create mode 100644 music/list
 create mode 100755 setup-demo.sh

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..83ea789
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+api
+front
+music/files
diff --git a/README.md b/README.md
index e69de29..798523b 100644
--- a/README.md
+++ b/README.md
@@ -0,0 +1,13 @@
+#Funkwhale demo
+
+You simply need to download demo tracks (courtesy of Jamendo):
+
+    ./download-tracks.sh
+
+Then set up everything:
+
+    ./setup-demo.sh
+
+This will take care of pulling git repositories, spin up docker containers, etc.
+
+`./setup-demo` may be called multiple times if you want to update the demo to newer versions.
diff --git a/api-env b/api-env
new file mode 100644
index 0000000..64b7cc2
--- /dev/null
+++ b/api-env
@@ -0,0 +1 @@
+API_AUTHENTICATION_REQUIRED=false
diff --git a/download-tracks.sh b/download-tracks.sh
new file mode 100755
index 0000000..85b7964
--- /dev/null
+++ b/download-tracks.sh
@@ -0,0 +1,18 @@
+#! /bin/bash
+
+echo "This will download tracks from zip archives listed under music/list"
+
+mkdir -p music/files
+cd music/files
+
+echo "Downloading files..."
+cat ../list | grep "^[^#;]" | xargs -n 1 curl -LO
+
+echo "Unzipping archives..."
+find . -name "*.zip" | while read filename; do
+    dirname="${filename%.*}"
+    mkdir $dirname
+    unzip -o -d "$dirname" "$filename";
+done;
+
+echo "Done!"
diff --git a/front-env b/front-env
new file mode 100644
index 0000000..d981344
--- /dev/null
+++ b/front-env
@@ -0,0 +1 @@
+BACKEND_URL=https://demo.funkwhale.io
diff --git a/music/list b/music/list
new file mode 100644
index 0000000..26a83c4
--- /dev/null
+++ b/music/list
@@ -0,0 +1,8 @@
+# You can get a pretty list of open music here: https://archive.org/details/jamendo-albums
+https://archive.org/compress/jamendo-069098/formats=OGG%20VORBIS&file=/jamendo-069098.zip
+https://archive.org/compress/jamendo-001144/formats=OGG%20VORBIS&file=/jamendo-001144.zip
+https://archive.org/compress/jamendo-027690/formats=OGG%20VORBIS&file=/jamendo-027690.zip
+https://archive.org/compress/jamendo-001469/formats=OGG%20VORBIS&file=/jamendo-001469.zip
+https://archive.org/compress/jamendo-106323/formats=OGG%20VORBIS&file=/jamendo-106323.zip
+https://archive.org/compress/jamendo-071149/formats=OGG%20VORBIS&file=/jamendo-071149.zip
+https://archive.org/compress/jamendo-085030/formats=OGG%20VORBIS&file=/jamendo-085030.zip
diff --git a/setup-demo.sh b/setup-demo.sh
new file mode 100755
index 0000000..4a7b7bb
--- /dev/null
+++ b/setup-demo.sh
@@ -0,0 +1,37 @@
+#! /bin/bash
+
+API_BRANCH="develop"
+FRONT_BRANCH="master"
+echo "Initializing repositories..."
+git clone ssh://git@code.eliotberriot.com:2222/funkwhale/api.git api
+git clone ssh://git@code.eliotberriot.com:2222/funkwhale/front.git front
+
+echo "Updating repositories..."
+git -C api checkout $API_BRANCH
+git -C api pull
+git -C front checkout $FRONT_BRANCH
+git -C front pull
+
+echo "Copying music directory..."
+cp -r music api/
+
+echo "Setting up api .env file..."
+cp ./api-env api/.env
+
+echo "Setting up front .env file..."
+cp ./front-env front/.env
+
+echo "Stopping previous demo..."
+docker-compose -p funkwhale_demo_api -f api/dev.yml down -v
+docker-compose -p funkwhale_demo_front -f front/dev.yml down -v
+rm -rf api/funkwhale_api/media
+
+echo "Compiling front-end files..."
+docker-compose -p funkwhale_demo_front -f front/dev.yml run app npm run build
+
+echo "Configuring api..."
+docker-compose -p funkwhale_demo_api -f api/dev.yml up -d postgres
+sleep 5
+docker-compose -p funkwhale_demo_api -f api/dev.yml run django ./demo/load-demo-data.sh
+
+docker-compose -p funkwhale_demo_api -f api/dev.yml up -d
-- 
GitLab