An unofficial docker distribution project.
!Beta
- Python 3
- Django
- Django Rest Framework
- ecdsa
- Nginx
-
rename configuration file
mv /path/to/andromeda/etc/andromeda.ini.example /path/to/andromeda/etc/andromeda.ini
-
modify configuration file
[storage] repo_dir=tmp/v2/repo # reposities storage path blob_dir=tmp/v2/blob # blob storage path [email] # Report Email Settings host = smtp.xxx.com port = 465 user = django@xxx.com password = password subject_prefix = '[django-andromeda]'
-
rename django SECRET KEY file
mv /path/to/andromeda/etc/key.txt.example /path/to/andromeda/etc/key.txt
-
generate a SECRET KEY for django
-
install dependency
Recommend using virtualenv to isolate your Python dependency environment,
pip install -r requirements/prodn.txt
-
modify nginx config file
reference: /path/to/andromeda/etc/nginx.conf
-
Dev Environment
Please use
runserver
,if just use it in developmenent environment,python manage.py runserver
-
Production Environment
Recommend using Gunicorn as a web container for django ,why not use runserver in prodoction environment
gunicorn andromeda.wsgi -w 8 -b 0.0.0.0:8000
-
Use Docker
Andromeda available in Docker Hub. You can run andromeda in docker via docker-compose
version: "2" services: app: image: pivstone/andromeda:latest volumes: - /srv/andromeda/etc:/srv/andromeda/etc - /srv/andromeda/logs:/srv/andromeda/logs - /srv/andromeda/data:/srv/andromeda/data ports: - 5511:5511 working_dir: /srv/andromeda restart: always
install tox
> tox
worker_processes auto;
events {
worker_connections 1024;
use epoll;
multi_accept on;
}
server {
listen 80 ;
client_max_body_size 0;
tcp_nodelay on;
location /v2 {
proxy_http_version 1.1; # 强制 1.1
proxy_pass http://127.0.0.1:8000; # 后端接口
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_request_buffering on;
chunked_transfer_encoding on; # 让 Nginx 处理 Chunked 请求
}
location /download/blobs {
alias /Users/andromeda/tmp/v2/blob; # Blobs 文件地址
expires 1d; # Blobs 内容级别不变,可以考虑半永久缓存
}
}