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
be912431
Commit
be912431
authored
3 years ago
by
Creak
Browse files
Options
Downloads
Patches
Plain Diff
Get the superuser information before calling createsuperuser
parent
cc0e25e5
No related branches found
No related tags found
1 merge request
!2
Get the superuser information before calling createsuperuser
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+7
-0
7 additions, 0 deletions
README.md
setup.sh
+137
-12
137 additions, 12 deletions
setup.sh
with
144 additions
and
12 deletions
README.md
+
7
−
0
View file @
be912431
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
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
]
.
## Usage
To set up your instance, clone this repo and enter the directory, then run the
To set up your instance, clone this repo and enter the directory, then run the
script
`./setup.sh`
.
script
`./setup.sh`
.
...
@@ -13,4 +15,9 @@ pass them to it directly. See the help with this command:
...
@@ -13,4 +15,9 @@ pass them to it directly. See the help with this command:
./setup
--help
./setup
--help
```
```
## Developer
Prerequisites:
*
docker-compose
[
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
+
137
−
12
View file @
be912431
...
@@ -6,7 +6,11 @@ funkwhale_version_default=1.2.2
...
@@ -6,7 +6,11 @@ funkwhale_version_default=1.2.2
funkwhale_version
=
"
${
FUNKWHALE_VERSION
-
$funkwhale_version_default
}
"
funkwhale_version
=
"
${
FUNKWHALE_VERSION
-
$funkwhale_version_default
}
"
funkwhale_hostname
=
""
funkwhale_hostname
=
""
funkwhale_protocol
=
"https"
funkwhale_protocol
=
"https"
funkwhale_username
=
""
funkwhale_userpasswd
=
""
funkwhale_useremail
=
""
# Show an error message and exit.
# Params:
# Params:
# 1. message
# 1. message
function
die
function
die
...
@@ -15,11 +19,12 @@ function die
...
@@ -15,11 +19,12 @@ function die
exit
1
exit
1
}
}
# Get the value out of a "key=value" argument.
# Params:
# Params:
# 1. option
,
in the format "key=value"
# 1.
the
option
(
in the format "key=value"
)
function
get_not_empty_arg
function
get_not_empty_arg
{
{
value
=
${
1
#*=
}
local
value
=
${
1
#*=
}
if
[
-z
$value
]
;
then
if
[
-z
$value
]
;
then
die
"ERROR:
\"
${
1
%%=*
}
\"
requires a non-empty option argument."
die
"ERROR:
\"
${
1
%%=*
}
\"
requires a non-empty option argument."
fi
fi
...
@@ -27,15 +32,20 @@ function get_not_empty_arg
...
@@ -27,15 +32,20 @@ function get_not_empty_arg
echo
$value
echo
$value
}
}
# Show the help text.
# No param.
function
show_help
function
show_help
{
{
bin_name
=
$(
basename
$0
)
local
bin_name
=
$(
basename
$0
)
cat
<<
HELP
cat
<<
HELP
Usage:
$bin_name
[OPTION]...
Usage:
$bin_name
[OPTION]...
-
h
, --
host=HOST
set the
hostname (e.g. your.domain.io)
-
e
, --
email=EMAIL
set the
superuser e-mail
--help display this help text and exit
--help display this help text and exit
--protocol=PROTOCOL set the protocol (default: https)
-h, --host=HOST set the hostname (e.g. your.domain.io)
-p, --password=PASSWORD set the superuser password
--protocol=PROTOCOL set the protocol (default:
$funkwhale_protocol
)
-u, --user=USER set the superuser name
It is possible to define a specific Funkwhale version by setting the
It is possible to define a specific Funkwhale version by setting the
FUNKWHALE_VERSION environment variable before running the script (by
FUNKWHALE_VERSION environment variable before running the script (by
...
@@ -60,13 +70,81 @@ Examples:
...
@@ -60,13 +70,81 @@ Examples:
HELP
HELP
}
}
# Run an interactive shell to prompt for a value.
# Params:
# 1. the prompt text
# 2. the variable name
function
prompt_value
{
local
input
=
""
while
[
-z
"
$input
"
]
;
do
read
-ep
"
$1
: "
input
if
[
-z
"
$input
"
]
;
then
echo
"Text can't be empty."
fi
done
eval
$2
=
"
$input
"
}
# Run an interactive shell to prompt for a password.
# Params:
# 1. the prompt text
# 2. the variable name
function
prompt_password
{
local
passwd
=
""
local
passwd_verif
=
"invalid"
while
[
"
$passwd
"
!=
"
$passwd_verif
"
]
;
do
while
[
-z
"
$passwd
"
]
;
do
read
-sep
"
$1
: "
passwd
# Newline to replace the one eaten by read.
echo
if
[
-z
"
$passwd
"
]
;
then
echo
"Password can't be empty."
fi
done
read
-sep
"
$1
(again): "
passwd_verif
# Newline to replace the one eaten by read.
echo
if
[
"
$passwd
"
!=
"
$passwd_verif
"
]
;
then
echo
"Passwords don't match."
passwd
=
""
passwd_verif
=
"invalid"
fi
done
eval
$2
=
"
$passwd
"
}
# Parse the script options
# Parse the script options
while
true
;
do
while
true
;
do
case
$1
in
case
$1
in
# Superuser e-mail
-e
|
--email
)
if
[
-n
"
$2
"
]
;
then
funkwhale_useremail
=
$2
shift
else
die
"ERROR:
\"
$1
\"
requires a non-empty option argument."
fi
;;
--email
=
*
)
funkwhale_useremail
=
$(
get_not_empty_arg
$1
)
;;
# Help
--help
)
--help
)
show_help
show_help
exit
exit
;;
;;
# Hostname
-h
|
--host
)
-h
|
--host
)
if
[
-n
"
$2
"
]
;
then
if
[
-n
"
$2
"
]
;
then
funkwhale_hostname
=
$2
funkwhale_hostname
=
$2
...
@@ -78,6 +156,21 @@ while true; do
...
@@ -78,6 +156,21 @@ while true; do
--host
=
*
)
--host
=
*
)
funkwhale_hostname
=
$(
get_not_empty_arg
$1
)
funkwhale_hostname
=
$(
get_not_empty_arg
$1
)
;;
;;
# Superuser password
-p
|
--password
)
if
[
-n
"
$2
"
]
;
then
funkwhale_userpasswd
=
$2
shift
else
die
"ERROR:
\"
$1
\"
requires a non-empty option argument."
fi
;;
--password
=
*
)
funkwhale_userpasswd
=
$(
get_not_empty_arg
$1
)
;;
# Protocol
--protocol
)
--protocol
)
if
[
-n
"
$2
"
]
;
then
if
[
-n
"
$2
"
]
;
then
funkwhale_protocol
=
$2
funkwhale_protocol
=
$2
...
@@ -89,6 +182,20 @@ while true; do
...
@@ -89,6 +182,20 @@ while true; do
--protocol
=
*
)
--protocol
=
*
)
funkwhale_protocol
=
$(
get_not_empty_arg
$1
)
funkwhale_protocol
=
$(
get_not_empty_arg
$1
)
;;
;;
# Superuser name
-u
|
--user
)
if
[
-n
"
$2
"
]
;
then
funkwhale_username
=
$2
shift
else
die
"ERROR:
\"
$1
\"
requires a non-empty option argument."
fi
;;
--user
=
*
)
funkwhale_username
=
$(
get_not_empty_arg
$1
)
;;
-?
*
)
-?
*
)
echo
"ERROR: Unknown option:
$1
"
>
&2
echo
"ERROR: Unknown option:
$1
"
>
&2
show_help
show_help
...
@@ -102,12 +209,24 @@ while true; do
...
@@ -102,12 +209,24 @@ while true; do
done
done
# Ensure the hostname is defined
# Ensure the hostname is defined
while
[
-z
$funkwhale_hostname
]
;
do
read
-ep
"Please enter your Funkwhale hostname: "
funkwhale_hostname
if
[
-z
$funkwhale_hostname
]
;
then
if
[
-z
$funkwhale_hostname
]
;
then
echo
"Hostname can't be null."
prompt_value
"Please enter the Funkwhale hostname"
funkwhale_hostname
fi
# Ensure the superuser name is defined
if
[
-z
$funkwhale_username
]
;
then
prompt_value
"Please enter the superuser name"
funkwhale_username
fi
# Ensure the superuser password is defined
if
[
-z
$funkwhale_userpasswd
]
;
then
prompt_password
"Please enter the superuser password"
funkwhale_userpasswd
fi
# Ensure the superuser password is defined
if
[
-z
$funkwhale_useremail
]
;
then
prompt_value
"Please enter the superuser e-mail"
funkwhale_useremail
fi
fi
done
# Fetch the template files
# Fetch the template files
echo
-n
"Fetching the template files... "
echo
-n
"Fetching the template files... "
...
@@ -122,6 +241,7 @@ popd > /dev/null
...
@@ -122,6 +241,7 @@ popd > /dev/null
echo
"done"
echo
"done"
# Copy the template files to the "funkwhale" directory
# Copy the template files to the "funkwhale" directory
echo
echo
"Copy files to the
\"
funkwhale
\"
directory"
echo
"Copy files to the
\"
funkwhale
\"
directory"
mkdir
-p
"funkwhale/nginx"
mkdir
-p
"funkwhale/nginx"
cd
"funkwhale"
cd
"funkwhale"
...
@@ -151,12 +271,17 @@ echo
...
@@ -151,12 +271,17 @@ echo
echo
"Pull the Docker images"
echo
"Pull the Docker images"
docker-compose pull
docker-compose pull
echo
echo
"Run initial DB migrations"
echo
"Run initial DB migrations"
docker-compose up
-d
postgres
docker-compose up
-d
postgres
docker-compose run
--rm
api python manage.py migrate
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
\
-e
DJANGO_SUPERUSER_USERNAME
=
"
$funkwhale_username
"
\
-e
DJANGO_SUPERUSER_PASSWORD
=
"
$funkwhale_userpasswd
"
\
-e
DJANGO_SUPERUSER_EMAIL
=
"
$funkwhale_useremail
"
\
api python manage.py createsuperuser
--no-input
echo
echo
echo
"Run the Funkwhale instance"
echo
"Run the Funkwhale instance"
...
...
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