はじめに
前回の記事(NocoBaseを使ってみたら、業務アプリ開発が驚くほど簡単だった話)では、NocoBaseの魅力について紹介しました。
今回は、実際にUbuntu環境にNocoBaseをインストールする手順を解説します。
本記事は以下の事前知識が必要です。
- Docker
- 簡単なLinuxの知識
1. 環境情報
今回使用する環境は以下のとおりです。
- OS: Ubuntu 22.04
- Docker: インストール済み
- NocoBase: Docker Composeを使ってセットアップ
- DB: postgresql
2. NocoBaseをセットアップする
基本的には、公式サイトの手順に従います。
2.1 インストールディレクトリを作成
好きなパス、ディレクトリ名で大丈夫です。
ここではホームディレクトリに「nocobase」を作り餡巣。
mkdir nocobase && cd nocobase
2.2 docker-compose.ymlを作成
nano docker-compose.yml
公式とは少し変えています。
docker-compose.yml
networks:
nocobase:
driver: bridge
services:
app:
image: nocobase/nocobase:latest
restart: always
networks:
- nocobase
depends_on:
postgres:
condition: service_healthy
environment:
# The application's secret key, used to generate user tokens, etc.
# If APP_KEY is changed, old tokens will also become invalid.
# It can be any random string, and make sure it is not exposed.
- APP_KEY=[ここはランダム]
# Database type, supports postgres, mysql, mariadb
- DB_DIALECT=postgres
# Database host, can be replaced with the IP of an existing database server
- DB_HOST=postgres
# Database name
- DB_DATABASE=nocobase
# Database user
- DB_USER=nocobase
# Database password
- DB_PASSWORD=nocobase
# Timezone
- TZ=Asia/Tokyo
# Service platform username and password,
# used for automatically downloading and updating plugins.
- NOCOBASE_PKG_USERNAME=
- NOCOBASE_PKG_PASSWORD=
volumes:
- app:/app/nocobase/storage
ports:
- '13000:80'
# init: true
# If using an existing database server, postgres service can be omitted
postgres:
image: postgres:16
restart: always
command: postgres -c wal_level=logical
environment:
POSTGRES_USER: nocobase
POSTGRES_DB: nocobase
POSTGRES_PASSWORD: nocobase
TZ: Asia/Tokyo
volumes:
- db:/var/lib/postgresql/data
networks:
- nocobase
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-nocobase}"]
interval: 5s
retries: 3
ports:
- '5432:5432'
volumes:
app:
db:
2.3 NocoBase起動!
docker compose up -d
3. NocoBaseへアクセス
http://localhost:13000 へアクセスしましょう!
初期のAdminのアカウントでログイン可能です。
- Email:admin@nocobase.com
- パスワード:admin123
まとめ
今回は、ConoHa VPS(Ubuntu)にDockerを使ってNocoBaseをインストールする手順 を紹介しました。
NocoBaseはセットアップが簡単で、すぐに業務アプリの開発が始められます。
ぜひ試してみてください!
次回以降は、公式ガイドブックにはない痒い所に手が届きそうな小ネタ集を紹介します