asoul-video

command module
v0.0.0-...-82df24b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 11 Imported by: 0

README

🎬 asoul-video Go Go Report Card Sourcegraph

配置开发环境

前端

TBD

后端

A-SOUL Video 后端二进制文件需要在 Linux 系统上运行,但你可以在 macOS、Windows 等系统上进行开发。

步骤 1: 安装依赖

A-SOUL Video 后端需要安装以下依赖:

macOS
  1. 安装 Homebrew.

  2. 安装依赖:

    brew install go postgresql git
    
  3. 配置 PostgreSQL 数据库自启动:

    brew services start postgresql
    
  4. 确保在 $PATH 环境变量中设置了 PostgreSQL 客户端命令 psql 的路径。通过 Homebrew 的安装默认不会设置该环境变量。执行 brew info postgresql 命令,可以在 Caveats 段落中看到 Homebrew 提供的安装 psql 的方法。除此之外,也可以使用下方的命令进行安装,注意你可能需要根据本机 Homebrew 以及终端环境修改命令中的参数。

    hash psql || { echo 'export PATH="/usr/local/opt/postgresql/bin:$PATH"' >> ~/.bash_profile }
    source ~/.bash_profile
    
步骤 2: 数据库初始化

你需要创建一个全新的 Postgres 数据库和一个对该数据库拥有完全操作权限的数据库用户。

  1. 为当前 UNIX 用户创建数据库。

    # 对于 Linux 用户,首先需要切换到 postgres 用户终端下
    sudo su - postgres
    
    createdb
    
  2. 创建 A-SOUL Video 用户并设置密码。

    createuser --superuser asoulvideo
    psql -c "ALTER USER asoulvideo WITH PASSWORD 'asoulvideo';"
    
  3. 创建 A-SOUL Video 数据库。

    createdb --owner=asoulvideo --encoding=UTF8 --template=template0 asoulvideo
    
步骤 3: 拉取代码

通常来说,你并不需要拉取所有的历史代码,因此可以设置 --depth 1 参数。

git clone --depth 1 https://github.com/asoul-video/asoul-video

注意 本仓库开启 Go Module,请将仓库目录放置在你的 $GOPATH 目录之外。

步骤 4: 配置数据库连接

A-SOUL Video 后端从以下环境变量中读取数据库连接参数。 PG* 环境变量.

将以下这些环境变量参数添加至 ~/.bashrc 文件中:

export PGHOST=localhost
export PGUSER=asoulvideo
export PGPASSWORD=asoulvideo
export PGDATABASE=asoulvideo
export PGSSLMODE=disable

你也可以使用类似 direnv 这样的工具来管理你的环境变量。

步骤 5: 启动 Web 服务器

启动 Web 服务器前,你需要确保以下环境变量中的参数数正确可用的,并将他们添加至你的 ~/.bashrc 文件中:

# 爬虫上报数据时的鉴权参数
export SOURCE_REPORT_KEY=<REDACTED>
go build . && ./asoul-video

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
assets
internal
db
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL