Skip to content

Commit

Permalink
Use a random password for admin user
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-ballarin committed Feb 12, 2024
1 parent a3ced1e commit de3f289
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ bash docker_create_image.sh
```
bash docker_create_container.sh
```
6. Database is created upon the first run of the container with
```
bash docker_start.sh
```
The terminal will display the username and password of the administrator account, which can be subsequently changed through the web interface.

## 3. Run the docker container

Expand All @@ -43,7 +48,7 @@ cd turing-dmf/docker
```
bash docker_start.sh
```
**Turing** will be available at `https://host-server:8080`. The database will be initialized upon the first run.
**Turing** will be available at `https://host-server:8080`.
3. Attach a terminal to the running docker container
```
bash docker_terminal.sh
Expand Down
7 changes: 5 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ fi
# Add a default administration user to the django database, if not already done previously
DJANGO_ADMIN_INITIALIZED_FILE=${POSTGRES_CLUSTER_DATA_DIRECTORY}/.django_admin_initialized
if [[ ! -f ${DJANGO_ADMIN_INITIALIZED_FILE} ]]; then
echo "Initialize the default django administrator user with username admin and password admin. Make sure to change both the username and the password as soon as possible!"
export DJANGO_SUPERUSER_USERNAME=admin
export DJANGO_SUPERUSER_PASSWORD=$(cat /dev/urandom | tr -dc 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$^&*-_=+' | head -c 10; echo)
export DJANGO_SUPERUSER_EMAIL="[email protected]"
echo "Initialize the default django administrator user with username ${DJANGO_SUPERUSER_USERNAME} and password ${DJANGO_SUPERUSER_PASSWORD}"
cd /root/turing
[email protected] DJANGO_SUPERUSER_USERNAME=admin DJANGO_SUPERUSER_PASSWORD=admin python3 manage.py createsuperuser --no-input
python3 manage.py createsuperuser --no-input
touch ${DJANGO_ADMIN_INITIALIZED_FILE}
else
echo "Not initializing again default django administrator"
Expand Down

0 comments on commit de3f289

Please sign in to comment.