跳转到主要内容

直接在PikaPods上部署

PIKAPODS起价每月最低1.5美元。 此外,PIKAPODS将为所有新用户提供5美元的体验金!并且从PIKAPODS部署产生的费用中的20%将捐赠给Blinko。快来支持我们吧! Run on PikaPods

先决条件

运行Blinko需要Docker。访问Docker安装Docker。
安全警告:您必须在下面所有安装方法中更改NEXTAUTH_SECRET值。使用默认值会带来重大安全风险。为生产环境生成一个强随机字符串。生成安全密钥的示例:
openssl rand -base64 32
# 或
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"

Bash脚本安装

install.sh使用docker run来部署Blinko。如果您认为这不安全,可以使用下面的其他方法。
curl -o install.sh https://raw.githubusercontent.com/blinko-space/blinko/main/install.sh && bash install.sh

Docker安装

  1. 必须挂载postgres的数据卷,否则您的数据将丢失
  2. NEXTAUTH_SECRET=my_ultra_secure_nextauth_secret替换为您自己的安全密钥

步骤1:创建自定义Docker网络

docker network create blinko-network

步骤2:运行PostgreSQL数据库容器

docker run -d \
--name blinko-postgres \
--network blinko-network \
-v <your-path>:/var/lib/postgresql/data \
-p 5435:5432 \
-e POSTGRES_DB=postgres \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=mysecretpassword \
-e TZ=Asia/Shanghai \
--restart always \
postgres:14

步骤3:运行Blinko网站容器

docker run -d \
--name blinko-website \
--network blinko-network \
-v <your-path>:/app/.blinko \
-p 1111:1111 \
-e NODE_ENV=production \
-e NEXTAUTH_URL=http://localhost:1111 \
-e NEXT_PUBLIC_BASE_URL=http://localhost:1111 \
-e NEXTAUTH_SECRET=my_ultra_secure_nextauth_secret \
-e DATABASE_URL=postgresql://postgres:mysecretpassword@blinko-postgres:5432/postgres \
--restart always \
blinkospace/blinko:latest

Docker Compose安装

要使用docker compose部署Blinko,请创建一个docker-compose.yml文件,配置如下:
  networks:
    blinko-network:
      driver: bridge

  services:
    blinko-website:
      image: blinkospace/blinko:latest
      container_name: blinko-website
      environment:
        NODE_ENV: production
        # NEXTAUTH_URL: http://localhost:1111
        # IMPORTANT: If you want to use sso, you must set NEXTAUTH_URL to your own domain
        # NEXT_PUBLIC_BASE_URL: http://localhost:1111
        # IMPORTANT: Replace this with your own secure secret key!
        NEXTAUTH_SECRET: my_ultra_secure_nextauth_secret
        DATABASE_URL: postgresql://postgres:mysecretpassword@postgres:5432/postgres
      depends_on:
        postgres:
          condition: service_healthy
      # Make sure you have enough permissions.
      # volumes:
        # - ~/your-name/.blinko:/app/.blinko 
      restart: always
      logging:
        options:
          max-size: "10m"
          max-file: "3"
      ports:
        - 1111:1111
      healthcheck:
        test: ["CMD", "wget", "--spider", "-q", "http://blinko-website:1111/"]
        interval: 30s 
        timeout: 10s   
        retries: 5     
        start_period: 30s 
      networks:
        - blinko-network

    postgres:
      image: postgres:14
      container_name: blinko-postgres
      restart: always
      ports:
        - 5435:5432
      environment:
        POSTGRES_DB: postgres
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: mysecretpassword
        TZ: Asia/Shanghai
      # Persisting container data
      # Make sure you have enough permissions.
      # volumes:
        # - ~/your-name/.db:/var/lib/postgresql/data
      healthcheck:
        test:
          ["CMD", "pg_isready", "-U", "postgres", "-d", "postgres"]
        interval: 5s
        timeout: 10s
        retries: 5
      networks:
        - blinko-network
docker-compose -f docker-compose.yml up -d
I