Skip to content

Commit

Permalink
chore: Adjust scripts to run with new docker compose (#58)
Browse files Browse the repository at this point in the history
* Align login script with new docker compose file

* Remove flowforge references
  • Loading branch information
ppawlowski authored Oct 29, 2024
1 parent 11e0160 commit 4586153
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 48 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright FlowForge Inc, and other contributors, https://flowforge.com/
Copyright FlowFuse Inc, and other contributors, https://flowfuse.com/

Apache License
Version 2.0, January 2004
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# FlowForge Droplet
# FlowFuse Droplet

## Description

FlowForge's intuitive UI lets you manage your Node-RED instances all in one place.
FlowFuse's intuitive UI lets you manage your Node-RED instances all in one place.

Spin up instances of Node-RED in seconds, monitor project health and tear down or suspend projects as required.

### Before you deploy your FlowForge Droplet
### Before you deploy your FlowFuse Droplet

#### Get a Domain

Use this [DNS quickstart](https://docs.digitalocean.com/products/networking/dns/quickstart/) guide to get your DNS setup on DigitalOcean. You’ll first need to purchase and register your domain through a third party, such as Name.com, GoDaddy, etc…

- Why do you need a domain name?

The domain will be used to generate the host names for each FlowForge project you deploy
The domain will be used to generate the host names for each FlowFuse project you deploy

#### Setup email

FlowForge needs a way to send email to verify new users and to send invites when users are added to teams. To do this you will need to have details of a SMTP server that will allow you to send email.
FlowFuse needs a way to send email to verify new users and to send invites when users are added to teams. To do this you will need to have details of a SMTP server that will allow you to send email.

If you do not have a SMTP server you can set one up using a service like SparkPost, [Sendgrid](https://marketplace.digitalocean.com/apps/sendgrid) or Mailgun.

You can skip this step and configure it later, but the platform works best when setup from the start.

### Getting started after deploying

On your first SSH Login to your droplet or when you connect to the Droplet console you will be greeted by a wizard that will guide you through setting up the domain name and starting your FlowForge instance.
On your first SSH Login to your droplet or when you connect to the Droplet console you will be greeted by a wizard that will guide you through setting up the domain name and starting your FlowFuse instance.

Before entering your hostname you will need to add an A record for your domain.

Once the wildcard A record has been created you can enter it into the wizard. The wizard will then update the configuration files and start the FlowForge Application. The final configuration is done via the web interface on the hostname that will be in final message from the wizard.
Once the wildcard A record has been created you can enter it into the wizard. The wizard will then update the configuration files and start the FlowFuse Application. The final configuration is done via the web interface on the hostname that will be in final message from the wizard.

Details of how to complete configuration can be found [here](https://flowforge.com/docs/install/first-run/#--docker-or-kubernetes)
Details of how to complete configuration can be found [here](https://flowfuse.com/docs/install/first-run/#--docker-or-kubernetes)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
#!/bin/bash

myip=$(hostname -I | awk '{print$1}')
# myip=$(hostname -I | awk '{print$1}')
myip=$(curl -s ipinfo.io/ip)

modify_config()
{
DOM=$1

sed -i "s/example.com/$DOM/" /opt/flowforge/etc/flowforge.yml
sed -i 's/base_url: http/base_url: https/' /opt/flowforge/etc/flowforge.yml
sed -i 's/ public_url: ws/ public_url: wss/' /opt/flowforge/etc/flowforge.yml
cp /opt/flowfuse/.env.example /opt/flowfuse/.env
sed -i "s/^DOMAIN=.*/DOMAIN=$DOM/" /opt/flowfuse/.env
sed -i "s/^TLS_ENABLED=.*/TLS_ENABLED=true/" /opt/flowfuse/.env
echo CREATE_ADMIN=true >> /opt/flowfuse/.env

sed -i "s/example.com/$DOM/" /opt/flowforge/docker-compose.yml
sed -i 's/# //' /opt/flowforge/docker-compose.yml

#temp fix
sed -i 's!initdb.d/setup-db.sh!initdb.d/01-setup-db.sh!' /opt/flowforge/docker-compose.yml
sed -i 's!initdb.d/setup-context-db.sh!initdb.d/02-setup-context-db.sh!' /opt/flowforge/docker-compose.yml
}

cat <<EOF
********************************************************************************
Welcome to the FlowForge Digital Ocean Droplet Wizard
Welcome to the FlowFuse Digital Ocean Droplet Wizard
Please ensure you have an A record DNS entry pointing to $myip for your domain
EOF

read -p "Please enter the domain to use for FlowForge: " DOMAIN
read -p "Please enter the domain to use for FlowFuse: " DOMAIN
echo "Using $DOMAIN"
select yn in "Yes" "No"; do
case $yn in
Yes ) modify_config $DOMAIN; break;;
No ) ;;
esac
read -p "Pease enter the domain to use for FlowForge: " DOMAIN
read -p "Pease enter the domain to use for FlowFuse: " DOMAIN
echo "Using $DOMAIN"
echo "1) Yes"
echo "2) No"
Expand All @@ -44,7 +40,7 @@ done
cat <<EOF
********************************************************************************
Would you like to setup an SMTP Server to allow FlowForge to send email?
Would you like to setup an SMTP Server to allow FlowFuse to send email?
This will be used to handle password resets and to invite users to teams.
Expand Down Expand Up @@ -78,32 +74,46 @@ select email in "Yes" "No"; do

done

cat <<EOF >> /opt/flowforge/etc/flowforge.yml
email:
enabled: true
from: '"FlowForge" <flowforge@$DOMAIN>'
smtp:
host: $SMTPHOST
port: $SMTPPORT
secure: $SMTPSECURE
auth:
user: $SMTPUSER
pass: $SMTPPASSWORD
EOF
sed -i "s/^EMAIL_ENABLED=.*/ENAMIL_ENABLED=true/" /opt/flowfuse/.env
sed -i "s/^EMAIL_HOST=.*/EMAIL_HOST=$SMTPHOST/" /opt/flowfuse/.env
sed -i "s/^EMAIL_PORT=.*/EMAIL_PORT=$SMTPPORT/" /opt/flowfuse/.env
sed -i "s/^EMAIL_USER=.*/EMAIL_USER=$SMTPUSER/" /opt/flowfuse/.env
sed -i "s/^EMAIL_PASSWORD=.*/EMAIL_PASSWORD=$SMTPPASSWORD/" /opt/flowfuse/.env
sed -i "s/^EMAIL_SECURE=.*/EMAIL_SECURE=$SMTPSECURE/" /opt/flowfuse/.env

break
done

cd /opt/flowforge
docker compose -p flowforge up -d
cd /opt/flowfuse
docker compose --profile autotls up -d --quiet-pull

cat <<EOF
********************************************************************************
Waiting 30 seconds for startup
********************************************************************************
EOF

sleep 30
curl -s -L --insecure "https://forge.$DOMAIN/setup"
sleep 2

adminPass=$(docker logs flowfuse-forge-1 2>&1 | awk '/\[SETUP\] password/ { print $0}' | jq -r .msg | awk '{ print $3 }')

cat <<EOF
********************************************************************************
You can then finish setting up your FlowForge instance at
You can then finish setting up your FlowFuse instance at
https://forge.$DOMAIN/setup
Username: ff-admin
Password: $adminPass
You will be asked to change the password on login.
If you get a certificate error on first access, please wait a minute for
LetsEncrypt to complete provisioning and reload the page.
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/015-flowforge.sh → scripts/015-flowfuse.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh

mkdir -p /opt/flowforge
mkdir -p /opt/flowfuse
echo https://github.com/FlowFuse/docker-compose/archive/refs/tags/v${application_version}.tar.gz
curl -L https://github.com/FlowFuse/docker-compose/archive/refs/tags/v${application_version}.tar.gz | tar zx --one-top-level=/opt/flowforge --strip-components=1
curl -L https://github.com/FlowFuse/docker-compose/archive/refs/tags/v${application_version}.tar.gz | tar zx --one-top-level=/opt/flowfuse --strip-components=1
docker pull flowfuse/node-red
docker pull flowfuse/forge-docker
docker pull flowfuse/file-server
Expand Down
2 changes: 1 addition & 1 deletion scripts/016-first-run.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh

cp -f /etc/skel/.bashrc /root/.bashrc
echo "/opt/flowforge/first-login.sh" >> /root/.bashrc
echo "/opt/flowfuse/first-login.sh" >> /root/.bashrc
14 changes: 7 additions & 7 deletions template.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"variables": {
"do_api_token": "{{env `DIGITALOCEAN_API_TOKEN`}}",
"image_name": "flowforge-{{env `FF_DASH_VERSION`}}-snapshot-{{timestamp}}",
"image_name": "flowfuse-{{env `FF_DASH_VERSION`}}-snapshot-{{timestamp}}",
"apt_packages": "apt-transport-https ca-certificates curl jq linux-image-extra-virtual software-properties-common ",
"application_name": "FlowForge",
"application_name": "FlowFuse",
"application_version": "{{env `FF_VERSION`}}",
"docker_compose_version": "v2.12.0"
"docker_compose_version": "v2.29.7"
},
"sensitive-variables": [
"do_api_token"
Expand Down Expand Up @@ -69,8 +69,8 @@
"scripts/011-docker-compose.sh",
"scripts/012-grub-opts.sh",
"scripts/013-docker-dns.sh",
"scripts/014-ufw-flowforge.sh",
"scripts/015-flowforge.sh",
"scripts/014-ufw-flowfuse.sh",
"scripts/015-flowfuse.sh",
"scripts/016-first-run.sh",
"scripts/020-application-tag.sh",
"scripts/900-cleanup.sh",
Expand All @@ -79,8 +79,8 @@
},
{
"type": "file",
"source": "files/opt/flowforge/",
"destination": "/opt/flowforge/"
"source": "files/opt/flowfuse/",
"destination": "/opt/flowfuse/"
}
],
"post-processors": [
Expand Down

0 comments on commit 4586153

Please sign in to comment.