87 lines
2.0 KiB
Markdown
87 lines
2.0 KiB
Markdown
# Setup
|
|
|
|
This guide provides instructions on how to set up and run the application.
|
|
|
|
## Prerequisites
|
|
|
|
Ensure you have the following installed on your system:
|
|
- **Docker**: Install Docker from [docker.com](https://www.docker.com/get-started)
|
|
- **Docker Compose**: Docker Compose is included with Docker Desktop (for macOS/Windows) or can be installed separately on Linux.
|
|
|
|
## Steps to Set Up the Application
|
|
|
|
### 1. Clone the Repository
|
|
|
|
First, clone the repository to your local machine:
|
|
|
|
```bash
|
|
git clone https://github.com/username/repository.git
|
|
cd repository
|
|
```
|
|
|
|
|
|
### 2. Create a `.env` File
|
|
|
|
Before running the application, create a `.env` file in the root directory and add the required environment variables:
|
|
|
|
```bash
|
|
touch .env
|
|
```
|
|
|
|
Then, open the `.env` file and add the following:
|
|
|
|
```ini
|
|
# Environment Variables
|
|
VALID_API_KEY=testtest-api-key-12345
|
|
VALID_APP_ID=app1
|
|
SWAGGER_URL="/documentation"
|
|
API_URL="/swagger.json"
|
|
```
|
|
|
|
This ensures that the application uses secure API keys and app IDs.
|
|
|
|
### 3. Run the Application with Docker Compose
|
|
|
|
Once you have the repository cloned, you can easily set up and run the application using Docker Compose. Simply execute the following command:
|
|
|
|
```bash
|
|
docker-compose up -d --build
|
|
```
|
|
|
|
This command will build the Docker image and start the Flask application in a container. By default, the application will be accessible at `http://localhost:6337`.
|
|
|
|
### 4. Health Check
|
|
|
|
You can check if the Flask application is running by accessing the `/health` endpoint. To perform a health check, run the following command:
|
|
|
|
```bash
|
|
curl http://localhost:6337/health
|
|
```
|
|
|
|
If the application is running properly, you should receive a response similar to this:
|
|
|
|
```json
|
|
{
|
|
"status": "ok"
|
|
}
|
|
```
|
|
|
|
### 5. Documentation
|
|
|
|
You can check the Swagger Doc by accessing the `/documentation` endpoint. Run the following command:
|
|
|
|
```bash
|
|
curl http://localhost:6337/documentation
|
|
```
|
|
|
|
|
|
### 6. Stop the Application
|
|
|
|
To stop the application, use:
|
|
|
|
```bash
|
|
docker-compose down
|
|
```
|
|
|
|
This will stop and remove the containers created by Docker Compose.
|