You're viewing a template repository tailored for deploying Suri with Docker. That could be on a cloud platform that supports Docker container images, or just on your own machine. Head over to the main repository to learn more about Suri, including additional deployment options.
-
Hit the "Use this template" button above and then "Create a new repository". Fill in the required details to create a new repository based on this one.
-
Make sure you have Docker installed and running. Docker Desktop is an easy way to get started on your own machine.
-
Build a Docker image named
surifrom theDockerfile:docker build --tag suri .This uses docker-static-website to produce a very small image.
On 32-bit ARM, such as a Raspberry Pi running a 32-bit OS, build with Node.js 22 instead, since newer versions no longer support it:
docker build --build-arg NODE_VERSION=22 --tag suri . -
Start a new container using the image, which serves the static site on port
3000:docker run --interactive --tty --rm --init --publish 3000:3000 suri
Pull requests are built by GitHub Actions, so a mistake in links.json is
caught before it's merged. You can change this by editing
.github/workflows/build.yml.
If you're just looking to build the static site, but not serve it, you can
change the docker build command to export the build directory from the
Docker image to your host machine:
docker build --target=export --output=build .Keep in mind that this won't remove any existing files in the build directory
on your host machine, so you may want to delete the directory beforehand.
Dependabot opens a pull
request in your repository about a week after a new version of Suri is released.
It does the same for the lipanski/docker-static-website image in the
Dockerfile. With Node.js installed, you can also update Suri
yourself:
npm install @surishortlink/suri@latestThen commit the updated package.json and package-lock.json. Before updating
to a new major version, check
the release notes for breaking
changes.
At the heart of Suri is the links.json file, located in the
src directory, where you manage your links. All of the template repositories
include this file seeded with a few examples:
{
"/": "https://www.youtube.com/watch?v=CsHiG-43Fzg",
"1": "https://fee.org/articles/the-use-of-knowledge-in-society/",
"gh": "https://github.com/surishortlink/suri"
}It couldn't be simpler: the key is the "short link" path that gets redirected,
and the value is the target URL. Keys can be as short or as long as you want,
and can include / for nested paths, like gh/suri. Avoid ? and #, which
browsers treat as the start of a query string or fragment. / is a special
entry for redirecting the root path.
Suri ships with a suri executable file that generates the static site from the
links.json file. The static site is output to a directory named build.
All of the template repositories are configured with a build script that
invokes this executable, making the command you run simple:
npm run buildWhen you make a change to the links.json file, simply re-run this command to
re-generate the static site, which can then be re-deployed.
Configuration is handled through the suri.config.json file
in the root directory. There is only one option at this point:
| Option | Description | Type | Default |
|---|---|---|---|
js |
Whether to redirect with JavaScript instead of a <meta> refresh. |
Boolean | false |
Finally, any files in the public directory will be copied over to the build
directory without modification when the static site is built. This can be useful
for files like favicon.ico or robots.txt (that said, Suri provides sensible
defaults for both).