Browse Source

more mascot and remove mac shell script installer

master
forest 3 days ago
parent
commit
a1562d5a6c
12 changed files with 19 additions and 289 deletions
  1. +2
    -2
      frontend/about-dns.gotemplate.html
  2. +1
    -1
      frontend/alpha-profile.gotemplate.html
  3. +9
    -9
      frontend/install-linux.gotemplate.html
  4. +1
    -2
      frontend/static/greenhouse.css
  5. +3
    -1
      frontend/static/image-sources/generate_webp.sh
  6. BIN
      frontend/static/images/information.webp
  7. BIN
      frontend/static/images/mascot-angry.webp
  8. BIN
      frontend/static/images/mascot-reading.webp
  9. +0
    -271
      frontend/static/install-mac.sh
  10. +0
    -0
      frontend/static/install.sh
  11. +0
    -0
      frontend/static/uninstall.sh
  12. +3
    -3
      frontend_howto.go

+ 2
- 2
frontend/about-dns.gotemplate.html View File

@ -29,7 +29,7 @@
</p>
<div class="warning admonition">
<div class="emoji-icon">
&#9888;&#65039; <!--&#9888;&#65039; yellow triangle exclamation point warning emoji-->
<img src="/static/images/mascot-angry.webp"/>
</div>
<p>
Note that you can only create a <code>CNAME</code> record for a <b>subdomain</b> on your domain name. According to
@ -46,7 +46,7 @@
<br/>
<div class="info admonition">
<div class="emoji-icon">
<img src="/static/images/information.webp"/>
<img src="/static/images/mascot-reading.webp"/>
</div>
<p>
A <b>domain name</b> is something that you have to register and pay for, like


+ 1
- 1
frontend/alpha-profile.gotemplate.html View File

@ -133,7 +133,7 @@
During the alpha test phase, we're only offering a shell script installer / uninstaller for linux.
</p>
<p>
<pre class="small install-command">curl https://greenhouse-alpha.server.garden/install-linux.sh | sudo sh</pre>
<pre class="small install-command">curl https://greenhouse-alpha.server.garden/install.sh | sudo sh</pre>
</p>
<div class="mascot admonition">


+ 9
- 9
frontend/install-linux.gotemplate.html View File

@ -21,11 +21,11 @@
During the alpha test phase, we're only offering a shell script installer / uninstaller.
</p>
<p>
<pre class="install-command">curl https://greenhouse-alpha.server.garden/install-linux.sh | sudo sh</pre>
<pre class="install-command">curl https://greenhouse-alpha.server.garden/install.sh | sudo sh</pre>
</p>
<div class="warning admonition">
<div class="mascot admonition">
<div class="emoji-icon">
&#9888;&#65039; <!--&#9888;&#65039; yellow triangle exclamation point warning emoji-->
<img src="/static/images/mascot-reading.webp"/>
</div>
<p>
This installer assumes your operating system uses <b>systemd</b>. <br/>
@ -41,7 +41,7 @@
</p>
</div>
<p>
The <code>install-linux.sh</code> script does four things:
The <code>install.sh</code> script does four things:
</p>
<ol>
<li>
@ -63,8 +63,8 @@
<p>
If you don't want to run the <code>curl ... | sudo sh</code> command, you can simply
<a href="https://git.sequentialread.com/forest/greenhouse/src/branch/master/frontend/static/install-linux.sh">
check out <code>install-linux.sh</code> from the source code repository</a> & review it yourself before running it.
<a href="https://git.sequentialread.com/forest/greenhouse/src/branch/master/frontend/static/install.sh">
check out <code>install.sh</code> from the source code repository</a> & review it yourself before running it.
</p>
@ -102,10 +102,10 @@
<h2 id="uninstaller">uninstalling the greenhouse client software</h2>
<p>
We've created an uninstaller script that undoes everything the installer script did.
Here is an uninstaller script that should undo everything the installer script did.
</p>
<p>
<pre class="install-command">curl https://greenhouse-alpha.server.garden/uninstall-linux.sh | sudo sh</pre>
<pre class="install-command">curl https://greenhouse-alpha.server.garden/uninstall.sh | sudo sh</pre>
</p>
<ol>
@ -195,7 +195,7 @@
</ol>
<p>
We recommend using the
<a href="https://git.sequentialread.com/forest/greenhouse/src/branch/master/frontend/static/install-linux.sh">
<a href="https://git.sequentialread.com/forest/greenhouse/src/branch/master/frontend/static/install.sh">
existing installer
</a> as a template. You will only have to change step 3, where it installs the service.
How you do this depends on your init system.


+ 1
- 2
frontend/static/greenhouse.css View File

@ -174,10 +174,9 @@ pre.flash.info {
.admonition.info code {
background-color: #753d3d08;
}
.admonition.mascot {
border-left-color: #00ffaa;
background: #aee7c1;
background: #e8ffc3;
}
.emoji-icon {


+ 3
- 1
frontend/static/image-sources/generate_webp.sh View File

@ -41,11 +41,13 @@ svgToWebp "free.svg" "$quality" "icon"
# svgToWebp "blah.svg" "$quality" "120" "105"
pngToWebp "mascot-laptop.png" "$lowerquality" "icon"
pngToWebp "mascot-reading.png" "$lowerquality" "icon"
pngToWebp "mascot-angry.png" "$lowerquality" "icon"
pngToWebp "beginner.png" "$quality" "icon"
pngToWebp "custodialcloud.png" "$lowerquality" "text"
pngToWebp "hybridcloud.png" "$lowerquality" "text"
pngToWebp "selfhost.png" "$lowerquality" "text"
pngToWebp "information.png" "$higherquality" "icon"
# pngToWebp "information.png" "$higherquality" "icon"
pngToWebp "macos.png" "$quality" "icon"
pngToWebp "namecheap-1.png" "$quality" "text"
pngToWebp "namecheap-2.png" "$quality" "text"


BIN
frontend/static/images/information.webp View File

Before After

BIN
frontend/static/images/mascot-angry.webp View File

Before After

BIN
frontend/static/images/mascot-reading.webp View File

Before After

+ 0
- 271
frontend/static/install-mac.sh View File

@ -1,271 +0,0 @@
#!/bin/sh
aborted_header()
{
printf "\n"
printf "Installer aborted because: \n"
printf "\n"
}
footer_with_url()
{
printf "\n"
printf "See: https://greenhouse-alpha.server.garden/install-greenhouse-client-software-mac\n"
printf "\n"
}
if [ "$(id -u)" -ne 0 ]; then
aborted_header
printf "This script is running as the user: %s\n" "$(id)"
printf "\n"
printf "Please run this script as the root user (for example, with sudo).\n"
printf "\n"
printf "This is required because the script needs to create a user account for\n"
printf "the greenhouse-daemon and install the daemon so it runs automatically \n"
printf "after your computer starts up.\n"
footer_with_url
exit 1
fi
if ! uname > /dev/null 2>&1 ; then
aborted_header
printf "uname command failed. Unable to determine your operating system or CPU architechture.\n"
printf "\n"
printf "This should never happen, it is a bug!\n"
printf "\n"
exit 1
fi
operating_system="$(uname)"
if [ "$operating_system" != "Darwin" ]; then
aborted_header
printf "Your operating system '%s' is unknown or not supported yet.\n" "$operating_system"
printf "Currently this installer only supports 'Darwin', also known as MacOS.\n"
printf "\n"
printf "This should probably never happen, if you are running on a mac, then this is a bug!\n"
printf "\n"
footer_with_url
exit 1
fi
# https://blog.smittytone.net/2021/02/07/how-to-migrate-to-native-homebrew-on-an-m1-mac/
cpu_architechture="$(uname -p)"
pkg_arch="amd64"
if [ "$cpu_architechture" = "arm" ]; then
pkg_arch='arm64';
fi
check_command_exists()
{
command_name=$1
if ! command -v "$command_name" > /dev/null 2>&1 ; then
aborted_header
printf "Did not find the %s command on your computer.\n" "$command_name"
printf "\n"
printf "%s is required in order to run this installer.\n" "$command_name"
printf "You should probably install it via your operating system's package manager.\n"
footer_with_url
exit 1
fi
}
check_command_exists curl
check_command_exists gzip
check_command_exists shasum
## at this point we have checked everything we need to check to ensure that the instal should go off without a hitch.
## next up are the functions related to installation, then the installation itself
printf "\npreflight checks passed\n\n"
update_binary()
{
binary_target_directory="$1"
file_name="$2"
binary_name="$3"
binary_version="$4"
binary_arch="$5"
sha256sum_output="$6 $binary_target_directory/$binary_name"
if ! printf "%s" "$sha256sum_output" | shasum -a 256 -c > /dev/null 2>&1 ; then
printf "Downloading %s binary...\n" "$binary_name"
picopublish_url="https://picopublish.sequentialread.com/files"
download_url="$picopublish_url/$file_name-$binary_version-linux-$binary_arch.gz"
temporary_gzip_file="/tmp/greenhouse-install-$file_name.gz"
curl_log_file="/tmp/greenhouse-install-download-$file_name.log"
curl --silent --show-error --output "$temporary_gzip_file" "$download_url" > "$curl_log_file" 2>&1
gzip --stdout --decompress "$temporary_gzip_file" > "$binary_target_directory/$binary_name"
rm "$temporary_gzip_file"
if ! printf "%s" "$sha256sum_output" | shasum -a 256 -c ; then
aborted_header
printf "Downloading %s binary failed.\n" "$binary_name"
printf "Expected hash: %s\n" "$daemon_sha256"
printf "Got hash: %s\n" "$(shasum -a 256 "$binary_target_directory/$binary_name")"
printf "\n"
printf "curl URL was: %s\n\n" "$download_url"
printf "curl output was:\n"
cat "$curl_log_file"
printf "\n\n\n"
fi
fi
}
# check if the greenhouse-daemon user already exists, and add it if it doesn't
if ! id -u greenhouse-daemon > /dev/null 2>&1 ; then
useradd greenhouse-daemon
fi
mkdir -p /opt/greenhouse-daemon
chown greenhouse-daemon:greenhouse-daemon /opt/greenhouse-daemon
chmod 700 /opt/greenhouse-daemon
daemon_version="0.0.0-5933a1c-692f"
threshold_version="0.0.0-e215ed1-161a"
caddy_version="v2.4.0-beta.2-forest-1a99c8cd-4438"
cli_version="0.0.0-8bffc70-1775"
daemon_amd64_sha256="ee934e883b826a01bf0a4ec57bee0b9c58949483dd8386e5a85cccf3cd671f3e"
daemon_arm_sha256="null"
daemon_arm64_sha256="null"
threshold_amd64_sha256="dc064148c6cb386ecfabbbc1f9f0c4e162398cbc74b8e7138664f2876624da61"
threshold_arm_sha256="null"
threshold_arm64_sha256="null"
caddy_amd64_sha256="acfd32aa766b91c46bd9cefbdd8c3f6a6c4b0adb176968880b4bf214b1fce94b"
caddy_arm_sha256="null"
caddy_arm64_sha256="null"
cli_amd64_sha256="9b179eecd9d70e61f470ed1d68bc558427b0f818bc4cf2eb44d68e185129dfd0"
cli_arm_sha256="null"
cli_arm64_sha256="null"
daemon_sha256="error_architechture_not_found"
threshold_sha256="error_architechture_not_found"
caddy_sha256="error_architechture_not_found"
cli_sha256="error_architechture_not_found"
if [ "$pkg_arch" = "amd64" ]; then
daemon_sha256="$daemon_amd64_sha256"
threshold_sha256="$threshold_amd64_sha256"
caddy_sha256="$caddy_amd64_sha256"
cli_sha256="$cli_amd64_sha256"
fi
if [ "$pkg_arch" = "arm" ]; then
daemon_sha256="$daemon_arm_sha256"
threshold_sha256="$threshold_arm_sha256"
caddy_sha256="$caddy_arm_sha256"
cli_sha256="$cli_arm_sha256"
fi
if [ "$pkg_arch" = "arm64" ]; then
daemon_sha256="$daemon_arm64_sha256"
threshold_sha256="$threshold_arm64_sha256"
caddy_sha256="$caddy_arm64_sha256"
cli_sha256="$cli_arm64_sha256"
fi
if systemctl | grep -q 'greenhouse-daemon.service' ; then
printf "stopping the existing greenhouse-daemon background service\n\n"
systemctl stop greenhouse-daemon.service
fi
printf "checking for updates\n\n"
update_binary "/opt/greenhouse-daemon" "greenhouse-daemon" "greenhouse-daemon" "$daemon_version" "$pkg_arch" "$daemon_sha256"
update_binary "/opt/greenhouse-daemon" "threshold" "greenhouse-threshold" "$threshold_version" "$pkg_arch" "$threshold_sha256"
update_binary "/opt/greenhouse-daemon" "caddy" "greenhouse-caddy" "$caddy_version" "$pkg_arch" "$caddy_sha256"
update_binary "/usr/local/bin" "greenhouse-cli" "greenhouse" "$cli_version" "$pkg_arch" "$cli_sha256"
chown greenhouse-daemon:greenhouse-daemon /opt/greenhouse-daemon/greenhouse-daemon
chown greenhouse-daemon:greenhouse-daemon /opt/greenhouse-daemon/greenhouse-threshold
chown greenhouse-daemon:greenhouse-daemon /opt/greenhouse-daemon/greenhouse-caddy
chmod 500 /opt/greenhouse-daemon/greenhouse-daemon
chmod 500 /opt/greenhouse-daemon/greenhouse-threshold
chmod 500 /opt/greenhouse-daemon/greenhouse-caddy
chmod 755 /usr/local/bin/greenhouse
printf '
{
"admin": {
"disabled": false,
"listen": "127.0.0.1:9574",
"authorized_clients_ca_file": "./greenhouse_daemon_localhost_ca.crt",
"tls_key_file": "./greenhouse-daemon.key",
"tls_cert_file": "./greenhouse-daemon.crt",
"config": {
"persist": false
}
}
}
' > /opt/greenhouse-daemon/caddy-config.json
printf '
[Unit]
Description=Greenhouse Background Service
After=network.target
[Service]
Type=simple
Restart=always
# wait at least 5 seconds before restarting if it crashes
RestartSec=5
WorkingDirectory=/opt/greenhouse-daemon
ExecStart=/opt/greenhouse-daemon/greenhouse-daemon
User=greenhouse-daemon
Group=greenhouse-daemon
[Install]
WantedBy=multi-user.target
' > /etc/systemd/system/greenhouse-daemon.service
chown greenhouse-daemon:greenhouse-daemon /etc/systemd/system/greenhouse-daemon.service
chmod 755 /etc/systemd/system/greenhouse-daemon.service
printf "enabling greenhouse-daemon background service\n\n"
systemctl daemon-reload
systemctl enable greenhouse-daemon.service
printf "starting greenhouse-daemon background service\n\n"
systemctl start greenhouse-daemon.service
printf "waiting for greenhouse-daemon background service to become responsive\n"
curl_exit_code=1
attempts=0
while [ $curl_exit_code -ne 0 ] && [ $attempts -lt 20 ]; do
sleep 1
printf ".\n"
curl --silent --show-error --insecure --connect-timeout 1 https://localhost:9572/ping > /dev/null 2>&1
curl_exit_code=$?
attempts=$((attempts+1))
done
if [ $attempts -eq 20 ]; then
printf "Greenhouse was installed, but it failed to start:\n"
printf "\n"
systemctl status greenhouse-daemon.service
journalctl -u greenhouse-daemon.service -n 20 --no-pager
printf "\n"
printf "\n"
printf "This is definitely a bug!\n"
exit 1
fi
printf "greenhouse has been successfully installed!\n"
printf "\n"
printf "For the command line interface, run 'greenhouse help'\n"
printf "\n"
printf "If you wish, you may also install the greenhouse-desktop GUI app at this point.\n"
footer_with_url

frontend/static/install-linux.sh → frontend/static/install.sh View File


frontend/static/uninstall-linux.sh → frontend/static/uninstall.sh View File


+ 3
- 3
frontend_howto.go View File

@ -37,13 +37,13 @@ func registerHowtoRoutes(app *FrontendApp) {
app.handleWithSessionNotRequired(
"/install-greenhouse-client-software-linux",
func(responseWriter http.ResponseWriter, request *http.Request, session Session) {
app.buildPageFromTemplate(responseWriter, session, "install-linux.html", struct{}{})
app.buildPageFromTemplate(responseWriter, session, "install.html", struct{}{})
},
)
serveScripts := []string{
"install-linux.sh",
"uninstall-linux.sh",
"install.sh",
"uninstall.sh",
"install-macos.sh",
"uninstall-macos.sh",
}


Loading…
Cancel
Save