#362 Wireguard and NextCloud on a Raspberry Pi = Marvelous (Docker, IOTstack)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
synchronizing saving and sharing data emails and contacts under our control based on open source software securely accessing our home network from everywhere in the world based on the most modern virtual private network technology with just a raspberry pi yes we want it today we will install nexcloud and wireguard on our raspberry pi and make it work together you will save a lot of time using the tricks presented in the next few minutes pretty youtubers here is the guy with the swiss accent with a new episode and fresh ideas around sensors and microcontrollers remember if you subscribe you will always sit in the first row in this video we will create a typical installation for a maker and his family or friends add a duck dns domain for remote access to our home network set up wireguard vpn on the raspberry and smartphones to make this access safe set up next cloud to share data attach a large disk to the pi and add it to nexcloud to store lots of data install nexcloud clients on smartphones and a windows pc and add all the glue between the components our final setup would look like that our raspberry pi will run at least four docker containers one for nexcloud one for mariadb and one for wireguard the cherry on the cake is partainer to manage the containers not needed for this project but very useful every time you use docker one or two disks are connected to the pi the ssd contains all system files and data if you want the second disk will be configured as a pure data disk both have to be connected to the blue usb3 connectors the pi is connected via your home network and your router to the internet it is accessed from there through a secure wireguard tunnel this tunnel needs a hole in your firewall because it is encrypted this is not a security risk through this tunnel your smartphone or pc can access the complete home network of course you can also create tunnels for your whole family or other people you trust these devices are called peers in wireguard because most of us do not pay for a fixed ip address our service provider can change it if you want this is why we need a service called duck dns here we can create a fixed domain for our router how does this work a small program on our raspberry calls stackdns from time to time like that doc dns knows our current ip address simple and free of charge if we call this address we always get a direct connection to our router maybe you think too complicated for me wait till the end of the video and decide then i promise it is easier than you think because the brave people from the iot stack project did the heavy lifting maybe you watch video number 352 first if you are interested in the possibilities of this project let's start with the work for today's project we need a raspberry pi 4 with at least 2 gigabyte memory a small ssd and if you want an additional usb drive like this one to store large amounts of data do not forget to check if the ssd boot is already working on your pi first copy raspberry os on an ssd and add the ssh file and the wpa supplicant.conf file if needed and update the os then follow the getting started from iot stack and using menu.sa to install docker if you intend to use remote access through wireguard it is now time to do these four things add a domain in duct dns add a chrome tab job on your pi open one port in your firewall for udp and create a file compose overwrite.yaml in the iot stack directory you can follow the write up in the iot stack wiki for duck dns and you find a link to the overall compose override yaml in the video description the only thing you are on your own is the port forwarding of port 51 820 on your router because every router is different i briefly go through these steps first i create a new domain on dac dns called connectme.dns.org i copy this token for the next step edit this file using nano now i have to enter this line in chrome tab this makes sure the pi calls stuck dns every 5 minutes done as a proof you should see your ip address in doc dns the port forwarding in my router is done by locking me in on my router and filling in these fields now we have to switch to the iot stack directory and create a new file called compose overwrite.yaml its content is like that important is how many peers you want to create each device like a smartphone or a pc counts as one peer it does not hurt if you create too many of them and here you have to enter your duck dns domain from before now we are ready to build the stack for today's video we select at least portainer ce next cloud mariadb and wireguard feel free to add other containers if you wish when you are finished with the menu.sh you find a dockercompose.yaml file in the iot stack directory most other videos show you the cheap solution using sqlite as a database for nexcloud which is not recommended by the development team as usual we want more and use the recommended mariadb this is why we had to add the mariadb container we again have to change the compose override yaml file change the passwords here and here and make sure they match you can leave them as is for a test setup of course these steps are not needed if you want to go with a simple version of nexcloud if you want to add a second disk drive you have to execute two additional steps add this line inside the compose override.yaml file mount your usb disk and set the right permissions i leave a link in the description where i show you how i did it after all this preparation we can start our containers with this command it takes a while till all containers are downloaded and installed as soon as everything is ready we can go to the ip address of our raspberry and port 9002 as we can see in pertainer everything is running smoothly and we can connect to nexcloud by entering the ip address of our raspberry and the port 9321 after adding credentials and select mariadb we are in like flynn we see the dashboard the files and photos cool first step accomplished if we install a next cloud pc client all these files are synchronized like with dropbox i will not cover all the other functions of nexcloud in this video you find other videos for that purpose we will continue with the hard stuff we still have a secure remote access on our list wireguard is already prepared and running we only have to install the wireguard app on our mobile and try to connect to our raspberry the tunnels are secured by keys which have to be exchanged between the wireguard server and the clients we could use the old-fashioned method and import a file with all the keys to our smartphone but we can go the modern way and scan a qr code instead but where is the qr code it is in these directories for each pier another one if you have a display connected to your raspberry it is simple just open the png file point the smartphone in its direction and the tunnel is ready to be used very nice if wireguard is on our smartphone is connected to our home network as if we were at home we even could watch geoblocked content if we are abroad a perfect preparation for our deferred holidays after the covet lockdowns as a next step we have to connect to next cloud at home via this tunnel the simplest way is using another qr code in settings security we can add a new app password display it as qr code and scan it with the next cloud app on the smartphone ready is the access from everywhere please do not forget to switch wireguard on if you are not connected to your wifi now we only have one small task left to enable the usage of our large disk for that we go to apps featured apps and enable external storage support now we have a new line in settings and we can add our disk do you remember disk 1 from our docker compose file here it is added as a local disk everything is ready to rumble you might ask how is the performance it is for sure not mind-boggling and probably not comparable with an ordinary nas but if you use an existing mechanical disk it is a very cheap solution particularly if you add a few more containers from the iot stack collection it is a excellent solution to share photos or other files with your family or share files among your devices for example to synchronize the photos from your smartphone unfortunately i did not find a client for a raspberry pi that would be very helpful for me as i often would like to share files with my iot devices maybe you know one and i did not find the possibility to share files with people outside my internal network i still have to use google drive for that maybe you know more about how to do that now you can decide if it is complicated and whether you want to try it summarized we created a safe remote access to our home network by creating a duck dns domain and setting up wireguard on a raspberry and on our smartphones we installed nextcloud and attached a large disk to the pi for lots of data we installed nexcloud clients on smartphones and a windows pc and you saw the small print which was needed to get these components working together as always you find all the relevant links in the description and if i find the time even a write-up of all commands in a blog post i hope this video was useful or at least interesting for you if true please consider supporting the channel to secure its future existence thank you bye
Info
Channel: Andreas Spiess
Views: 98,948
Rating: undefined out of 5
Keywords: arduino, arduino project, beginners, diy, do-it-yourself, eevblog, electronics, esp32, esp32 datasheet, esp32 project, esp32 tutorial, esp32 weather station, esp8266, esp8266 datasheet, esp8266 project, greatscott, guide, hack, hobby, how to, iot, lorawan, nodemcu, project, simple, smart home, ttgo, wemos, wifi, docker, wireguard, nextcloud, raspberry pi, dropbox
Id: 7Pe-Cv0tnLs
Channel Id: undefined
Length: 12min 35sec (755 seconds)
Published: Sun Nov 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.