### Initialize Pslink Configuration and Database Source: https://github.com/enaut/pslink/blob/main/README.md Navigates to the Pslink installation directory and, as the 'pslink' user, generates the initial environment configuration file, migrates the database, and creates an administrative user. ```bash cd /opt/pslink sudo -u pslink /opt/pslink/pslink generate-env sudo -u pslink /opt/pslink/pslink migrate-database sudo -u pslink /opt/pslink/pslink create-admin ``` -------------------------------- ### Start Pslink Server Source: https://github.com/enaut/pslink/blob/main/README.md Initiates the Pslink application server process. This command starts the core functionality of the URL shortener. ```bash pslink runserver ``` -------------------------------- ### Enable and Start Pslink Systemd Service Source: https://github.com/enaut/pslink/blob/main/README.md Enables the Pslink systemd service to automatically start on system boot and immediately starts the service for the current session. ```bash sudo systemctl enable --now pslink ``` -------------------------------- ### Start Pslink Web Server Source: https://github.com/enaut/pslink/blob/main/README.md This command launches the Pslink web service. It assumes that the environment file is configured, the database is migrated, and an admin user is created. After execution, the application should be accessible via a web browser at the configured URL, typically `http://localhost/app/`. ```bash pslink runserver ``` -------------------------------- ### Run Pslink Container with Demo Data Source: https://github.com/enaut/pslink/blob/main/doc/BuildContainer.md Starts the Pslink server in a detached container with demo data. This setup is for quick testing, as data will not persist across restarts. Access the application via http://localhost:8080/app/. ```bash podman run -d --name pslink_container \ -p 8080:8080 \ ghcr.io/enaut/pslink:latest ``` -------------------------------- ### Install Pslink Binary from Release Source: https://github.com/enaut/pslink/blob/main/README.md These commands download and extract the latest Pslink binary bundle for Linux x86_64 from GitHub. After extraction, the `pslink` executable can be run directly. It's recommended to adjust the system PATH or create an alias for easier access. ```bash # mkdir -p /opt/pslink # cd /opt/pslink # wget https://github.com/enaut/pslink/releases/latest/download/pslink-linux-x86_64-bundle.tgz # tar -xf pslink-linux-x86_64-bundle.tgz # /opt/pslink/pslink help ``` -------------------------------- ### Pslink Systemd Service Configuration Source: https://github.com/enaut/pslink/blob/main/README.md An example systemd unit file for running Pslink as a background service. It defines the service's description, dependencies, user, group, environment variables, security hardening options, working directory, and the command to execute. ```systemd cat /etc/systemd/system/pslink.service [Unit] Description=Pslink the Urlshortener Documentation=https://github.com/enaut/Pslink Wants=network.target After=network.target [Service] User=pslink Group=pslink EnvironmentFile=-/opt/pslink/.env ProtectHome=true ProtectSystem=full PrivateDevices=true NoNewPrivileges=true PrivateTmp=true InaccessibleDirectories=/root /sys /srv /media -/lost+found ReadWriteDirectories=/opt/pslink WorkingDirectory=/opt/pslink ExecStart=/opt/pslink/pslink runserver [Install] WantedBy=multi-user.target ``` -------------------------------- ### Start Pslink Container for Production Source: https://github.com/enaut/pslink/blob/main/doc/BuildContainer.md Starts the Pslink server in a detached container with persistent database and environment files, configured for production deployment. This command utilizes the pre-configured `.env` and `links.db` files. ```bash podman run --replace -d --name pslink_container \ -v ./links.db:/app/links.db:Z \ -v ./.env:/app/.env:Z \ -p 8080:8080 \ ghcr.io/enaut/pslink:latest ``` -------------------------------- ### Run Pslink Database Migration Source: https://github.com/enaut/pslink/blob/main/README.md Executes the database migration command for Pslink, updating the database schema to the latest version. This is typically run after updating the Pslink binary or during initial setup. ```bash pslink migrate-database ``` -------------------------------- ### Build pslink Container Image using Podman Source: https://github.com/enaut/pslink/blob/main/doc/BuildContainer.md This command builds the pslink container image from the current project root directory. It tags the resulting image as 'pslink:latest'. The instructions note that 'podman' can be interchanged with 'docker' based on the user's installed container runtime. ```bash # Using Podman podman build -t pslink:latest . ``` -------------------------------- ### Create Pslink Admin User Source: https://github.com/enaut/pslink/blob/main/doc/BuildContainer.md Executes the `create-admin` command inside the running Pslink container to set up an administrative user. This is a crucial step for securing and managing the Pslink instance after initial setup. ```bash podman exec -it pslink_container /app/pslink create-admin ``` -------------------------------- ### Disable Pslink Demo Mode Source: https://github.com/enaut/pslink/blob/main/doc/BuildContainer.md Modifies the `.env` file to change the `DEMO` environment variable from `true` to `false`. This action disables the demo warning hint, typically performed after the initial setup for a production environment. ```bash sed -i 's/DEMO="true"/DEMO="false"/' .env ``` -------------------------------- ### Generate Pslink Environment Configuration File Source: https://github.com/enaut/pslink/blob/main/README.md This command creates a `.env` file in the current directory with default Pslink settings. Users should edit this file to customize their installation. While parameters can be provided via command line or environment variables, `PSLINK_SECRET` should ideally be set in the `.env` file for security. ```bash pslink generate-env ``` -------------------------------- ### Pslink Command Line Interface (CLI) Reference Source: https://github.com/enaut/pslink/blob/main/doc/BuildContainer.md Detailed reference for the `pslink` command-line application, including available subcommands and global options. This output describes how to interact with the Pslink server for various administrative and operational tasks, such as running the server, creating users, or managing configuration. ```APIDOC $ podman exec -it pslink_container /app/pslink --help Usage: pslink [OPTIONS] [COMMAND] Commands: runserver Run the server create-admin Create an admin user. generate-env Generate an .env file template using default settings and exit migrate-database Apply any pending migrations and exit help Print this message or the help of the given subcommand(s) Options: --db The path of the sqlite database [env: PSLINK_DATABASE=/app/links.db] [default: ./links.db] -p, --port The port the pslink service will run on [env: PSLINK_PORT=8080] -u, --public-url The host url or the page that will be part of the short urls. [env: PSLINK_PUBLIC_URL=localhost:8080] [default: 127.0.0.1:8080] -e, --empty-url The the url that / will redirect to. Usually your homepage. [env: PSLINK_EMPTY_FORWARD_URL=https://github.com/enaut/pslink] [default: https://github.com/enaut/pslink] -b, --brand-name The Brandname that will apper in various places. [env: PSLINK_BRAND_NAME=Pslink] [default: Pslink] -i, --hostip The host (ip) that will run the pslink service [env: PSLINK_IP=localhost] --demo The host (ip) that will run the pslink service [env: DEMO=] -t, --protocol The protocol that is used in the qr-codes (http results in slightly smaller codes in some cases) [env: PSLINK_PROTOCOL=http] [default: http] [possible values: http, https] --secret The secret that is used to encrypt the password database keep this as inaccessible as possible. As command line parameters are visible to all users it is not wise to use this as a command line parameter but rather as an environment variable. [env: PSLINK_SECRET=Slsgohetö