135 lines
4.4 KiB
Bash
135 lines
4.4 KiB
Bash
# Federated Computer functions
|
|
|
|
fail() {
|
|
echo -ne "FAILED\n\n$1\n\n"
|
|
kill -9 $SPINPID &> /dev/null
|
|
# [ -d "apps/dns" ] && rm -rf apps/dns
|
|
# docker network rm fstack &> /dev/null
|
|
exit 2;
|
|
}
|
|
failcheck() {
|
|
echo -ne "\n\nFAILED - $1\n\n"
|
|
exit 2;
|
|
}
|
|
cleanup() {
|
|
kill -9 $SPINPID &> /dev/null
|
|
exit 2
|
|
}
|
|
spin() {
|
|
spinner="/|\\-/|\\-"
|
|
while :
|
|
do
|
|
for i in `seq 0 7`
|
|
do
|
|
echo -n "${spinner:$i:1}"
|
|
echo -en "\010"
|
|
sleep 1
|
|
done
|
|
done
|
|
}
|
|
create_password() {
|
|
# eval $1_var=$1
|
|
# echo "$postgres_var"
|
|
SECRET=`tr -cd '[:alnum:]' < /dev/urandom | fold -w32 | head -n1`
|
|
echo "$SECRET";
|
|
}
|
|
start_service() {
|
|
SERVICE="$1"
|
|
COMMAND="$2"
|
|
|
|
# Start /federated/apps/SERVICE with output to /dev/null
|
|
echo -ne "\n* Starting /federated/apps/$SERVICE service.."
|
|
spin &
|
|
SPINPID=$!
|
|
|
|
if [ $DEBUG ]; then
|
|
# Start /federated/apps/SERVICE with output to console for debug
|
|
docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up
|
|
[ $? -eq 0 ] && echo -ne "done.\n" || fail "There was a problem starting service /federated/apps/$SERVICE"
|
|
else
|
|
docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE up -d &> /dev/null
|
|
|
|
# Keep trying service port to make sure it's up before
|
|
# we proceed
|
|
RETRY="30"
|
|
while [ $RETRY -gt 0 ]; do
|
|
bash -c "$COMMAND" &> /dev/null
|
|
if [ $? -eq 0 ]; then
|
|
break
|
|
else
|
|
if [ "$RETRY" == 1 ]; then
|
|
docker-compose -f /federated/apps/$SERVICE/docker-compose.yml -p $SERVICE down &> /dev/null
|
|
kill -9 $SPINPID &> /dev/null
|
|
fail "There was a problem starting service /federated/apps/$SERVICE\nCheck the output of 'docker logs $SERVICE' or turn on\ndebug with -d"
|
|
fi
|
|
((RETRY--))
|
|
sleep 7
|
|
fi
|
|
done
|
|
fi
|
|
}
|
|
print_details() {
|
|
cat > /federated/apps/mail/data/root/certs/mailfile <<EOF
|
|
Panel: User Management
|
|
https://panel.$DOMAIN
|
|
|
|
You must also log in as an admin user to https://vaultwarden.$DOMAIN
|
|
to create an organization for your team. Open the URL
|
|
(https://vaultwarden.$DOMAIN) and click the text below "Continue"
|
|
that says "Create account".
|
|
|
|
You will need this information for the VPN that can be set up by
|
|
users of your system. Please keep it private.
|
|
|
|
EOF
|
|
|
|
cat /federated/apps/wireguard/data/config/peer1/peer1.conf >> /federated/apps/mail/data/root/certs/mailfile
|
|
|
|
cat >> /federated/apps/mail/data/root/certs/mailfile <<EOF
|
|
All documentation for administration of your Federated Core can
|
|
be found at: https://documentation.federated.computer/administration.
|
|
|
|
Users can then log into the following services to use Federated Core:
|
|
|
|
Nextcloud: The Nextcloud suite provides web apps and services
|
|
covering mail, calendar, contacts, notes, tasks, files, project
|
|
management (deck), bookmarks, forms, team talk, pictures, and an
|
|
activity monitor. It can be accessed at: https://nextcloud.$DOMAIN
|
|
|
|
Jitsi: Video-conferencing. The current installation supports (4)
|
|
users and can be extended by adding more RAM to the system. It can
|
|
be found at: https://jitsi.$DOMAIN
|
|
|
|
Element: Worldwide Federated Chat. This chat client uses Matrix and
|
|
can be used chat with users outside your team and can even interact
|
|
with other chat servers around the world including Signal, Whatsapp,
|
|
and other services. It is found at: https://element.$DOMAIN
|
|
|
|
Listmonk: Marketing Email Service. Use Listmonk the way you would use
|
|
Mailchimp. Found here: https://listmonk.$DOMAIN
|
|
|
|
Vaultwarden: Password Management. Open source equivalent of Bitwarden
|
|
and is a widely used replacement for 1password, Lastpass, and other
|
|
password managers. https://vaultwarden.$DOMAIN
|
|
|
|
Baserow: Easy Database. Replacement for Airtable. Build amazing, easy
|
|
to create on-line databases to be used by your team.
|
|
https://baserom.$DOMAIN
|
|
|
|
Cal.com: Easy scheduling. Create easy links so that others can easily
|
|
schedule time on your calendar without the annoying back-and-forth.
|
|
https://calcom.$DOMAIN
|
|
|
|
Connector: a utility to automatically configure all your applications
|
|
on macOS, iOS, Windows, Android for use with your Federated Core.
|
|
https://connector.$DOMAIN
|
|
|
|
All documentation for users can be found at
|
|
https://documentation.federated.computer/users.
|
|
EOF
|
|
|
|
# Send out e-mail from mail container with details
|
|
docker exec -it mail bash -c "mail -r admin@$DOMAIN -s \"Welcome to Feded\" admin@$DOMAIN < /root/certs/mailfile"
|
|
cat /federated/apps/mail/data/root/certs/mailfile
|
|
rm /federated/apps/mail/data/root/certs/mailfile
|