Skip to content

Commit

Permalink
Migrated website and installer script to this repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceiphr committed Sep 24, 2022
1 parent b2db6aa commit 7820b1a
Show file tree
Hide file tree
Showing 20 changed files with 2,691 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Unit Testing",
"type": "shell",
"command": "bats test/test.bats"
}
]
}
3 changes: 3 additions & 0 deletions website/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
35 changes: 35 additions & 0 deletions website/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
21 changes: 21 additions & 0 deletions website/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Ari Birnbaum (Ceiphr)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions website/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Reserver Website

[![Vercel Deployment Status][vercel-shield]](https://get.reserver.sh/)

This is the website for [ceiphr/reserver](https://github.com/ceiphr/reserver). It is a Next.js application using TypeScript, Tailwind CSS, Prism.js and KaTeX.

## License

Distributed under the MIT License. See [LICENSE](https://github.com/ceiphr/reserver.sh/blob/main/LICENSE) for more information.

[vercel-shield]: https://img.shields.io/github/deployments/ceiphr/reserver.sh/production?color=green&label=vercel&logo=vercel&logoColor=white
5 changes: 5 additions & 0 deletions website/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
15 changes: 15 additions & 0 deletions website/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @type {import('next').NextConfig} */
const isProd = process.env.NODE_ENV === "production";
const nextConfig = {
swcMinify: true,
reactStrictMode: true,
images: {
domains: ["img.shields.io"],
},
assetPrefix: isProd ? "/reserver/" : "",
images: {
unoptimized: true,
},
};

module.exports = nextConfig;
34 changes: 34 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "reserver.sh",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"animejs": "^3.2.1",
"katex": "^0.15.3",
"next": "12.1.5",
"prismjs": "^1.28.0",
"react": "18.0.0",
"react-dom": "18.0.0",
"react-latex-next": "^2.1.0"
},
"devDependencies": {
"@types/animejs": "^3.1.4",
"@types/katex": "^0.14.0",
"@types/node": "17.0.25",
"@types/prismjs": "^1.26.0",
"@types/react": "18.0.5",
"@types/react-dom": "18.0.1",
"autoprefixer": "^10.4.4",
"eslint": "8.13.0",
"eslint-config-next": "12.1.5",
"postcss": "^8.4.12",
"tailwindcss": "^3.0.24",
"typescript": "4.6.3"
}
}
10 changes: 10 additions & 0 deletions website/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import "../styles/globals.css";
import "../styles/prism.css";
import "katex/dist/katex.min.css";
import type { AppProps } from "next/app";

function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}

export default MyApp;
173 changes: 173 additions & 0 deletions website/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
import type { NextPage } from "next";
import { useEffect } from "react";
import Head from "next/head";
// import Image from "next/image";
import Latex from "react-latex-next";
import anime from "animejs";
import prism from "prismjs";
import "prismjs/components/prism-bash";
import "prismjs/plugins/command-line/prism-command-line.js";
import "prismjs/plugins/command-line/prism-command-line.css";

const Home: NextPage = () => {
const codeSample = `curl https://ceiphr.io/reserver/install | sh
./reserver.sh
Reserving 5GB of space...
Reservation complete!
./reserver.sh
Reservation file already exists. Delete? [y/N]: y
Reservation removed. Good luck!`;

useEffect(() => {
prism.highlightAll();
anime({
targets: ".slide-in",
translateY: [20, 0],
opacity: [0, 1],
delay: anime.stagger(150, { start: 200 }),
duration: 1000,
easing: "easeOutQuart",
});
}, []);

return (
<div>
<Head>
<title>Reserver</title>
<meta
name="description"
content="A very mild contingency plan for servers that run out of space. "
/>
<link rel="icon" href="/favicon.ico" />
</Head>

<main className="p-5 md:my-12 max-w-3xl mx-auto">
<h1 className="slide-in text-6xl">
<Latex>{"$\\R \\text{eserver}$"}</Latex>
</h1>
<p className="slide-in text-xl text-stone-500 dark:text-stone-400 italic -mt-4 mb-4">
/rə&apos;zərvər/
</p>
{/* <div className="flex w-fit gap-2 my-2">
<a href="https://github.com/ceiphr/reserver/actions/workflows/main.yml">
<Image
src="https://img.shields.io/github/workflow/status/ceiphr/reserver/CI?color=green&logo=github"
alt="CI"
layout="fixed"
width="105px"
height="20px"
/>
</a>
<Image
src="https://img.shields.io/github/v/release/ceiphr/reserver?color=green"
alt="Release"
layout="fixed"
width="94px"
height="20px"
/>
<Image
src="https://img.shields.io/badge/bash-v4.4%5E-green?&logo=gnubash&logoColor=white"
alt="Bash"
layout="fixed"
width="97px"
height="20px"
/>
</div> */}
<div className="text-xl space-y-5">
<p className="slide-in">
A <span className="italic">very mild</span> contingency
plan for servers that run out of space. Based on this
great article by Brian Schrader:{" "}
<a
href="https://brianschrader.com/archive/why-all-my-servers-have-an-8gb-empty-file/"
rel="noreferrer"
target="_blank"
>
Why All My Servers Have An 8gb Empty File
</a>
.
</p>
<p className="slide-in">
Just like Schrader does in the article, this script will
reserve space on a server, so, you can delete it later.
</p>
<p className="slide-in">
Specifically, when your server runs out of space, you
can remove the reservation file this script produces so
that the server will hopefully have enough space to
function again while you try to fix whatever caused the
issue.
</p>
<p className="slide-in">
You should always use monitoring software and or SaaS
offerings such as{" "}
<a
href="https://www.datadoghq.com/"
rel="noreferrer"
target="_blank"
>
Datadog
</a>{" "}
to monitor disk usage on your servers. That is the tool
that will <span className="italic">really</span> help
you mitigate this potential problem. Think of
reserver.sh as a sidekick. It&apos;s simple to use and
is there if your primary tools somehow fail. It is a{" "}
<span className="italic">mild</span> contingency plan if
you can spare the disk space.
</p>
<h2 className="slide-in text-3xl">
Installation & Basic Usage
</h2>
<pre
className="slide-in command-line selection:bg-slate-200 dark:selection:bg-slate-700"
data-user="user"
data-host="remotehost"
data-output="3-4, 6-7"
>
<code className="language-bash">{codeSample}</code>
</pre>
<h2 className="slide-in text-3xl">Resources</h2>
<ul className="slide-in list-disc ml-5">
<li>
<a href="https://github.com/ceiphr/reserver#usage">
Documentation
</a>
</li>
<li>
<a href="https://github.com/ceiphr/reserver">
Reserver Source Code
</a>
</li>
<li>
<a href="https://github.com/ceiphr/get.reserver.sh">
Installation Script Source Code
</a>
</li>
<li>
<a href="https://github.com/ceiphr/reserver.sh">
Website Source Code
</a>
</li>
</ul>
<footer className="slide-in">
<p>
Copyright © 2022 Ari Birnbaum (
<a href="https://ceiphr.com/">Ceiphr</a>).
</p>
<p>
Reserver, its installation script and this website
are all{" "}
<a href="https://github.com/ceiphr/reserver/blob/main/LICENSE">
MIT licensed
</a>
.
</p>
</footer>
</div>
</main>
</div>
);
};

export default Home;
6 changes: 6 additions & 0 deletions website/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Empty file added website/public/.nokjekyll
Empty file.
Binary file added website/public/favicon.ico
Binary file not shown.
28 changes: 28 additions & 0 deletions website/public/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env sh

_exists() {
cmd="$1"
if [ -z "$cmd" ]; then
echo "Usage: _exists cmd"
return 1
fi
if type command >/dev/null 2>&1; then
command -v "$cmd" >/dev/null 2>&1
else
type "$cmd" >/dev/null 2>&1
fi
ret="$?"
return $ret
}

if [ -z "$BRANCH" ]; then
BRANCH="main"
fi

if _exists curl && [ "${RESERVER_USE_WGET:-0}" = "0" ]; then
curl https://raw.githubusercontent.com/ceiphr/reserver/$BRANCH/reserver.sh > reserver.sh && chmod +x reserver.sh
elif _exists wget; then
wget -O - https://raw.githubusercontent.com/ceiphr/reserver/$BRANCH/reserver.sh > reserver.sh && chmod +x reserver.sh
else
echo "You must have curl or wget installed before running this script." >&2
fi
4 changes: 4 additions & 0 deletions website/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7820b1a

Please sign in to comment.