Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Funkwhale Docker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Creak
Funkwhale Docker
Commits
cc0e25e5
Commit
cc0e25e5
authored
3 years ago
by
Creak
Browse files
Options
Downloads
Plain Diff
Merge branch 'improve-script' into 'main'
Improve the setup script See merge request
!1
parents
a5d44bef
7f13c443
No related branches found
No related tags found
1 merge request
!1
Improve the setup script
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
README.md
+7
-2
7 additions, 2 deletions
README.md
setup.sh
+140
-32
140 additions, 32 deletions
setup.sh
with
148 additions
and
34 deletions
.gitignore
+
1
−
0
View file @
cc0e25e5
templates/
templates/
funkwhale/
This diff is collapsed.
Click to expand it.
README.md
+
7
−
2
View file @
cc0e25e5
...
@@ -3,9 +3,14 @@
...
@@ -3,9 +3,14 @@
This repo is here to help installing Funkwhale using Docker. It follows the
This repo is here to help installing Funkwhale using Docker. It follows the
[
multi-container installation documentation
][
docs-multi-container
]
.
[
multi-container installation documentation
][
docs-multi-container
]
.
To set up your instance, run this script:
To set up your instance, clone this repo and enter the directory, then run the
script
`./setup.sh`
.
This script will ask for the needed information, but it is also possible to
pass them to it directly. See the help with this command:
```
sh
```
sh
setup
.sh
./
setup
--help
```
```
[
docs-multi-container
]:
https://docs.funkwhale.audio/installation/docker.html#docker-multi-container
[
docs-multi-container
]:
https://docs.funkwhale.audio/installation/docker.html#docker-multi-container
This diff is collapsed.
Click to expand it.
setup.sh
+
140
−
32
View file @
cc0e25e5
#!/bin/sh
#!/bin/sh
set
-e
FUNKWHALE_VERSION
=
"1.2.2"
funkwhale_version_default
=
1.2.2
FUNKWHALE_HOSTNAME
=
""
while
getopts
"h:"
"options"
;
do
funkwhale_version
=
"
${
FUNKWHALE_VERSION
-
$funkwhale_version_default
}
"
case
$options
in
funkwhale_hostname
=
""
h
)
funkwhale_protocol
=
"https"
FUNKWHALE_HOSTNAME
=
$OPTARG
;;
# Params:
# 1. message
function
die
{
echo
"
$1
"
>
&2
exit
1
}
# Params:
# 1. option, in the format "key=value"
function
get_not_empty_arg
{
value
=
${
1
#*=
}
if
[
-z
$value
]
;
then
die
"ERROR:
\"
${
1
%%=*
}
\"
requires a non-empty option argument."
fi
echo
$value
}
function
show_help
{
bin_name
=
$(
basename
$0
)
cat
<<
HELP
Usage:
$bin_name
[OPTION]...
-h, --host=HOST set the hostname (e.g. your.domain.io)
--help display this help text and exit
--protocol=PROTOCOL set the protocol (default: https)
It is possible to define a specific Funkwhale version by setting the
FUNKWHALE_VERSION environment variable before running the script (by
default it will be
$funkwhale_version_default
)
During the process, the script will ask for the missing information.
Examples:
# Use the interactive shell and run the containers:
$bin_name
# Bypass the interactive shell by setting the hostname directly in the
# command-line:
$bin_name
-h mydomain.example.io
?
)
# For testing, set the protocol to 'http' in order to access it more easily
# using http://127.0.0.1:5000 when on the same host:
$bin_name
--protocol=http
# Set a specific Funkwhale version.
FUNKWHALE_VERSION=1.2.0
$bin_name
HELP
}
# Parse the script options
while
true
;
do
case
$1
in
--help
)
show_help
exit
;;
-h
|
--host
)
if
[
-n
"
$2
"
]
;
then
funkwhale_hostname
=
$2
shift
else
die
"ERROR:
\"
$1
\"
requires a non-empty option argument."
fi
;;
--host
=
*
)
funkwhale_hostname
=
$(
get_not_empty_arg
$1
)
;;
--protocol
)
if
[
-n
"
$2
"
]
;
then
funkwhale_protocol
=
$2
shift
else
die
"ERROR:
\"
$1
\"
requires a non-empty option argument."
fi
;;
--protocol
=
*
)
funkwhale_protocol
=
$(
get_not_empty_arg
$1
)
;;
-?
*
)
echo
"ERROR: Unknown option:
$1
"
>
&2
show_help
exit
1
exit
1
;;
;;
*
)
break
esac
esac
shift
done
done
while
[
-z
$FUNKWHALE_HOSTNAME
]
;
do
# Ensure the hostname is defined
read
-ep
"Please enter your Funkwhale hostname: "
FUNKWHALE_HOSTNAME
while
[
-z
$funkwhale_hostname
]
;
do
read
-ep
"Please enter your Funkwhale hostname: "
funkwhale_hostname
if
[
-z
$funkwhale_hostname
]
;
then
echo
"Hostname can't be null."
fi
done
done
echo
-n
"Fetching templates... "
# Fetch the template files
mkdir
-p
templates/nginx
echo
-n
"Fetching the template files... "
curl
-sLo
templates/nginx/funkwhale.template
"https://dev.funkwhale.audio/funkwhale/funkwhale/raw/
${
FUNKWHALE_VERSION
}
/deploy/docker.nginx.template"
raw_src
=
"https://dev.funkwhale.audio/funkwhale/funkwhale/raw/
${
funkwhale_version
}
/deploy"
curl
-sLo
templates/nginx/funkwhale_proxy.conf
"https://dev.funkwhale.audio/funkwhale/funkwhale/raw/
${
FUNKWHALE_VERSION
}
/deploy/docker.funkwhale_proxy.conf"
mkdir
-p
"templates/nginx"
curl
-sLo
templates/docker-compose.yml
"https://dev.funkwhale.audio/funkwhale/funkwhale/raw/
${
FUNKWHALE_VERSION
}
/deploy/docker-compose.yml"
pushd
"templates"
>
/dev/null
curl
-sLo
templates/env.prod.sample
"https://dev.funkwhale.audio/funkwhale/funkwhale/raw/
${
FUNKWHALE_VERSION
}
/deploy/env.prod.sample"
curl
-sLo
"nginx/funkwhale.template"
"
${
raw_src
}
/docker.nginx.template"
curl
-sLo
"nginx/funkwhale_proxy.conf"
"
${
raw_src
}
/docker.funkwhale_proxy.conf"
curl
-sLo
"docker-compose.yml"
"
${
raw_src
}
/docker-compose.yml"
curl
-sLo
"env.prod.sample"
"
${
raw_src
}
/env.prod.sample"
popd
>
/dev/null
echo
"done"
echo
"done"
# Create .env and reduce permissions on the .env file since it contains
# Copy the template files to the "funkwhale" directory
# sensitive data.
echo
"Copy files to the
\"
funkwhale
\"
directory"
echo
"Copy files"
mkdir
-p
"funkwhale/nginx"
mkdir
-p
nginx
cd
"funkwhale"
cp
templates/nginx/funkwhale.template nginx/
cp
"../templates/nginx/funkwhale.template"
"nginx/"
cp
templates/nginx/funkwhale_proxy.conf nginx/
cp
"../templates/nginx/funkwhale_proxy.conf"
"nginx/"
cp
templates/docker-compose.yml
.
cp
"../templates/docker-compose.yml"
"./"
cp
templates/env.prod.sample .env
cp
"../templates/env.prod.sample"
".env"
chmod
600 .env
# reduce permissions on the .env file since it contains sensitive data
chmod
600
".env"
echo
"Set Funkwhale version:
$FUNKWHALE_VERSION
"
# Set up the Funkwhale instance files
sed
-i
"s/FUNKWHALE_VERSION=latest/FUNKWHALE_VERSION=
$FUNKWHALE_VERSION
/"
.env
echo
"Set Funkwhale version:
$funkwhale_version
"
sed
-i
"s/FUNKWHALE_VERSION=latest/FUNKWHALE_VERSION=
$funkwhale_version
/"
.env
echo
"Set Funkwhale hostname:
$FUNKWHALE_HOSTNAME
"
echo
"Set Funkwhale hostname:
$funkwhale_hostname
"
sed
-i
"s/FUNKWHALE_HOSTNAME=yourdomain.funkwhale/FUNKWHALE_HOSTNAME=
$FUNKWHALE_HOSTNAME
/"
.env
sed
-i
"s/FUNKWHALE_HOSTNAME=yourdomain.funkwhale/FUNKWHALE_HOSTNAME=
$funkwhale_hostname
/"
.env
echo
"Set Funkwhale protocol:
$funkwhale_protocol
"
sed
-i
"s/FUNKWHALE_PROTOCOL=https/FUNKWHALE_PROTOCOL=
$funkwhale_protocol
/"
.env
echo
"Set Django secret key: xxxxxxxx"
echo
"Set Django secret key: xxxxxxxx"
DJANGO_SECRET_KEY
=
$(
openssl rand
-base64
45
)
django_secret_key
=
$(
openssl rand
-base64
45
)
sed
-i
"s#DJANGO_SECRET_KEY=#DJANGO_SECRET_KEY=
$
DJANGO_SECRET_KEY
#"
.env
sed
-i
"s#DJANGO_SECRET_KEY=#DJANGO_SECRET_KEY=
$
django_secret_key
#"
.env
echo
echo
"Pull the Docker images"
echo
"Pull the Docker images"
docker-compose pull
docker-compose pull
...
@@ -57,8 +158,15 @@ docker-compose run --rm api python manage.py migrate
...
@@ -57,8 +158,15 @@ docker-compose run --rm api python manage.py migrate
echo
"Create super user"
echo
"Create super user"
docker-compose run
--rm
api python manage.py createsuperuser
docker-compose run
--rm
api python manage.py createsuperuser
echo
echo
"Run the Funkwhale instance"
echo
"Run the Funkwhale instance"
docker-compose up
-d
docker-compose up
-d
source
"
$PWD
/.env"
source
"
$PWD
/.env"
echo
"The instance is accessible locally at http://localhost:
${
FUNKWHALE_API_PORT
}
"
cat
<<
EOF
Next step is to setup the reverse-proxy:
https://docs.funkwhale.audio/installation/index.html#reverse-proxy-setup
And then this instance of Funkwhale
${
FUNKWHALE_VERSION
}
will be accessible
externally at:
${
FUNKWHALE_PROTOCOL
}
://
${
FUNKWHALE_HOSTNAME
}
EOF
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment