Skip to content

Commit

Permalink
Implement CI/CD pipeline (#17)
Browse files Browse the repository at this point in the history
Related to #1

Add CI/CD pipeline configuration and deployment commands.

* **README.md**
  - Add a section on how to configure and use the CI/CD pipeline.
- Include instructions for setting up environment variables for
deployment.

* **.github/workflows/ci-cd.yml**
  - Add specific deployment commands in the `deploy` job.
  - Include steps to deploy the application to a specified environment.

* **.env**
  - Add environment variables required for deployment.
  • Loading branch information
vishwamartur authored Nov 25, 2024
2 parents 678d6d3 + 82e5373 commit 50985c2
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,8 @@ WEATHER_API_ENDPOINT=your_weather_api_endpoint
# News API
NEWS_API_KEY=your_news_api_key
NEWS_API_ENDPOINT=your_news_api_endpoint

# Deployment Environment Variables
DEPLOYMENT_ENV=production
DEPLOYMENT_SERVER=your_deployment_server
DEPLOYMENT_PATH=/path/to/deployment
12 changes: 11 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ jobs:
DHAN_API_KEY: ${{ secrets.DHAN_API_KEY }}
DHAN_SECRET_KEY: ${{ secrets.DHAN_SECRET_KEY }}
CHATGPT_API_KEY: ${{ secrets.CHATGPT_API_KEY }}
TELEGRAM_BOT_API_KEY: ${{ secrets.TELEGRAM_BOT_API_KEY }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
WEATHER_API_KEY: ${{ secrets.WEATHER_API_KEY }}
WEATHER_API_ENDPOINT: ${{ secrets.WEATHER_API_ENDPOINT }}
NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
NEWS_API_ENDPOINT: ${{ secrets.NEWS_API_ENDPOINT }}
run: |
# Deploy command or script here
echo "Deployment step - Placeholder. Add actual deployment commands here."
echo "Starting deployment..."
# Example deployment commands
# python deploy.py --env production
# ./scripts/deploy.sh
echo "Deployment completed."
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,92 @@ A robust, high-performance cryptocurrency trading bot built in Python that lever
### Installation

1. Clone the repository:

```sh
git clone https://github.com/yourusername/nse-trading-bot.git
cd nse-trading-bot
```

2. Install dependencies:

```sh
pip install -r requirements.txt
```

3. Set up environment variables:

Create a `.env` file in the root directory of the project and add the following environment variables:

```sh
# API keys
DHAN_API_KEY=your_dhan_api_key
DHAN_SECRET_KEY=your_dhan_secret_key
CHATGPT_API_KEY=your_chatgpt_api_key

# WebSocket URL (Optional if the default URL is used)
DHAN_WEBSOCKET_URL=wss://api.dhan.co/ws/marketData

# Logging
LOG_LEVEL=INFO

# Email Notifications
NOTIFY_EMAIL=true
SMTP_SERVER=smtp.example.com
SMTP_PORT=587
EMAIL_ADDRESS=your_email@example.com
EMAIL_PASSWORD=your_email_password
RECIPIENT_LIST=recipient1@example.com,recipient2@example.com

# SMS Notifications (Optional)
NOTIFY_SMS=false
SMS_API_KEY=your_sms_api_key
SMS_API_SECRET=your_sms_api_secret
RECIPIENT_NUMBER=1234567890

# Logging configurations
LOG_FILE_PATH=logs/trading_bot.log
LOG_LEVEL=INFO

# Telegram Notifications
TELEGRAM_BOT_API_KEY=your_telegram_bot_api_key
TELEGRAM_CHAT_ID=your_telegram_chat_id

# Weather API
WEATHER_API_KEY=your_weather_api_key
WEATHER_API_ENDPOINT=your_weather_api_endpoint

# News API
NEWS_API_KEY=your_news_api_key
NEWS_API_ENDPOINT=your_news_api_endpoint
```

## CI/CD Pipeline Configuration

### Setting Up CI/CD Pipeline

The CI/CD pipeline is configured using GitHub Actions. The workflow file is located at `.github/workflows/ci-cd.yml`.

### Environment Variables for Deployment

Ensure the following environment variables are set in your GitHub repository secrets:

- `DHAN_API_KEY`
- `DHAN_SECRET_KEY`
- `CHATGPT_API_KEY`
- `TELEGRAM_BOT_API_KEY`
- `TELEGRAM_CHAT_ID`
- `WEATHER_API_KEY`
- `WEATHER_API_ENDPOINT`
- `NEWS_API_KEY`
- `NEWS_API_ENDPOINT`

### Running the CI/CD Pipeline

The CI/CD pipeline is triggered on every push to the `main` branch and on pull requests targeting the `main` branch. It includes jobs for testing and deployment.

To manually trigger the pipeline, you can use the "Run workflow" button in the Actions tab of your GitHub repository.

### Deployment Commands

The deployment step in the CI/CD pipeline includes commands to deploy the application to a specified environment. Ensure you have the necessary deployment scripts and configurations in place.

0 comments on commit 50985c2

Please sign in to comment.