Bar Assistant へのアクセス
- Web インターフェース:
https://<SERVER_IP> - REST API:
https://<SERVER_IP>/bar - Meilisearch:
https://<SERVER_IP>/search - 自己署名証明書を使用しているため、ブラウザで SSL 警告が表示されるのは想定内です。
初回セットアップ
1. 次の URL をブラウザーで開きます: https://<SERVER_IP>
2. Register をクリックします。
3. 最初のユーザーアカウントを作成します。
4. 登録が完了したら、次のファイルを編集して一般登録を無効にします:
vim /root/barassistant/docker-compose.yml
変更します ALLOW_REGISTRATION: "true" to ALLOW_REGISTRATION: "false".
変更を適用:
cd /root/barassistant
docker compose up -d
重要なファイルとディレクトリ
- インストールパス:
/root/barassistant - Compose ファイル:
/root/barassistant/docker-compose.yml - 環境ファイル:
/root/barassistant/.env - Nginx の設定:
/etc/nginx/sites-available/barassistant - SSL 証明書:
/etc/nginx/ssl/barassistant.crt - SSL鍵:
/etc/nginx/ssl/barassistant.key - Bar データディレクトリ:
/var/lib/docker/volumes/barassistant_bar_data/_data - Meilisearch データディレクトリ:
/var/lib/docker/volumes/barassistant_meilisearch_data/_data
Bar Assistant の管理
実行中のコンテナーを表示:
docker compose -f /root/barassistant/docker-compose.yml ps
すべてのコンテナーを再起動:
docker compose -f /root/barassistant/docker-compose.yml restart
アプリケーションのログを追跡します:
docker compose -f /root/barassistant/docker-compose.yml logs -f
アプリケーションを停止します:
docker compose -f /root/barassistant/docker-compose.yml down
アプリケーションを起動します:
docker compose -f /root/barassistant/docker-compose.yml up -d
Nginxの管理
ステータスを確認:
systemctl status nginx
Nginx を再起動:
systemctl restart nginx
Nginx を再読み込み:
systemctl reload nginx
設定を検証します:
nginx -t
ドメインでSSLを有効化する
1. ドメインをサーバーIPに向ける。
2. Nginxの設定を編集し、両方を置き換える server_name _; あなたのドメイン (server_name <yourdomain.com>) をHTTP (ポート80) とHTTPS (ポート443) の両方のブロックに設定:
vim /etc/nginx/sites-available/barassistant
3. Certbotをインストール:
apt install -y certbot python3-certbot-nginx
4. 有効な Let's Encrypt 証明書を生成するために次のコマンドを実行します:
certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com
5. Nginx設定内のSSLパスを置き換える:
vim /etc/nginx/sites-available/barassistant
# Before:
# ssl_certificate /etc/nginx/ssl/barassistant.crt;
# ssl_certificate_key /etc/nginx/ssl/barassistant.key;
# After:
# ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
6. 変更を適用するために Nginx を再読み込みします:
systemctl reload nginx
7. 次を編集します /root/barassistant/.env そして次の中のサーバー IP を置き換えます API_URL と MEILISEARCH_URL with your domain:
API_URL=https://yourdomain.com/bar
MEILISEARCH_URL=https://yourdomain.com/search
8. サービスを再作成:
cd /root/barassistant
docker compose up -d
9. ブラウザを開いて次にアクセス: https://yourdomain.com
リバースプロキシの確認
- 開きます
https://yourdomain.com/bar。次のように表示されるはずです: "This is your Bar Assistant instance." - 開きます
https://yourdomain.com/bar/docs。Swagger API のドキュメントが表示されるはずです。 - 開きます
https://yourdomain.com/bar/api/server/version。サーバーのバージョンを含む JSON レスポンスが返るはずで、"Resource not found" エラーにはなりません。