Edge and binary builds are back
This commit is contained in:
+5
-3
@@ -1,6 +1,9 @@
|
||||
FROM denoland/deno:alpine-2.3.5
|
||||
# Note: we don't actually need a Deno image, since we use a single-binary distribution of SilverBullet
|
||||
# However, since those binaries still depend on a bunch of GLIBC stuff included in the deno image —— we'll just go with that anyway
|
||||
FROM denoland/deno:alpine
|
||||
|
||||
# The volume that will keep the space data
|
||||
VOLUME /space
|
||||
|
||||
# Either create a volume:
|
||||
# docker volume create myspace
|
||||
@@ -9,8 +12,6 @@ FROM denoland/deno:alpine-2.3.5
|
||||
# Or simply mount an existing folder into the container:
|
||||
# docker run -v /path/to/my/folder:/space -p3000:3000 -it ghcr.io/silverbulletmd/silverbullet
|
||||
|
||||
VOLUME /space
|
||||
|
||||
# Accept TARGETARCH as argument
|
||||
ARG TARGETARCH
|
||||
|
||||
@@ -21,6 +22,7 @@ ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TAR
|
||||
# Make sure the deno user has access to the space volume
|
||||
RUN mkdir -p -m 777 /space \
|
||||
&& chmod +x /tini \
|
||||
# We will just include bash and git
|
||||
&& apk add bash git
|
||||
|
||||
# Expose port 3000
|
||||
|
||||
+59
-39
@@ -1,49 +1,14 @@
|
||||
import { version } from "../version.ts";
|
||||
|
||||
export async function upgradeCommand() {
|
||||
console.log("Now going to attempt an upgrade...");
|
||||
|
||||
const command = new Deno.Command("deno", {
|
||||
args: ["cache", "--no-lock", "--reload", Deno.mainModule],
|
||||
stdout: "inherit",
|
||||
stderr: "inherit",
|
||||
});
|
||||
const commandOutput = await command.output();
|
||||
if (!commandOutput.success) {
|
||||
console.error("Something went wrong there...");
|
||||
Deno.exit(1);
|
||||
}
|
||||
console.log(
|
||||
"So, that's done. Now let's see if this actually did anything...",
|
||||
);
|
||||
const vp = new Deno.Command("deno", {
|
||||
args: ["run", "--no-lock", "-A", Deno.mainModule, "version"],
|
||||
});
|
||||
const versionStatus = await vp.output();
|
||||
if (!versionStatus.success) {
|
||||
console.error("Could not run version command, something is wrong.");
|
||||
Deno.exit(1);
|
||||
}
|
||||
const newVersion = new TextDecoder().decode(versionStatus.stdout).trim();
|
||||
if (newVersion === version) {
|
||||
console.log(
|
||||
`Nope. I hate to tell you this, but it looks like we're still running ${newVersion}. This was a bit of a futile exercise. Let's try again soon some time.`,
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
`Congrats, we've upgraded you from ${version} to ${newVersion}. Seems like quite a bump, enjoy! https://silverbullet.md/CHANGELOG may give you more hints on what's new.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// WIP: This is not yet working, but it's a start
|
||||
import { dirname } from "@std/path";
|
||||
|
||||
const silverBulletReleases =
|
||||
"https://github.com/silverbulletmd/silverbullet/releases";
|
||||
|
||||
export async function compiledUpgradeCommand() {
|
||||
console.log("Now going to attempt an upgrade...");
|
||||
export async function upgradeCommand() {
|
||||
// TODO: Update this before a proper release
|
||||
console.log("Not implemented yet");
|
||||
return;
|
||||
|
||||
const resp = await fetch(`${silverBulletReleases}/latest`, {
|
||||
redirect: "manual",
|
||||
@@ -110,3 +75,58 @@ export async function compiledUpgradeCommand() {
|
||||
await Deno.remove(zipPath);
|
||||
console.log("And done! Restart your server to get the latest and greatest!");
|
||||
}
|
||||
|
||||
export async function upgradeEdgeCommand() {
|
||||
console.log("Now going to attempt an edge upgrade...");
|
||||
|
||||
const installDir = dirname(Deno.execPath());
|
||||
|
||||
console.log("Install dir:", installDir);
|
||||
|
||||
const tmpDir = Deno.makeTempDirSync();
|
||||
// const zipUrl = "https://github.com/silverbulletmd/silverbullet/releases/download/test-release/silverbullet-server-apple-aarch64.zip";
|
||||
const zipUrl =
|
||||
`https://github.com/silverbulletmd/silverbullet/releases/download/edge/silverbullet-server-${Deno.build.os}-${Deno.build.arch}.zip`;
|
||||
const zipPath = `${tmpDir}/silverbullet.zip`;
|
||||
console.log("Downloading from", zipUrl);
|
||||
const command = new Deno.Command("curl", {
|
||||
args: [
|
||||
"-L",
|
||||
"-o",
|
||||
zipPath,
|
||||
zipUrl,
|
||||
],
|
||||
});
|
||||
const curlOutput = await command.output();
|
||||
if (curlOutput.code !== 0) {
|
||||
console.error(
|
||||
"Download failed",
|
||||
new TextDecoder().decode(curlOutput.stderr),
|
||||
);
|
||||
return;
|
||||
}
|
||||
console.log(
|
||||
"Now going to replace the existing silverbullet binary in",
|
||||
installDir,
|
||||
);
|
||||
|
||||
const unzipCommand = new Deno.Command("unzip", {
|
||||
args: [
|
||||
"-o",
|
||||
"-d",
|
||||
installDir,
|
||||
`${tmpDir}/silverbullet.zip`,
|
||||
],
|
||||
});
|
||||
const zipOutput = await unzipCommand.output();
|
||||
if (zipOutput.code !== 0) {
|
||||
console.error(
|
||||
"Download failed",
|
||||
new TextDecoder().decode(curlOutput.stderr),
|
||||
);
|
||||
return;
|
||||
}
|
||||
await Deno.chmod(`${installDir}/silverbullet`, 0o755);
|
||||
await Deno.remove(zipPath);
|
||||
console.log("And done! Restart your server to get the latest and greatest!");
|
||||
}
|
||||
|
||||
Regular → Executable
+3
-6
@@ -16,11 +16,8 @@ esac
|
||||
|
||||
echo "Installing for $target"
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
sb_uri="https://github.com/silverbulletmd/silverbullet/releases/latest/download/silverbullet-server-${target}.zip"
|
||||
else
|
||||
sb_uri="https://github.com/silverbulletmd/silverbullet/releases/download/${1}/silverbullet-server-${target}.zip"
|
||||
fi
|
||||
sb_uri="https://github.com/silverbulletmd/silverbullet/releases/download/edge/silverbullet-server-${target}.zip"
|
||||
|
||||
exe=silverbullet
|
||||
bin_dir=.
|
||||
|
||||
@@ -29,4 +26,4 @@ unzip -d "$bin_dir" -o "$exe.zip"
|
||||
chmod +x "$exe"
|
||||
rm "$exe.zip"
|
||||
|
||||
echo "SilverBullet server was installed successfully to $bin, run it directly via ./$exe or move it to a more convenient place."
|
||||
echo "SilverBullet server was installed successfully to $bin_dir, run it directly via ./$exe or move it to a more convenient place."
|
||||
+5
-1
@@ -3,7 +3,7 @@ import { Command } from "@cliffy/command";
|
||||
|
||||
import { version } from "./version.ts";
|
||||
|
||||
import { upgradeCommand } from "./cmd/upgrade.ts";
|
||||
import { upgradeCommand, upgradeEdgeCommand } from "./cmd/upgrade.ts";
|
||||
import { versionCommand } from "./cmd/version.ts";
|
||||
import { serveCommand } from "./cmd/server.ts";
|
||||
import { plugCompileCommand } from "./cmd/plug_compile.ts";
|
||||
@@ -77,6 +77,10 @@ await new Command()
|
||||
.command("upgrade")
|
||||
.description("Upgrade SilverBullet")
|
||||
.action(upgradeCommand)
|
||||
// upgrade-edge
|
||||
.command("upgrade-edge")
|
||||
.description("Upgrade SilverBullet to the latest Edge build")
|
||||
.action(upgradeEdgeCommand)
|
||||
// sync
|
||||
.command("sync")
|
||||
.description("Synchronize two spaces")
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
export async function updateVersionFile() {
|
||||
const command = new Deno.Command("git", {
|
||||
args: ["describe", "--tags", "--long", "--dirty"],
|
||||
args: ["describe", "--tags", "--long"],
|
||||
stdout: "piped",
|
||||
stderr: "piped",
|
||||
});
|
||||
@@ -9,7 +9,8 @@ export async function updateVersionFile() {
|
||||
const commitVersion = new TextDecoder().decode(stdout).trim();
|
||||
|
||||
const versionFilePath = "./version.ts";
|
||||
const versionContent = `export const version = "2.0-beta (${commitVersion})";\n`;
|
||||
const versionContent =
|
||||
`export const version = "2.0-beta (${commitVersion})";\n`;
|
||||
|
||||
await Deno.writeTextFile(versionFilePath, versionContent);
|
||||
console.log(`Updated version.ts with version information: ${commitVersion}`);
|
||||
|
||||
+2
-3
@@ -7,11 +7,10 @@ Installing SilverBullet as a (local) web server is pretty straightforward if you
|
||||
|
||||
The basic setup is simple: you run the SilverBullet server process on your machine, then connect to it locally from your browser via `localhost`.
|
||||
|
||||
You have currently one option here:
|
||||
You have two options:
|
||||
|
||||
1. Installation via [[Install/Docker]] (the awesome container runtime): recommended if you already have Docker installed
|
||||
|
||||
Later we’ll bring back the Deno option.
|
||||
2. Installation of the single [[Install/Binary]] distribution (available for all major platforms)
|
||||
|
||||
# Non-local access
|
||||
Once you got a comfortable set running locally, you may want to look at options to expose your setup to your [[Install/Network and Internet]].
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
SilverBullet is distributed as a single server binary available for the following platforms:
|
||||
|
||||
* macOS (Intel and Apple Silicon) (platform name “darwin”)
|
||||
* Linux (x86_64 and arm64) (note that this will run on Raspberry Pi as well, but requires a 64-bit Linux distribution)
|
||||
* Windows (64-bit)
|
||||
|
||||
> **note** Note
|
||||
> Since v2 is still in beta, please use the [edge](https://github.com/silverbulletmd/silverbullet/releases/tag/edge) builds for now, all previous releases are still “v1”
|
||||
|
||||
Steps:
|
||||
1. [Download the binary for your platform from Github](https://github.com/silverbulletmd/silverbullet/releases/tag/edge).
|
||||
2. Unzip the file in a convenient place
|
||||
3. Run it from the command line (see below)
|
||||
|
||||
You need to create a folder to hold your [[Spaces|space]] files. This folder can be kept anywhere. You can then run `silverbullet` taking the folder path as an argument:
|
||||
|
||||
```bash
|
||||
mkdir sb
|
||||
./silverbullet sb
|
||||
```
|
||||
|
||||
There are a bunch of [[Install/Configuration]] options you can pass, usually as environment variables.
|
||||
|
||||
# Upgrading
|
||||
You can upgrade your SilverBullet install to the latest edge build using:
|
||||
|
||||
```bash
|
||||
./silverbullet upgrade-edge
|
||||
```
|
||||
|
||||
Release versions will come when the first proper v2 release happens.
|
||||
|
||||
# Version
|
||||
To check which version of SilverBullet you’re running, run the ${widgets.commandButton("Help: Version")} command.
|
||||
Reference in New Issue
Block a user