Installation tool
Shlink provides a helper CLI installation tool which comes in handy to configure your instance when you are not using Shlink’s docker image, and you prefer not to use environment variables.
The tool is executed using the vendor/bin/shlink-installer
script, and it provides a couple of commands that simplify installing/updating shlink instances, or editing some configuration options.
Warning
The installation tool expects to be executed on Shlink’s root directory. Running it at a different level will result in an error.
Commands
In order to list all available commands from the installation tool, just run vendor/bin/shlink-installer
with no arguments:
Main commands
The installation tool is designed to make a couple of main actions: install Shlink, update an existing instance or update the value from a particular config option.
Install
In order to install Shlink, run vendor/bin/shlink-installer install
.
It will trigger an interactive tool that will guide you through the installation process, asking you questions about all the aspects in Shlink that can be customized.
At the end, it will generate a special config file which will later be consumed by Shlink.
Update
In order to update Shlink, run vendor/bin/shlink-installer update
.
The update process is very similar to the “install” one, with the only difference that it will give you the opportunity to consume the config previously generated.
Thanks to that, the update tool will make sure to skip all “questions” for which it can already infer an answer from the previous config.
Similarly to what the “install” command did, you will end up with a newly generated config file that containing what was firt imported, plus everything you provided for the new questions.
Set option
Sometimes you need to change some specific config option, but you don’t want to reinstall Shlink completely.
Maybe the database password changed, maybe you want to change your default domain, or maybe you want to disable some tracking option.
In order to be able to do this, run vendor/bin/shlink-installer set-option
.
It will display a list of all the possible options to customize, and you just have to select one and provide the new value.
This command has a limitation. It can only be executed on a Shlink install where the
install
command has been successfully executed first.
Init
This command helps to automate Shlink installation, by “initializing” all the external dependencies it needs, like the database, cache warmup, download GeoLite db, etc.
It can be used both for new Shlink installations, but also to update the external environment on a Shlink instance which is being updated, as it also runs database migrations.
This command is internally used both by install
and update
commands, but comes in handy in case you want to provide Shlink config via environment variables.
The official docker image entry point also uses this command, but you don’t need to worry in that case.
It allows a bit of customization via CLI flags, depending on your needs:
--initial-api-key
: useful for new Shlink instances, so that it generates a first admin API key.--skip-initialize-db
: it can be passed when updating Shlink to skip a command which won’t have any effect anyway.--clear-db-cache
: you want to provide this every time you update Shlink, but passing it on new installations won’t have any side effect.--download-rr-binary
: If you are serving/want to serve Shlink with RoadRunner, this option will ensure the binary is downloaded.--skip-download-geolite
: If you are not passing a GeoLite license key, you can pass this to skip a command which won’t have any effect anyway.
This command is available since Shlink 3.6.0