Ok so I made this post and podcast last week but a lot changed. First, after I got everything working it all fell apart after 24 hours. SSD died and I had to order a new one. I got a 2TB spinning USB 3.0 drive and still had to do do Ubuntu 20.10.
Also, my revised LSIO documentation was Accepted and MERGED!! Hooray, first big LL win!
As I was setting up new things, I stumbled across a redditor asking for help with SWAG and NextCloud. They said they were using LSIO documentation and were stuck so I figured this was a great lemming moment. Over the next few hours, I was able to help the individual! Hooray! Hopefully they get involved in the linuxlemming!
Second thing that occurred, is that I opened a pull request on github for the LSIO documentation.
I have heard people talk about using an external USB drive rather than a SD card with the Pi4. This was kinda hacky a year or so ago but apparently things have been ironed out. In order to do this, you need to flash the latest RaspberryPiOS and update the firmware first. After that, you should be good to go to use an external drive (or so I assumed)
I tried flashing Ubuntu Server 20.04 using Etcher but when booting, I was getting an error that ethernet wasn’t being dectected. I had a cable hooked up so I thought that maybe it was a bad flash. Did it again and got the same error.
So then I switched to the RaspberryPi Imager app and repeated the proccess but let the app download the image and flash it. This time it dectected ether net, but didn’t recognize a boot environment variable.
Arg
So now I went to google and searched for the specific error and came across this forum post. Apparently, this is a know issue with 20.04 and it’s debatable as to where it can be classified as a bug or not. The solution is to use 20.10, which I DIDN’T want but I guess I am out of options if I want to use an Ubuntu based server.
After reading this, I repeated the process with RaspberryPi Imager and chose Ubuntu Server 20.10 (64 bit). So far, this process has taken about ~45 minutes just to try to get the Pi to boot.
After plugging it in and booting SPOILER WARNING
I still didn’t have a booting pi.
Without clicking the spoiler tag you can guess my result. This time, I used RPImager to format, then flash. But in my haste I must have selected the DESKTOP image and not the server. But, guess what? It booted into the desktop so I guess that’s a win? Back to reformat and flashing the correct image.
Give me a break!!!! Still won’t work. TONS of errors in the output. Network time, network services, login, availability of block devices, etc.
Tried RaspberryPiOS and it locked out to a read only file system.
(ノಠ益ಠ)ノ彡┻━┻
Tried RaspberryPiOS again, but this time, I plugged it into a USB 2.0 slot.
it worked
(o_O)
So then I did Ubuntu 20.10 again and plugged it into a USB 2.0 slot.
it worked
( ͠° ͟ʖ ͡° )
Ok. So now I got Ubuntu up and running from the SSD on a USB 2.0 port. Time to make a new user.
I did the typical useradd rastacalavera
and chmod -a -G sudo rastacalavera
and figured everything was good.
NO. It wasn’t all GOOD
When I logged back in, there was no home directory and my user wasn’t using BASH. What the hell? Did something change recently? I recall when adding users in the past there was this whole interactive prompt where it wanted a room number and stuff like that. This method didn’t even give my user a password! I must be missing something. . .
So I logged back in as Ubuntu and gave my user a password allowed my user to use the BASH shell (easy google search shows how to do this).
Ok, time to start my project. I headed over to Linux Server to jump right into their documentation. I have used this in the past and would like to see a disclaimer that their guides assumes that you already have Docker and Docker-Compose installed on your machine. A lot of people who are getting into this are probably told to use images from Linux Server, but if they are complete noobs there are some crucial steps missing from their docs. So I think either they should include a disclaimer or add that information into the documentation.
I think it is probably out of scope for the project to walk a user through the installation steps and it’s appropriate to focus on just the service they provide.
So for my Ubuntu Installation I did the following steps:
sudo apt install docker.io docker-compose
sudo usermod -aG docker rastacalavera
Now my user should be set and I should be good to blindly follow the LS.io documentation.
Fist thing to do, is add some simple commands to the bash alias file
nano .bash_aliases
then paste in
# ~/.bash_aliases alias dtail='docker logs -tf --tail="50" "$@"'
This will help us view and exit the log files of the container without cancelling the execution of it.
Time to test docker
docker run hello-world
1
I really like that after this, they give a quick snippit of key vocabulary that the user should become familiar with.
Reading through, they must have changed their documentation since I last looked at it. I recall their old file structure being:
/opt/appdata/CONTAINER NAME/config
and now it appears that they recomment:
/home/user/appdata/heimdall:/config
which in my case will be:
/home/rastacalavera/appdata/heimdall:/config
In the PUID and PGID section, they include information on how to check these values. Since I created a new user, I figured that my values would not be 1000
and I am glad I checked:
rastacalavera@ubuntu:~$ id rastacalavera
showed me the value of:
uid=1001(rastacalavera) gid=1001(rastacalavera)
So in all of my compose files, I’ll need to change the default values for these.
Later on in the Volumes section, their documentation confirmed my memory.
I’ve used Traefik and NPM for reverse proxy and SSL certs in the past and never tried out LSIO’s approach. Last time I had a home server setup, it got fried and I hadn’t backed up any certs so I couldn’t get my sites back up with SSL again (it may have been possible, I just couldn’t figure it out easily).
Since this is all new and the point is to follow documentation, this will be a great fore into the LSIO SWAG container.
Getting it setup was painless. I just had to modify the following criteria in the docker-compose.yml
file. I included **
in the file so you can see what is changed. They would not be present in the actual file.
- PUID=**1001**
- PGID=**1001**
- TZ=America/Chicago
- URL=MY NO-IP Domain
- SUBDOMAINS=www
- VALIDATION=http
volumes:
- **/opt/appdata/swag/config:/config**
Then after running docker-compose up -d
and docker logs swag -f
I was able to see that it was working!
I figured that I should get VSCode up and running so that it can be accessed from anywhere if I so choose. I followed the LSIO documentation on the installation process and changed the variables in my docker-compose.yml
to fit my situation. This included added a custom sub domain for vscode and the variables for VScode itself. I also changed the file in /opt/appdata/swag/config/nginx/proxy-confs
to make sure that a reverse proxy was up and running.
I am not sure what I did incorrectly the first time, but I got this error:
ERROR: failed to register layer: Error processing tar file(exit status 1): write /usr/local/share/.config/yarn/global/node_modules/code-server/lib/vscode/out/vs/workbench/workbench.web.api.js.map: read-only file system
I was locked out of my system and couldn’t execute any commands. I had to do a hard shutdown and redo my docker-compose.yml
a second time and then everything worked as expected.
Aside from getting Ubuntu to run on the Pi, this process was fairly smooth.
I give LSIO a solid 10/10 in terms of documentation and may try to submit some suggestions up stream.
I think a pull request should be made to the General
section of their documentation. Something like this:
Are you completely new to Docker? If so, please see the official documentation on how to properly install docker for your OS. Be sure to follow the the Post Installation directions as well to make sure your user can execute docker commands.
In the Docker Compose section, it is odd that they return to the bashrc and bash_aliases file. I think it might be advantageous to have this sooner or to leave out the previous section.
If you get an error about permissions, you may need to log out and then log back in for the changes to take effect. Same thing applies to the addition of the bash_aliases ↩︎