Backend API for cheetah Web application to visualize and manage graphical representation of work using agile methodologies for agile teams
Please checkout or Kanban board to follow up the ongoing tasks.
The minimal setup is:
- PostgreSQL database with data
- Cheetah-api running and pointing to the PostgreSQL database
For this, we provide Dockefiles for both services. We will:
- Setup configuration file
- Build PostgreSQL and cheetah-api Docker images
- Create a Docker network to be able to communicate both services
- Deploy PostgreSQL and cheetah-api Docker containers
Edit ./etc/config.conf file and set parameters
host = 0.0.0.0
[...]
db_host = cheetah_api_postgresql_test
Save the file and let't create the Docker image
From the project dir, run
docker build -t cheetah_api .
From ./integration_tests dir, run:
docker build -t cheetah_api_postgresql .
Now we have the images created, let's setup the network and run the containers.
We need a Docker network to be able to communicate both services.
docker network create cheetah_net
Please note that, if you change here the network name, you have to change it too in the next docker commands.
We provide a PostgreSQL Dockerfile with test data (See next chapter for this). You can build the image and then run the container.
docker run --rm -p 5432:5432 --net cheetah_net --name cheetah_api_postgresql_test cheetah_api_postgresql
We provide a Dockerfile to run cheetah-api service
docker run --rm -p 8081:80 --net cheetah_net --name cheetah-api cheetah_api:latest
Where 8081 is the port in your host and the 80 is the port configured for cheetah-api in etc/config.conf file. Please note that the container name for PostgreSQL service should be set in "db_host" parameter in ./etc/config.conf file.
From a host, just run:
curl -d '{"authenticate":{"username":"foo","password":"foo"}}' -H "Content-Type: application/json" -X POST http://localhost:8081/v1/authenticate
Please note that user "foo" with password "foo" is provided in the PostgreSQL Dockerfile as sample data.
- Install docker in your system
- Run ./integration_tests/docker_up.sh
This will put in place small demo data, like user foo/foo.
- Modify the ./integration_tests/etc/config.conf file updating the port from the port opened in the PosgreSQL docker container
- Run
python -m cheetahapi.main -c /path/to/cheetah-api/integration_tests/etc/config.conf
You will get something like
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: Do not use the development server in a production environment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://localhost:8081/ (Press CTRL+C to quit)
Please see here how to interact with API, the first thing is GET A TOKEN.
To execute the tests and get the report xml file. From the root dir of the project:
nosetests -w tests --with-xunit --with-coverage --cover-package=cheetahapi