Web Panel for fomalhaut, still in development.
这是 fomalhaut 项目的 Web 控制台,目前仍然在开发中。
目前只在 Python 2.7 环境下测试过
# database
redis
mysql
mongodb
可以导入 json 配置文件,参考样例在 /doc/export_config.json
请使用 Supervisor + Gunicorn + Nginx 来部署 Django
settings.py,更多配置请查看该文件
# Redis 配置
REDIS_HOST = '127.0.0.1'
REDIS_PORT = 6379
REDIS_DB = 0
REDIS_PASSWORD = 'your_password'
REDIS_MAX_CONNECTIONS = 100
# MongoDB 配置
MONGO_HOST = '127.0.0.1'
MONGO_PORT = 27017
MONGO_USERNAME = 'api_gateway_user'
MONGO_PASSWORD = 'api_gateway_password'
MONGO_DBNAME = 'api_gateway'
# 访问日志,数据库保存天数,超过指定天数会删除
ACCESS_LOG_KEEP_DAYS = 60
大部分 Collection 的索引会由 MongoEngine 自动创建, 但是有几个 GridFS 的索引需要手动创建, 进入 MongoDB shell 后, 执行如下命令
db.request_body.files.createIndex( { md5: 1} );
db.request_headers.files.createIndex( { md5: 1} );
db.response_body.files.createIndex( { md5: 1} );
db.response_headers.files.createIndex( { md5: 1} );
账号系统实现了忘记密码邮件通知, 需要安装 Postfix, 可以参考 Python 使用 Postfix 发送邮件
python manage.py makemigrations
python manage.py makemigrations djkombu
python manage.py migrate
定时解析访问统计数据的任务,依赖于 Celery,推荐使用 supervisor 来管理进程。启动 beat 和 worker:
python manage.py celery beat --loglevel=info
python manage.py celery worker --loglevel=info
- Client, API Endpoint 配置
- 用户账号
- 访问日志
- 首页的访问统计
- IP 白名单, 黑名单配置