- Ubuntu (18.04 or previous version)
- Python 3.6
- Redis server
- NodeJS (if host by python venv)
$ git clone https://github.com/NKUST-ITC/AP-API
$ cd AP-API
$ python -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
$ redis-server &
$ python src/web-server.py
Requirement
- Redis instance running on localhost
Need to add environment variable -e REDIS_URL=redis://127.0.0.1:6379/0
or by export
$ export REDIS_URL=redis://127.0.0.1:6379/0
And let docker run host network need add --network="host"
Otherwise redis config by docker network(see docker-compose.yml config)
Arguments gunicorn_cfg.py web-server:app is production flask uWSGI
$ sudo docker run --network="host" nkustitc/ap-api:latest gunicorn -c gunicorn_cfg.py web-server:app
or replace by python3 web-server.py
$ sudo docker run --network="host" nkustitc/ap-api:latest python3 web-server.py
Copy .env example
- CADDY_HOST_HTTPS_PORT -> caddy https host port
- REDIS_URL -> python request redis url
$ cp env.example .env
Copy caddy host config example
$ cd caddy
$ cp Caddyfile.example Caddyfile
Edit Caddyfile's host config**(Production)**
- line 1 0.0.0.0:2087 replace by you want host domain and port
0.0.0.0:2087 {
proxy / https://web:14769 {
transparent
insecure_skip_verify
}
gzip
tls example@gmail.com
}
start docker-compose (if need re download package, can add --build build by Dockerfile)
$ sudo docker-compose up
You must fixed manually about flask_apiblueprint
site-packages/flask_apiblueprint/flask_apiblueprint.py
Change .iteritems() to .items() in two place