Skip to content

Latest commit

 

History

History
295 lines (195 loc) · 7.37 KB

DEPLOY.md

File metadata and controls

295 lines (195 loc) · 7.37 KB

Deployment

.env Example · Configuration Parameters · GHCR Docker Image · Docker Hub Docker Image (coming soon) · JSR Package · GitHub Repository


The app can be deployed in multiple ways, each with its own advantages and disadvantages. The following are the most common ways to deploy the app:

  • Docker: The app can be deployed using Docker and Docker Compose. This is the easiest way to deploy the app.
  • Portainer: Portainer is a lightweight management UI that allows you to easily manage your Docker host or Swarm cluster. There are some specific steps to deploy the app using Portainer, which is why it has its own section.
  • Deno + JSR: The app can be deployed using Deno and JSR. Unfortunately, while most features will work, as the JSR currently doesn't support .tsx files, the UI in the web application won't work. This is not recommended for production use due to current JSR limitations.
  • Deno + Git: The app can be deployed using Deno and Git. This is the most manual way to deploy the app, but also the most flexible. And it isn't that hard to do. This is not recommended for production use.

Docker

Prerequisites

Installation

In an installation directory of your choice, create a new directory for the app.

In this directory, create a new file called .env and copy the contents of the .env Example into it.

Carefully adjust the values in the .env file to your needs.

Create a new file called compose.yml and copy the following contents into it:

name: deno-asn-generator

services:
  app:
    image: ghcr.io/wuespace/deno-asn-generator:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:${HOST_PORT}:8080"
    volumes:
      - app-data:/data
    env_file: .env

volumes:
  app-data:

To be safer, you can also specify the version of the app by replacing latest with the version you want to use.

Running the Web Application

To start the app, run the following command in the installation directory:

docker compose up -d

To stop the app, run the following command in the installation directory:

docker compose down

Running the CLI

To run the CLI, run the following command in the installation directory:

docker compose run app --help

You can replace --help with any other command you want to run.

Updating the App

To update the app, run the following command in the installation directory:

docker compose down \
  && docker compose pull \
  && docker compose up -d

Portainer

Prerequisites

Installation

Log into your Portainer instance and create a new stack.

Enter a name for the stack, e.g., asn-generator.

In the Web Editor section, paste the following contents:

services:
  app:
    image: ghcr.io/wuespace/deno-asn-generator:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:${HOST_PORT}:8080"
    volumes:
      - app-data:/data
    env_file: stack.env

volumes:
  app-data:

Download the .env Example. In the Environment variables section, select Load variables from .env file and upload the example.env file.

Carefully adjust the environment variable values to your needs. You can find more information about the environment variables in the .env Example.

Click Deploy the stack.

Running the Web Application

By deploying the stack, the web application should be available at the specified port.

Running the CLI

In the Portainer UI, navigate to the container running the app.

Click on Exec Console.

As Command, choose /bin/bash.

Click Connect.

In the terminal that opens, run the following command:

deno task run --help

You can replace --help with any other command you want to run.

Once you're done, click Disconnect.

Updating the App

In the Portainer UI, navigate to the stack running the app.

Open the Editor tab.

Without changing anything, at the bottom of the tab, click Update the stack.

Enable Re-pull image and redeploy and click Update.

The app should now be updated.

Deno + JSR

Prerequisites

Installation

Create a new directory for the app. In this directory, create a new file called .env and copy the contents of the .env Example into it.

Carefully adjust the values in the .env file to your needs.

[!TIP] Note that you can also adjust the commented out variables that you could not adjust in the Docker deployment method, such as PORT or DATA_DIR.

Running the Web Application

[!WARNING] This deployment method is not recommended for production use due to current JSR limitations. The UI in the web application won't work.

If you want to use the web application, please use the Docker or Deno + Git deployment method.

To start the app, run the following command in the installation directory:

deno run -A --unstable-kv jsr:@wuespace/asn-generator

Running the CLI

To run the CLI, run the following command in the installation directory:

deno run -A --unstable jsr:@wuespace/asn-generator --help

You can replace --help with any other command you want to run.

Updating the App

You can specify the version of the app by appending @<version> to the JSR URL:

deno run -A --unstable-kv jsr:@wuespace/asn-generator@0.2.1

If the version is not downloaded yet, it will be downloaded and cached. To update the app, you can run the same command again with a different version.

Deno + Git

Prerequisites

Installation

Navigate to the installation directory of your choice.

Clone the repository:

git clone https://github.com/wuespace/deno-asn-generator.git \
  && cd deno-asn-generator

Copy the contents of the .env Example into a new file called .env. You can easily do this by running the following command:

cp env.example .env

Carefully adjust the values in the .env file to your needs.

[!TIP] Note that you can also adjust the commented out variables that you could not adjust in the Docker deployment method, such as PORT or DATA_DIR.

Running the Web Application

To start the app, run the following command in the installation directory:

deno task run

Running the CLI

To run the CLI, run the following command in the installation directory:

deno task run --help

You can replace --help with any other command you want to run.

Updating the App

To update the app, simply pull the latest changes from the repository:

git pull

To pin the app to a specific version, you can checkout a specific tag:

git checkout v0.2.1

Note that your .env file and ./data folder are not tracked by Git, so you don't have to worry about them being overwritten.