From 83188c7b08567cc1bc2b0f81c169ad75a048181a Mon Sep 17 00:00:00 2001 From: Ryan Fortner <71036629+ryanfortner@users.noreply.github.com> Date: Wed, 6 Oct 2021 09:09:28 -0400 Subject: [PATCH 1/6] Update and rename Readme.md to docs/README.md --- Readme.md => docs/README.md | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) rename Readme.md => docs/README.md (50%) diff --git a/Readme.md b/docs/README.md similarity index 50% rename from Readme.md rename to docs/README.md index 73941b5..7fcfe79 100644 --- a/Readme.md +++ b/docs/README.md @@ -1,37 +1,41 @@ # Pi-Hosted Portainer Template V2 -[![Discord](https://img.shields.io/discord/316245914987528193?logo=discord)](https://discord.com/invite/v8dAnFV) [![Youtube](https://img.shields.io/badge/YouTube-FF0000?style=flat-square&logo=youtube&logoColor=white)](https://www.youtube.com/channel/UCrjKdwxaQMSV_NDywgKXVmw) [![Twitter URL](https://img.shields.io/twitter/follow/novaspirittech?style=flat-square&logo=twitter)](https://twitter.com/novaspirittech) +[![Discord](https://img.shields.io/discord/316245914987528193?logo=discord)](https://discord.com/invite/v8dAnFV) [![Youtube](https://img.shields.io/badge/YouTube-FF0000?style=flat-square&logo=youtube&logoColor=white)](https://www.youtube.com/channel/UCrjKdwxaQMSV_NDywgKXVmw) [![Twitter URL](https://img.shields.io/twitter/follow/novaspirittech?style=flat-square&logo=twitter)](https://twitter.com/novaspirittech) [![hacktoberfest](https://img.shields.io/badge/hacktoberfest-friendly-orange)](https://hacktoberfest.digitalocean.com) -This git is a collection of tutorials for docker / portainer made using raspberry pi / arm also hosting a ARM based App Template for [Portainer.io](https://github.com/portainer/portainer) - -install_docker.sh -> this script will install docker and add user pi to the docker group - -install_portainer.sh -> this script will install portainer +This repository is a collection of tutorials for hosting a variety of server applications using Docker and [Portainer](https://github.com/portainer/portainer). ### App Template for Portainer.io ![alt text](https://github.com/novaspirit/pi-hosted/blob/main/apptemplate.png?raw=true) +### Installation +Run `install-docker.sh`, to install docker, and add the user pi to the docker usergroup. +``` +wget -qO- https://git.io/JwUkc | bash +# need to reboot/logout for changes to take effect +sudo reboot +``` +After a reboot, run `install-portainer.sh`, to install Portainer.io +``` +wget -qO- https://git.io/JwUnf | bash +# to update portainer, run this command +wget -qO- https://git.io/JwUlY | bash +``` +After installing Portainer, open the web browser of your choice and visit http://:9000/ (you'll need to be on the same network as the Pi). Go ahead and set up Portainer, choose a username and password and log in. + + + #### Versions | Application | URL | | ------------- | ------------- | | Portainer v2 | https://raw.githubusercontent.com/novaspirit/pi-hosted/main/pi-hosted_template/template/portainer-v2.json | -#### Installing - -1. Login to the Web-UI for the corresponding project. -2. Navigate to the area where you add a template (in portainer you'll need to enable external templates) -3. Add the template URL corresponding to the application you're using in the table above. - - -### Pi-hosted Youtube series - -Youtube Playlist +### Pi-Hosted YouTube series [![Pi-Hosted Playlist](https://i.ytimg.com/vi/cO2-gQ09Jj0/hqdefault.jpg?sqp=-oaymwEXCNACELwBSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLAfgdX8HlHas2CddSmgwJzergnTzQ)](https://www.youtube.com/watch?v=cO2-gQ09Jj0&list=PL846hFPMqg3jwkxcScD1xw2bKXrJVvarc) ### Contributors -See List of [contributors](https://github.com/novaspirit/pi-hosted/graphs/contributors) who participated in this project. +See the list of [contributors](https://github.com/novaspirit/pi-hosted/graphs/contributors) who participated in this project. ### Acknowledgment * based template on [SelfHosted](https://github.com/SelfhostedPro/selfhosted_templates) Portainer App Template From e49968b41c4b68b7487f3ba17a9d59daea86eef0 Mon Sep 17 00:00:00 2001 From: Ryan Fortner <71036629+ryanfortner@users.noreply.github.com> Date: Wed, 6 Oct 2021 10:20:20 -0400 Subject: [PATCH 2/6] Update README.md --- docs/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/README.md b/docs/README.md index 7fcfe79..fd71d35 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,7 +4,7 @@ This repository is a collection of tutorials for hosting a variety of server applications using Docker and [Portainer](https://github.com/portainer/portainer). -### App Template for Portainer.io +### App Template for Portainer ![alt text](https://github.com/novaspirit/pi-hosted/blob/main/apptemplate.png?raw=true) ### Installation @@ -20,9 +20,6 @@ wget -qO- https://git.io/JwUnf | bash # to update portainer, run this command wget -qO- https://git.io/JwUlY | bash ``` -After installing Portainer, open the web browser of your choice and visit http://:9000/ (you'll need to be on the same network as the Pi). Go ahead and set up Portainer, choose a username and password and log in. - - #### Versions | Application | URL | From 9c8bfde646d1558d25b1626c1d8f111cd4bd391e Mon Sep 17 00:00:00 2001 From: Ryan Fortner <71036629+ryanfortner@users.noreply.github.com> Date: Wed, 6 Oct 2021 10:24:30 -0400 Subject: [PATCH 3/6] Update README.md --- docs/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/README.md b/docs/README.md index fd71d35..79f19fd 100644 --- a/docs/README.md +++ b/docs/README.md @@ -20,6 +20,9 @@ wget -qO- https://git.io/JwUnf | bash # to update portainer, run this command wget -qO- https://git.io/JwUlY | bash ``` +Click Settings, in the bottom-left corner, and paste the Portainer v2 json file link from below into the "App Templates" box. + +You're done! Now just click App Templates and deploy applications! #### Versions | Application | URL | From 14ec2d8fc7ba4ac77f7e8197d3a02afcab0dde1c Mon Sep 17 00:00:00 2001 From: Ryan Fortner <71036629+ryanfortner@users.noreply.github.com> Date: Wed, 6 Oct 2021 10:29:59 -0400 Subject: [PATCH 4/6] added error & check_internet functions to updater --- update_portainer.sh | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/update_portainer.sh b/update_portainer.sh index 4b852a7..832da1f 100644 --- a/update_portainer.sh +++ b/update_portainer.sh @@ -1,8 +1,26 @@ #!/bin/bash + +function error { + echo -e "\\e[91m$1\\e[39m" + exit 1 +} + +function check_internet() { + printf "Checking if you are online..." + wget -q --spider http://github.com + if [ $? -eq 0 ]; then + echo "Online. Continuing." + else + error "Offline. Go connect to the internet then run the script again." + fi +} + +check_internet + portainer_pid=`docker ps | grep portainer-ce | awk '{print $1}'` portainer_name=`docker ps | grep portainer-ce | awk '{print $2}'` -sudo docker stop $portainer_pid -sudo docker rm $portainer_pid -sudo docker rmi $portainer_name -sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest +sudo docker stop $portainer_pid || error "Failed to stop portainer!" +sudo docker rm $portainer_pid || error "Failed to remove portainer container!" +sudo docker rmi $portainer_name || error "Failed to remove/untag images from the container!" +sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest || error "Failed to execute newer version of Portainer!" From 640ddff58da84b29399ee5bc0e9bf1814521490d Mon Sep 17 00:00:00 2001 From: Ryan Fortner <71036629+ryanfortner@users.noreply.github.com> Date: Wed, 6 Oct 2021 10:34:55 -0400 Subject: [PATCH 5/6] add error and check_internet functions to installer --- install_docker.sh | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/install_docker.sh b/install_docker.sh index d3b4e24..088e7e9 100755 --- a/install_docker.sh +++ b/install_docker.sh @@ -1,4 +1,22 @@ #!/bin/sh -curl -sSL https://get.docker.com | sh -sudo usermod -aG docker $USER -echo "remember to logoff to take effect" + +function error { + echo -e "\\e[91m$1\\e[39m" + exit 1 +} + +function check_internet() { + printf "Checking if you are online..." + wget -q --spider http://github.com + if [ $? -eq 0 ]; then + echo "Online. Continuing." + else + error "Offline. Go connect to the internet then run the script again." + fi +} + +check_internet + +curl -sSL https://get.docker.com | sh || error "Failed to install Docker." +sudo usermod -aG docker $USER || error "Failed to add user to the Docker usergroup." +echo "Remember to logoff/reboot for the changes to take effect." From 23ffae3d86e8a4565061c55fdfa44efb708dc16b Mon Sep 17 00:00:00 2001 From: Ryan Fortner <71036629+ryanfortner@users.noreply.github.com> Date: Wed, 6 Oct 2021 10:35:41 -0400 Subject: [PATCH 6/6] Update install_portainer.sh --- install_portainer.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/install_portainer.sh b/install_portainer.sh index 17b02fe..1d4efed 100755 --- a/install_portainer.sh +++ b/install_portainer.sh @@ -1,4 +1,25 @@ #!/bin/sh -sudo docker pull portainer/portainer-ce:latest -sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest + + +#!/bin/sh + +function error { + echo -e "\\e[91m$1\\e[39m" + exit 1 +} + +function check_internet() { + printf "Checking if you are online..." + wget -q --spider http://github.com + if [ $? -eq 0 ]; then + echo "Online. Continuing." + else + error "Offline. Go connect to the internet then run the script again." + fi +} + +check_internet + +sudo docker pull portainer/portainer-ce:latest || error "Failed to pull latest Portainer docker image!" +sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest || error "Failed to run Portainer docker image!"