docs: create install scripts and update docs (#37)

This commit is contained in:
Gareth
2023-12-22 18:39:14 -08:00
committed by GitHub
parent 173480124d
commit 90b5314f29
9 changed files with 157 additions and 5 deletions
+6
View File
@@ -40,6 +40,12 @@ archives:
format_overrides:
- goos: windows
format: zip
files:
- install.sh
- uninstall.sh
- LICENSE
- README.md
- CHANGELOG.md
dockers:
- image_templates:
+1
View File
@@ -11,6 +11,7 @@ This repo uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.
* Node.JS for UI development
* Go 1.21 or greater for server development
* go.rice `go install github.com/GeertJohan/go.rice@latest` and `go install github.com/GeertJohan/go.rice/rice@latest`
* goreleaser `go install github.com/goreleaser/goreleaser@latest`
**To Edit Protobuffers**
```sh
+3 -3
View File
@@ -4,7 +4,7 @@
Backrest is a free and open-source web UI wrapper for [restic](https://restic.net/).
**Project goals:**
**Project goals**
* Full featured web UI for restic: supports all basic operations (e.g. backup, restore, browse snapshots, prune old data, etc).
* Interactive: UI is fast and responds to operation progress in real time (e.g. backups show live progress bars).
@@ -32,8 +32,8 @@ Backrest is a free and open-source web UI wrapper for [restic](https://restic.ne
| | |
| -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| <img src="https://f000.backblazeb2.com/file/gshare/screenshots/backrest-backup-view.png" width="400px"/> | <img src="https://f000.backblazeb2.com/file/gshare/screenshots/backrest-add-repo.png" width="400px" /> |
| <img src="https://f000.backblazeb2.com/file/gshare/screenshots/backrest-realtime-progress.png" width="400px" /> | <img src="https://f000.backblazeb2.com/file/gshare/screenshots/backrest-add-plan.png" width="400px" /> |
| <img src="https://f000.backblazeb2.com/file/gshare/screenshots/restora-backup-view.png" width="400px"/> | <img src="https://f000.backblazeb2.com/file/gshare/screenshots/restora-add-repo.png" width="400px" /> |
| <img src="https://f000.backblazeb2.com/file/gshare/screenshots/restora-realtime-progress.png" width="400px" /> | <img src="https://f000.backblazeb2.com/file/gshare/screenshots/restora-add-plan.png" width="400px" /> |
# Getting Started
Executable
+86
View File
@@ -0,0 +1,86 @@
#! /bin/bash
if [ "$EUID" -ne "0" ]; then
echo "Please run as root e.g. sudo ./install.sh"
exit
fi
install_unix() {
echo "Installing backrest to /usr/local/bin"
mkdir -p /usr/local/bin
cp $(ls -1 backrest | head -n 1) /usr/local/bin
}
create_systemd_service() {
if [ ! -d /etc/systemd/system ]; then
echo "Systemd not found. This script is only for systemd based systems."
exit 1
fi
echo "Creating systemd service at /etc/systemd/system/backrest.service"
cat > /etc/systemd/system/backrest.service <<- EOM
[Unit]
Description=Backrest Service
After=network.target
[Service]
Type=simple
User=$(whoami)
Group=$(whoami)
ExecStart=/usr/local/bin/backrest
[Install]
WantedBy=multi-user.target
EOM
echo "Reloading systemd daemon"
systemctl daemon-reload
}
create_launchd_plist() {
echo "Creating launchd plist at /Library/LaunchAgents/com.backrest.plist"
cat > /Library/LaunchAgents/com.backrest.plist <<- EOM
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.backrest</string>
<key>Program</key>
<string>/usr/local/bin/backrest</string>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/backrest.log</string>
<key>StandardErrorPath</key>
<string>/tmp/backrest.log</string>
</dict>
</plist>
EOM
}
enable_launchd_plist() {
echo "Enabling launchd plist com.backrest.plist"
launchctl unload /Library/LaunchAgents/com.backrest.plist || true
launchctl load -w /Library/LaunchAgents/com.backrest.plist
}
OS=$(uname -s)
if [ "$OS" = "Darwin" ]; then
echo "Installing on Darwin"
install_unix
create_launchd_plist
enable_launchd_plist
elif [ "$OS" = "Linux" ]; then
echo "Installing on Linux"
install_unix
create_systemd_service
echo "Enabling systemd service backrest.service"
systemctl enable backrest
systemctl start backrest
else
echo "Unknown OS: $OS. This script only supports Darwin and Linux."
exit 1
fi
+2
View File
@@ -18,7 +18,9 @@ type ConfigStore interface {
}
func NewDefaultConfig() *v1.Config {
hostname, _ := os.Hostname()
return &v1.Config{
Host: hostname,
Repos: []*v1.Repo{},
Plans: []*v1.Plan{},
}
Executable
+51
View File
@@ -0,0 +1,51 @@
#! /bin/bash
if [ "$EUID" -ne "0" ]; then
echo "Please run as root e.g. sudo ./install.sh"
exit
fi
uninstall_unix() {
echo "Uninstalling backrest from /usr/local/bin/backrest"
rm -f /usr/local/bin/backrest
}
remove_systemd_service() {
if [ ! -d /etc/systemd/system ]; then
echo "Systemd not found. This script is only for systemd based systems."
exit 1
fi
echo "Removing systemd service at /etc/systemd/system/backrest.service"
systemctl stop backrest
systemctl disable backrest
rm -f /etc/systemd/system/backrest.service
echo "Reloading systemd daemon"
systemctl daemon-reload
}
remove_launchd_plist() {
echo "Removing launchd plist at /Library/LaunchAgents/com.backrest.plist"
launchctl unload /Library/LaunchAgents/com.backrest.plist || true
rm /Library/LaunchAgents/com.backrest.plist
}
OS=$(uname -s)
if [ "$OS" = "Darwin" ]; then
echo "Uninstalling on Darwin"
uninstall_unix
remove_launchd_plist
echo "Done -- run `launchctl list | grep backrest` to check the service installation."
elif [ "$OS" = "Linux" ]; then
echo "Unnstalling on Linux"
uninstall_unix
remove_systemd_service
echo "Done -- run `systemctl status backrest` to check the status of the service."
else
echo "Unknown OS: $OS. This script only supports Darwin and Linux."
exit 1
fi
+1 -1
View File
@@ -18,7 +18,7 @@ const Root = ({ children }: { children: React.ReactNode }) => {
);
};
const darkThemeMq = true; // window.matchMedia("(prefers-color-scheme: dark)");
const darkThemeMq = window.matchMedia("(prefers-color-scheme: dark)");
const el = document.querySelector("#app");
el &&
+1 -1
View File
@@ -135,7 +135,7 @@ export class BackupInfoCollector {
// use the latest status that is not cancelled.
let statusIdx = operations.length - 1;
let status = OperationStatus.STATUS_SYSTEM_CANCELLED;
while (statusIdx > 0 || shouldHideStatus(status)) {
while (statusIdx !== -1 && shouldHideStatus(status)) {
status = operations[statusIdx].status!;
statusIdx--;
}
+6
View File
@@ -54,6 +54,7 @@ export const App: React.FC = () => {
style={{
display: "flex",
alignItems: "center",
width: "100vw",
backgroundColor: "#1b232c",
}}
>
@@ -71,6 +72,11 @@ export const App: React.FC = () => {
<ActivityBar />
</small>
</h1>
<h1 style={{ position: "absolute", right: "20px" }}>
<small style={{ color: "rgba(255,255,255,0.3)", fontSize: "0.6em" }}>
{config.host ? "Host: " + config.host : undefined}
</small>
</h1>
</Header>
<Layout>
<Sider width={300} style={{ background: colorBgContainer }}>