Python(Streamlit)で作った勤怠集計アプリを
- VPS(ConoHa)
- 独自ドメイン(akkamilabo.com)
- SSL(Let's Encrypt)
で外部公開した話を書きます。
目標
作った勤怠アプリを次のように運用することが目標です。
- 社内・社外どこからでもブラウザで使える
- HTTPS対応で安心
- VPS月額約700円で運用
使用環境
項目 | 内容 |
---|---|
サーバー | ConoHa VPS(512MBプラン) |
OS | Ubuntu 22.04 LTS |
ドメイン | akkamilabo.com |
言語/フレームワーク | Python 3.11 + Streamlit |
Webサーバー | Nginx |
SSL証明書 | Let's Encrypt |
デプロイまでの流れ
1️⃣ ConoHa VPS契約&起動
- Ubuntu 22.04 LTSを選択し、rootパスワードを設定。
- VPSのグローバルIPを確認。
2️⃣ 独自ドメイン取得&DNS設定
- お名前.comで「akkamilabo.com」を取得。
- AレコードにVPSのIPを設定。
3️⃣ VPSへSSH接続
ssh root@<VPSのIPアドレス>
4️⃣ Python/Streamlit環境構築
apt update -y && apt upgrade -y
apt install -y python3 python3-pip python3-venv
python3 -m venv /root/venv
source /root/venv/bin/activate
pip install streamlit pandas openpyxl
5️⃣ 勤怠SaaSアプリ配置
/root/app.py にStreamlitアプリを配置。
6️⃣ Nginxインストール&設定
apt install -y nginx certbot python3-certbot-nginx
7️⃣ SSL証明書取得
certbot --nginx -d akkamilabo.com -d www.akkamilabo.com
8️⃣ Streamlitサービス化
systemctl daemon-reload
systemctl enable --now streamlit
✅ 完成
ブラウザでアクセス:
HTTPS対応+勤怠SaaSが外部公開できました!
所感
-
小規模SaaSならこの構成で十分
-
同時アクセスが増えるなら FastAPI + Gunicorn 移行がオススメ
-
VPS512MBでも動くが、1GBならもっと快適