refactor: add support to new docker compose cli

pull/4996/head
Radamés Roriz 2023-02-26 15:22:00 -03:00 committed by GitHub
parent ac72ee494c
commit 9acae33e66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -1,11 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
writehosts(){ writehosts(){
echo "\ echo NEWHOSTS | sudo tee -a /etc/hosts > /dev/null
127.0.0.1 authelia.$DOMAIN
127.0.0.1 public.$DOMAIN
127.0.0.1 traefik.$DOMAIN
127.0.0.1 secure.$DOMAIN" | sudo tee -a /etc/hosts > /dev/null
} }
username(){ username(){
@ -27,7 +23,7 @@ if [[ ! -x "$(command -v docker)" ]]; then
exit 1 exit 1
fi fi
if [[ ! -x "$(command -v docker-compose)" ]]; then if [[ ! -x "$(command -v docker-compose)" && ! $(docker compose version) ]]; then
echo "You must install Docker Compose on your machine"; echo "You must install Docker Compose on your machine";
exit 1 exit 1
fi fi
@ -54,6 +50,11 @@ if [[ $DOMAIN == "" ]]; then
fi fi
MODIFIED=$(cat /etc/hosts | grep $DOMAIN && echo true || echo false) MODIFIED=$(cat /etc/hosts | grep $DOMAIN && echo true || echo false)
NEWHOSTS="
127.0.0.1 authelia.$DOMAIN
127.0.0.1 public.$DOMAIN
127.0.0.1 traefik.$DOMAIN
127.0.0.1 secure.$DOMAIN"
if [[ $MODIFIED == "false" ]]; then if [[ $MODIFIED == "false" ]]; then
writehosts writehosts
@ -110,7 +111,7 @@ else
password password
fi fi
sudo docker-compose up -d sudo docker-compose up -d || sudo docker compose up -d
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
exit 1 exit 1
@ -127,4 +128,7 @@ You can now visit the following locations:
You will need to authorize the self-signed certificate upon visiting each domain. You will need to authorize the self-signed certificate upon visiting each domain.
To visit https://secure.$DOMAIN you will need to register a device for second factor authentication and confirm by clicking on a link sent by email. Since this is a demo with a fake email address, the content of the email will be stored in './authelia/notification.txt'. To visit https://secure.$DOMAIN you will need to register a device for second factor authentication and confirm by clicking on a link sent by email. Since this is a demo with a fake email address, the content of the email will be stored in './authelia/notification.txt'.
Upon registering, you can grab this link easily by running the following command: 'grep -Eo '"https://.*" ' ./authelia/notification.txt'. Upon registering, you can grab this link easily by running the following command: 'grep -Eo '"https://.*" ' ./authelia/notification.txt'.
WSL users: You will need to add the following to your C:\Windows\System32\drivers\etc\hosts file:
$NEWHOSTS
EOF EOF