Selaa lähdekoodia

Merge pull request #18 from novaspirit/beta

Beta
don 3 vuotta sitten
vanhempi
commit
92e9b165a4
4 muutettua tiedostoa jossa 88 lisäystä ja 27 poistoa
  1. 22 18
      docs/README.md
  2. 21 3
      install_docker.sh
  3. 23 2
      install_portainer.sh
  4. 22 4
      update_portainer.sh

+ 22 - 18
Readme.md → 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)
+This repository is a collection of tutorials for hosting a variety of server applications using Docker and [Portainer](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
-
-### App Template for Portainer.io
+### App Template for Portainer
 ![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
+```
+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 |
 | ------------- | ------------- |
 | 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

+ 21 - 3
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."

+ 23 - 2
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!"
 

+ 22 - 4
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!"