【作業記録】scoold と para を使ってQAサイトをローカルに構築

環境

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
$ docker -v
Docker version 20.10.7, build f0df350
$ docker-compose -v
docker-compose version 1.25.0, build unknown
$ node -v
v16.4.2
$ npm -v
7.18.1

それぞれを立ち上げてみる

# scoold-application.conf

### Minimal configuration ###
# the name of the application
para.app_name = "Scoold"
# the port for Scoold
para.port = 8000
# change this to "production" later
para.env = "development"
# the public-facing URL where Scoold is hosted
para.host_url = "http://localhost:8000"
# the URL of Para - can also be "https://paraio.com"
para.endpoint = "http://para:8080"
# access key for your Para app
para.access_key = "app:scoold"
# secret key for your Para app
para.secret_key = ""
# the email or identifier of the admin user - check Para user object
para.admins = "admin@domain.com"

####### Authentication #######
# enable or disable email and password authentication
para.password_auth_enabled = true

####### Misc #######
# if false, commenting is allowed after 100+ reputation
para.new_users_can_comment = true
# If true, the default space will be accessible by everyone
para.is_default_space_public = true
  • para.secret_key にはあとでシークレットキーをセットします
# para-application.conf
para.env = "development"
para.dao = "H2DAO"
para.security.allow_unverified_emails = true
  • paraのnodejsクライアントをインストールします
  • ツールの名前とバージョンはこちら
$ para-cli --version
1.15.2
  • 一度 docker-compose up で立ち上げます
# 立ち上げた後、以下のコマンドでparaから設定に必要な情報を受け取ります
$ curl localhost:8080/v1/_setup
{
  "accessKey" : "app:para",
  "message" : "Save these keys - they are shown only once!",
  "secretKey" : "H6orTyiuJJGEc0UDcsrrkprxPEYOaJTVE/Drv/oBVCTIjxH0JyZLZw=="
}
# paraに接続
$ para-cli setup
Para Access Key: app:para
Para Secret Key: H6orTyiuJJGEc0UDcsrrkprxPEYOaJTVE/Drv/oBVCTIjxH0JyZLZw==
Para Endpoint: localhost:8080
✔ New JWT generated and saved in /home/bookstore/.config/para-cli-nodejs/config.json
✔ Connected to Para server v1.39.2 on localhost:8080. Authenticated as: app para (app:para)
# アプリなるものを新しく作ります
# テナントごとにアプリがあるイメージでしょうか
$ para-cli new-app "scoold" --name "scoold"
✔ App created:
{
  "accessKey": "app:scoold",
  "message": "Save these keys - they are shown only once!",
  "secretKey": "P9vbAx1nfVS2DyQMtliSRYe5A/CgGxpI8all5yo59MOid8aiqyKcxQ=="
}
# 個々で受け取った secretKey を scoold-application.conf の para.secret_key にセットします
  • コンテナを再起動させます
  • localhost:8000 にアクセスするとscooldのページが表示されます

参考