Prechádzať zdrojové kódy

0813: Running Healthchecks - A Cron Job Monitoring Service - In Docker

i12bretro 10 mesiacov pred
rodič
commit
73e1ca7c29
1 zmenil súbory, kde vykonal 119 pridanie a 0 odobranie
  1. 119 0
      0813.html

+ 119 - 0
0813.html

@@ -0,0 +1,119 @@
+    <!DOCTYPE html>
+    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
+      <head>
+        <title>Running Healthchecks - A Cron Job Monitoring Service - In Docker</title>
+        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+        <meta charset="UTF-8">
+        <meta name="keywords" content="Homelab,Install Guide,Linux,Ubuntu,Home Lab Ideas,Home Lab,Healthchecks Cron Monitor,Healthchecks,Healthcheck Install Guide,Debian,Cron Monitor,Cron Job Monitor,Cron Job,Cron,Docker,Docker Container,Docker How To,Docker Made Easy,Docker Simplified,Docker Tutorial,How To,Tutorial,i12bretro">
+        <meta name="author" content="i12bretro">
+        <meta name="description" content="Running Healthchecks - A Cron Job Monitoring Service - In Docker">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0">
+        <meta name="revised" content="07/28/2024 06:48:04 AM" />
+				          <link rel="icon" type="image/x-icon" href="includes/favicon.ico">
+				  <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
+				        <script type="text/javascript" src="includes/js/steps.js"></script>
+        <link href="css/steps.css" rel="stylesheet" type="text/css" />
+      </head>
+      <body>
+        <div id="gridContainer">
+          <div class="topMargin"></div>
+          <div id="listName" class="topMargin">
+            <h1>Running Healthchecks - A Cron Job Monitoring Service - In Docker</h1>
+          </div>
+          <div></div>
+          <div id="content">
+          <h2>What is Healthchecks?</h2>
+
+<blockquote>
+<p><em>Healthchecks is a cron job monitoring service. It listens for HTTP requests and email messages (&quot;pings&quot;) from your cron jobs and scheduled tasks (&quot;checks&quot;). When a ping does not arrive on time, Healthchecks sends out alerts.</em></p>
+
+<p><em>Healthchecks comes with a web dashboard, API, 25+ integrations for delivering notifications, monthly email reports, WebAuthn 2FA support, team management features: projects, team members, read-only access.</em><em> -<a href="https://github.com/healthchecks/healthchecks" target="_blank">https://github.com/healthchecks/healthchecks</a></em></p>
+</blockquote>
+
+<h2>Installing Docker</h2>
+
+<ol>
+	<li>Log into the Linux based device</li>
+	<li>Run the following commands in the terminal
+	<div class="codeBlock"># install prerequisites<br />
+	sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y<br />
+	# add docker gpg key<br />
+	curl -fsSL https://download.docker.com/linux/$(awk -F&#39;=&#39; &#39;/^ID=/{ print $NF }&#39; /etc/os-release)/gpg | sudo apt-key add -<br />
+	# add docker software repository<br />
+	sudo add-apt-repository &quot;deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F&#39;=&#39; &#39;/^ID=/{ print $NF }&#39; /etc/os-release) $(lsb_release -cs) stable&quot;<br />
+	# install docker<br />
+	sudo apt install docker-ce docker-compose containerd.io -y<br />
+	# enable and start docker service<br />
+	sudo systemctl enable docker &amp;&amp; sudo systemctl start docker<br />
+	# add the current user to the docker group<br />
+	sudo usermod -aG docker $USER<br />
+	# reauthenticate for the new group membership to take effect<br />
+	su - $USER</div>
+	</li>
+</ol>
+
+<h2>Running the Healthchecks Container</h2>
+
+<ol>
+	<li>Now that Docker is installed, run the following commands to setup the Healthchecks Docker container and run it
+	<div class="codeBlock"># create working directories<br />
+	mkdir ~/docker/postresql -p &amp;&amp; mkdir ~/docker/healthchecks -p<br />
+	# create containers network<br />
+	docker network create containers<br />
+	# download the base configuration<br />
+	wget -O ~/docker/healthchecks/.env https://raw.githubusercontent.com/healthchecks/healthchecks/master/docker/.env.example<br />
+	# generate a 32 character random string<br />
+	head /dev/urandom | LC_ALL=C tr -dc &#39;A-Za-z0-9&#39; | head -c 32<br />
+	# copy the output string to the clipboard<br />
+	# edit the .env file<br />
+	nano ~/docker/healthchecks/.env</div>
+	</li>
+	<li>Scroll through the .env file, updating at least the key/value pairs listed below
+	<p>ALLOWED_HOSTS=*<br />
+	---<br />
+	DB=postgres<br />
+	DB_HOST=postgres<br />
+	DB_NAME=healthchecks<br />
+	DB_PASSWORD=He@lt4Ch3ck$!<br />
+	DB_USER=healthchecks_rw<br />
+	---<br />
+	DEFAULT_FROM_EMAIL=healthchecks@i12bretro.local<br />
+	---<br />
+	EMAIL_HOST=smtp.i12bretro.local<br />
+	EMAIL_HOST_PASSWORD=<br />
+	EMAIL_HOST_USER=<br />
+	EMAIL_PORT=25<br />
+	EMAIL_USE_TLS=False<br />
+	EMAIL_USE_VERIFICATION=False<br />
+	---<br />
+	SECRET_KEY=&lt;% random string from clipboard %&gt;</p>
+	</li>
+	<li>Press CTRL+W and search for localhost</li>
+	<li>Update all references to localhost with the DNS or IP address of the docker host (ie SITE_ROOT=http://localhost:8000 -&gt; http://ubuntuserver.local:8000)</li>
+	<li>Press CTRL+O, Enter, CTRL+X to write the changes to .env</li>
+	<li>Continue with the following commands in terminal
+	<div class="codeBlock"># set owner of working directories<br />
+	sudo chown &quot;$USER&quot;:&quot;$USER&quot; ~/docker -R<br />
+	# run the postgresql docker container<br />
+	docker run -d --name postgres -e POSTGRES_USER=healthchecks_rw -e POSTGRES_PASSWORD=&#39;He@lt4Ch3ck$!&#39; -e POSTGRES_DB=healthchecks -v /home/$USER/docker/postresql:/var/lib/postgresql/data --network containers --restart=unless-stopped postgres<br />
+	# run the healthchecks container<br />
+	docker run -d --name healthchecks --env-file ~/docker/healthchecks/.env -p 8000:8000 --network containers --restart=unless-stopped healthchecks/healthchecks<br />
+	# connect to healthchecks container shell<br />
+	docker exec -ti healthchecks /bin/bash<br />
+	# create an admin user<br />
+	/opt/healthchecks/manage.py createsuperuser<br />
+	# enter an email address<br />
+	# enter and confirm a password<br />
+	# exit the container shell<br />
+	exit</div>
+	</li>
+	<li>Open a web browser and navigate to http://DNSorIP:8000</li>
+	<li>Login with the admin account created earlier</li>
+	<li>Welcome to HealthChecks</li>
+</ol>
+
+<p>Documentation: <a href="https://hub.docker.com/r/healthchecks/healthchecks" target="_blank">https://hub.docker.com/r/healthchecks/healthchecks</a></p>          </div>
+        </div>
+      </body>
+    </html>
+