[{"data":1,"prerenderedAt":399},["ShallowReactive",2],{"blog-\u002Fblog\u002F2022\u002F10\u002Fff-docker-gcp":3},{"id":4,"title":5,"body":6,"description":12,"extension":388,"meta":389,"navigation":394,"path":395,"seo":396,"stem":397,"__hash__":398},"blog\u002Fblog\u002F2022\u002F10\u002Fff-docker-gcp.md","Install FlowFuse Docker on Google Cloud",{"type":7,"value":8,"toc":385},"minimark",[9,13,16,19,38,45,50,64,68,77,80,88,91,98,101,108,111,118,121,125,128,134,142,148,151,155,158,164,167,172,182,187,192,198,202,207,214,218,221,224,229,232,237,240,245,252,259,263,266,271,274,279,282,289,292,299,306,313,316,323,328,331,338,341,345,348,353,356,361,367,370,373,379,382],[10,11,12],"p",{},"As part of our preparations for FlowFuse 1.0 we have been testing various real world scenarios to see where we can add to our documentation and where we might be able to improve our releases to make the install process easier for users. As a benefit of that testing we have been able to hone these installation processes and we wanted to share one of those with you today.",[10,14,15],{},"In this first of three articles, we are going to run through the process for installing FlowFuse on Google Cloud Platform (GCP) within a virtual machine (VM) using Docker.",[10,17,18],{},"We have set ourselves the goal of delivering a production environment. We want this installation benefit from:",[20,21,22,26,29],"ul",{},[23,24,25],"li",{},"Email alerts (emails to users when they are added to teams etc)",[23,27,28],{},"HTTPS access to the install",[23,30,31,32,37],{},"FlowFuse ",[33,34,36],"a",{"href":35},"\u002Fdocs\u002Fuser\u002Fconcepts\u002F#device","Device"," deployment via the included MQTT server that comes in our Docker build",[10,39,40,41,44],{},"We will follow up with a second article covering the process of getting HTTPS running then we will close out the series by covering how to use key features of FlowFuse including ",[33,42,43],{"href":35},"Devices",".",[46,47,49],"h1",{"id":48},"prerequisites","Prerequisites",[20,51,52,55,58,61],{},[23,53,54],{},"A domain name - We've registered flowforge-demo.com to demonstrate these steps",[23,56,57],{},"A DNS provider - Our Domain registrar provides a basic DNS service for free",[23,59,60],{},"A GCP account - Google will often give you free service credits on sign up so setting up FlowFuse on GCP should not cost you anything for at least a few weeks",[23,62,63],{},"An email provider which will allow SMTP connections to send email - To manage users on your FlowFuse platform you will need to be able to send emails to them. We have used a Google Workspace account for this purpose",[46,65,67],{"id":66},"gcp-vm-creation","GCP VM Creation",[10,69,70,71,44],{},"Create a GCP account, once logged in navigate to Compute Engine then VM Instances. Select Create Instance you should now be ",[33,72,76],{"href":73,"rel":74},"https:\u002F\u002Fconsole.cloud.google.com\u002Fcompute\u002FinstancesAdd?project",[75],"nofollow","here",[10,78,79],{},"Give your instance a name, select a Region and Zone. I have found that the default machine configuration works fine but depending on your project you may wish to change the resources.",[10,81,82],{},[83,84],"img",{"alt":85,"src":86,"title":87},"\"Screenshot showing the interface for creating GCP VM\"","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F1.png","Screenshot showing the interface for creating GCP VM",[10,89,90],{},"You now need to allow access to your FlowFuse installation from the internet. In the Firewall section tick Allow HTTP traffic and Allow HTTPS traffic.",[10,92,93],{},[83,94],{"alt":95,"src":96,"title":97},"\"Screenshot showing the firewall section in the interface for creating a GCP VM\"","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F2.png","Screenshot showing the firewall section in the interface for creating a GCP VM",[10,99,100],{},"Next up, assign a static IP address to the VM. Click Advanced options, then Networking. Now scroll down until you see Network interfaces and click on default to expand that section. In External IPv4 address select Create IP Address, give it a name than press Reserve.",[10,102,103],{},[83,104],{"alt":105,"src":106,"title":107},"\"Screenshot showing the network section in the interface for creating a GCP VM\"","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F3.png","Screenshot showing the network section in the interface for creating a GCP VM",[10,109,110],{},"Once you have reserved your IP it will be shown in the External IPv4 address field, write it down as we will need it later to create the DNS records. Our IP address was 34.125.156.130.",[10,112,113],{},[83,114],{"alt":115,"src":116,"title":117},"\"Screenshot showing your reserved IP in the External IPv4 address field\"","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F4.png","Screenshot showing your reserved IP in the External IPv4 address field",[10,119,120],{},"You are now ready to create and boot your VM, scroll to the bottom of the page and press Create. It can take a minute or two for the VM to be ready to use.",[46,122,124],{"id":123},"dns-set-up","DNS Set Up",[10,126,127],{},"So that you can run FlowFuse on your newly created GCP VM you will need to set up 2 DNS records. These records are slightly different to what is suggested in the FlowFuse install docs. We were keen to be able to run other services on this domain so we set up the following records.",[10,129,130],{},[83,131],{"alt":132,"src":133,"title":132},"Screenshot showing interface for setting DNS","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F5.png",[10,135,136,137,141],{},"DNS changes need to propagate, and depending on your DNS provider, ISP, and other factors, this can take anywhere between a few seconds to 4 hours. Our’s were in place very quickly. To validate the DNS records you can use ",[138,139,140],"code",{},"dig"," on either a Mac or Linux.",[10,143,144],{},[83,145],{"alt":146,"src":147,"title":146},"Screenshot showing output of the dig command","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F6.png",[10,149,150],{},"The DNS records are set to the IP record we noted down earlier, so we're good to continue.",[46,152,154],{"id":153},"flowfuse-docker-installation","FlowFuse Docker Installation",[10,156,157],{},"The next step is to install Docker on our GCP VM. If you return to GCP you should see that your VM is now up and running, you can now click on SSH to connect to your VM. This will open up a browser based SSH session to your VM.",[10,159,160],{},[83,161],{"alt":162,"src":163,"title":162},"Screenshot showing access to SSH in GCP","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F7.png",[10,165,166],{},"Once you have a Secure Shell (SSH) session open, the first step is to install Docker using the following commands.",[10,168,169],{},[138,170,171],{},"sudo apt-get update",[173,174,179],"pre",{"className":175,"code":177,"language":178},[176],"language-text","sudo apt-get install \\\n   ca-certificates \\\n   curl \\\n   gnupg \\\n   lsb-release\n","text",[138,180,177],{"__ignoreMap":181},"",[10,183,184],{},[138,185,186],{},"sudo mkdir -p \u002Fetc\u002Fapt\u002Fkeyrings",[10,188,189],{},[138,190,191],{},"curl -fsSL https:\u002F\u002Fdownload.docker.com\u002Flinux\u002Fdebian\u002Fgpg | sudo gpg --dearmor -o \u002Fetc\u002Fapt\u002Fkeyrings\u002Fdocker.gpg",[173,193,196],{"className":194,"code":195,"language":178},[176],"echo \\\n  \"deb [arch=$(dpkg --print-architecture) signed-by=\u002Fetc\u002Fapt\u002Fkeyrings\u002Fdocker.gpg] https:\u002F\u002Fdownload.docker.com\u002Flinux\u002Fdebian \\\n  $(lsb_release -cs) stable\" | sudo tee \u002Fetc\u002Fapt\u002Fsources.list.d\u002Fdocker.list > \u002Fdev\u002Fnull\n",[138,197,195],{"__ignoreMap":181},[10,199,200],{},[138,201,171],{},[10,203,204],{},[138,205,206],{},"sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin",[10,208,209,210,44],{},"You can read a lot more detail about what each these commands actually do ",[33,211,76],{"href":212,"rel":213},"https:\u002F\u002Fdocs.docker.com\u002Fengine\u002Finstall\u002Fdebian\u002F",[75],[46,215,217],{"id":216},"download-flowfuses-latest-docker-build","Download FlowFuse’s latest Docker build",[10,219,220],{},"The next step is to get the codebase for FlowFuse onto your VM, to do so you will need to run the following commands. Please note that we are working with our 0.10.0 build, you will need to update the version number in the commands below if you are working with a newer build.",[10,222,223],{},"Use curl to download the files we need.",[10,225,226],{},[138,227,228],{},"sudo curl -L https:\u002F\u002Fgithub.com\u002FFlowFuse\u002Fdocker-compose\u002Farchive\u002Frefs\u002Ftags\u002Fv0.10.1.tar.gz -o v0.10.1.tar.gz",[10,230,231],{},"Make the directory where we will store FlowFuse.",[10,233,234],{},[138,235,236],{},"sudo mkdir \u002Fopt\u002Fflowforge",[10,238,239],{},"Uncompress FlowFuse and save it to the directory.",[10,241,242],{},[138,243,244],{},"sudo tar zxf v0.10.1.tar.gz --directory \u002Fopt\u002Fflowforge",[10,246,247,248,251],{},"You should now have all the code you need for FlowFuse in the directory ",[138,249,250],{},"\u002Fopt\u002Fflowforge\u002Fdocker-compose-0.10.1",", it should look something like this.",[10,253,254],{},[83,255],{"alt":256,"src":257,"title":258},"\"Screenshot showing directory listing for FlowFuse\"","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F8.png","Screenshot showing directory listing for FlowFuse",[46,260,262],{"id":261},"configure-flowfuse","Configure FlowFuse",[10,264,265],{},"We can now configure FlowFuse on your VM. We are going to need to edit two files. Firstly we need to switch into the directory where we just placed FlowFuse.",[10,267,268],{},[138,269,270],{},"cd \u002Fopt\u002Fflowforge\u002Fdocker-compose-0.10.1",[10,272,273],{},"Then we need to edit the flowforge.yml file, we're using Nano to do that.",[10,275,276],{},[138,277,278],{},"sudo nano \u002Fopt\u002Fflowforge\u002Fdocker-compose-0.10.1\u002Fetc\u002Fflowforge.yml",[10,280,281],{},"At the top of the file you need to update the domain and base_url to match your domain",[10,283,284],{},[83,285],{"alt":286,"src":287,"title":288},"\"Screenshot showing domain configuration in flowforge.yml\"","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F9.png","Screenshot showing domain configuration in flowforge.yml",[10,290,291],{},"Next we will need to edit the Email Configuration section to match your SMTP provider. Set enabled to true then add in the details provider by your email provider. For example in this case I am using our Google Workspace account.",[10,293,294],{},[83,295],{"alt":296,"src":297,"title":298},"\"Screenshot showing email configuration in flowforge.yml\"","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F10.png","Screenshot showing email configuration in flowforge.yml",[10,300,301,302,305],{},"Finally, you need to update the ",[138,303,304],{},"public_url"," for your mqtt broker to match your DNS record.",[10,307,308],{},[83,309],{"alt":310,"src":311,"title":312},"\"Screenshot showing MQTT configuration in flowforge.yml\"","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F11.png","Screenshot showing MQTT configuration in flowforge.yml",[10,314,315],{},"You can now save and close that file, in Nano you can do that by pressing ‘control x’ then ‘y’ then the Return key.",[10,317,318,319,322],{},"Now we need to edit the ",[138,320,321],{},"docker-compose.yml"," file. We will use Nano again to do that.",[10,324,325],{},[138,326,327],{},"sudo nano \u002Fopt\u002Fflowforge\u002Fdocker-compose-0.10.1\u002Fdocker-compose.yml",[10,329,330],{},"We need to edit the file to add in to the domain as follows.",[10,332,333],{},[83,334],{"alt":335,"src":336,"title":337},"\"Screenshot showing virtual hosts configuration in docker-compose.yml\"","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F12.png","Screenshot showing virtual hosts configuration in docker-compose.yml",[10,339,340],{},"Save and exit from that file, in Nano you can do that by pressing ‘control x’ then ‘y’ then the Return key.",[46,342,344],{"id":343},"start-flowfuse","Start FlowFuse",[10,346,347],{},"We are now ready to start up FlowFuse for the first time, to do so we will use the following command.",[10,349,350],{},[138,351,352],{},"sudo docker compose -p flowforge up -d",[10,354,355],{},"The build process will take a few minutes, once it’s completed let’s make sure all the docker containers are running.",[10,357,358],{},[138,359,360],{},"sudo docker ps",[10,362,363],{},[83,364],{"alt":365,"src":366},"Docker PS output","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F13.png",[10,368,369],{},"You should see 4 running Docker containers.",[10,371,372],{},"If everything went well you should now be able to access your FlowFuse server via the DNS record you created.",[10,374,375],{},[83,376],{"alt":377,"src":378},"FF Login page","\u002Fblog\u002F2022\u002F10\u002Fimages\u002F14.png",[10,380,381],{},"Nice, you now have a working instance of FlowFuse running on GCP but remember that all traffic is currently running on HTTP so we still have some work to do.",[10,383,384],{},"In the next article we will cover how to add HTTPS support to this FlowFuse installation.",{"title":181,"searchDepth":386,"depth":386,"links":387},2,[],"md",{"navTitle":5,"excerpt":390},{"type":7,"value":391},[392],[10,393,12],{},true,"\u002Fblog\u002F2022\u002F10\u002Fff-docker-gcp",{"title":5,"description":12},"blog\u002F2022\u002F10\u002Fff-docker-gcp","HvQatvEwi0zx2Qk0hO6z0pMAXuOQjCp9cMJGbXqpfkI",1780070549941]