Build packages, maybe?
This commit is contained in:
parent
f7a919ebf2
commit
7f423652e3
7 changed files with 295 additions and 9 deletions
51
.drone.yml
Normal file
51
.drone.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: podcastrr
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: python:3.8-slim
|
||||||
|
commands:
|
||||||
|
- pip install -r requirements.txt
|
||||||
|
- pytest
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: ${DRONE_REPO_OWNER}/podcastrr
|
||||||
|
registry: ${DRONE_REGISTRY}
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- ${DRONE_COMMIT_SHA:0:8}
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
- name: notify
|
||||||
|
image: plugins/webhook
|
||||||
|
settings:
|
||||||
|
urls:
|
||||||
|
from_secret: webhook_url
|
||||||
|
content_type: application/json
|
||||||
|
template: |
|
||||||
|
{
|
||||||
|
"text": "Build ${DRONE_BUILD_NUMBER} for ${DRONE_REPO} completed with status ${DRONE_BUILD_STATUS}"
|
||||||
|
}
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- pull_request
|
12
.env.example
12
.env.example
|
@ -1,15 +1,23 @@
|
||||||
# Flask configuration
|
# Flask configuration
|
||||||
FLASK_ENV=development
|
FLASK_ENV=production
|
||||||
SECRET_KEY=your_secret_key_here
|
SECRET_KEY=your_secret_key_here
|
||||||
|
|
||||||
# Database configuration
|
# Database configuration
|
||||||
DATABASE_URI=sqlite:///instance/podcastrr.db
|
DATABASE_URI=sqlite:///instance/podcastrr.db
|
||||||
|
|
||||||
# Application configuration
|
# Application configuration
|
||||||
DOWNLOAD_PATH=C:\path\to\downloads
|
DOWNLOAD_PATH=/app/downloads
|
||||||
LOG_LEVEL=INFO
|
LOG_LEVEL=INFO
|
||||||
|
|
||||||
|
# Server configuration
|
||||||
|
PORT=5000
|
||||||
|
|
||||||
# API Keys (if needed)
|
# API Keys (if needed)
|
||||||
# ITUNES_API_KEY=your_itunes_api_key
|
# ITUNES_API_KEY=your_itunes_api_key
|
||||||
# SPOTIFY_CLIENT_ID=your_spotify_client_id
|
# SPOTIFY_CLIENT_ID=your_spotify_client_id
|
||||||
# SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
|
# SPOTIFY_CLIENT_SECRET=your_spotify_client_secret
|
||||||
|
|
||||||
|
# Forgejo registry configuration (for CI/CD and container registry)
|
||||||
|
# FORGEJO_REGISTRY=registry.your-forgejo-instance.com
|
||||||
|
# FORGEJO_USERNAME=your-username
|
||||||
|
# FORGEJO_PASSWORD=your-password
|
||||||
|
|
27
.gitignore
vendored
27
.gitignore
vendored
|
@ -3,3 +3,30 @@
|
||||||
/podcastrr.db
|
/podcastrr.db
|
||||||
/.venv/
|
/.venv/
|
||||||
/downloads/
|
/downloads/
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
.docker/
|
||||||
|
docker-compose.override.yml
|
||||||
|
.env
|
||||||
|
|
||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
*$py.class
|
||||||
|
*.so
|
||||||
|
.Python
|
||||||
|
build/
|
||||||
|
develop-eggs/
|
||||||
|
dist/
|
||||||
|
downloads/
|
||||||
|
eggs/
|
||||||
|
.eggs/
|
||||||
|
lib/
|
||||||
|
lib64/
|
||||||
|
parts/
|
||||||
|
sdist/
|
||||||
|
var/
|
||||||
|
wheels/
|
||||||
|
*.egg-info/
|
||||||
|
.installed.cfg
|
||||||
|
*.egg
|
||||||
|
|
58
README_CHANGES.md
Normal file
58
README_CHANGES.md
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
# Podcastrr - Forgejo Integration Changes
|
||||||
|
|
||||||
|
This document summarizes the changes made to integrate Podcastrr with Forgejo for CI/CD and container registry functionality.
|
||||||
|
|
||||||
|
## Files Created
|
||||||
|
|
||||||
|
1. **`.drone.yml`**
|
||||||
|
- CI/CD pipeline configuration for Forgejo
|
||||||
|
- Includes steps for testing, building Docker images, and notifications
|
||||||
|
- Automatically builds and pushes Docker images on pushes to the main branch
|
||||||
|
|
||||||
|
2. **`README_FORGEJO.md`**
|
||||||
|
- Comprehensive guide for setting up and using Podcastrr with Forgejo
|
||||||
|
- Includes instructions for repository setup, secrets configuration, and using the Docker image
|
||||||
|
|
||||||
|
3. **`docker-compose.override.yml.example`**
|
||||||
|
- Template for local customization of Docker Compose setup
|
||||||
|
- Provides examples for development-specific settings
|
||||||
|
|
||||||
|
## Files Updated
|
||||||
|
|
||||||
|
1. **`.gitignore`**
|
||||||
|
- Added Docker-specific entries
|
||||||
|
- Added common Python patterns
|
||||||
|
|
||||||
|
2. **`.env.example`**
|
||||||
|
- Updated for Docker compatibility (Linux-style paths)
|
||||||
|
- Added Forgejo-specific configuration variables
|
||||||
|
- Set production as the default environment
|
||||||
|
|
||||||
|
3. **`docker-compose.yml`**
|
||||||
|
- Made it more flexible for Forgejo integration
|
||||||
|
- Added environment variable interpolation with defaults
|
||||||
|
- Added commented options for using Forgejo registry
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
1. **Set up your Forgejo repository**
|
||||||
|
- Follow the instructions in `README_FORGEJO.md`
|
||||||
|
|
||||||
|
2. **Configure CI/CD secrets**
|
||||||
|
- Add the required secrets to your Forgejo repository settings
|
||||||
|
|
||||||
|
3. **Customize for your environment**
|
||||||
|
- Copy `.env.example` to `.env` and update with your settings
|
||||||
|
- Copy `docker-compose.override.yml.example` to `docker-compose.override.yml` for local customization
|
||||||
|
|
||||||
|
4. **Push to Forgejo**
|
||||||
|
- The CI/CD pipeline will automatically build and push your Docker image
|
||||||
|
|
||||||
|
5. **Pull and run the Docker image**
|
||||||
|
- Use the commands in `README_FORGEJO.md` to pull and run your Docker image
|
||||||
|
|
||||||
|
## Additional Information
|
||||||
|
|
||||||
|
- The Docker image is built using the existing Dockerfile, which was already well-configured
|
||||||
|
- The CI/CD pipeline includes testing to ensure code quality
|
||||||
|
- The Docker Compose setup allows for both local development and production deployment
|
106
README_FORGEJO.md
Normal file
106
README_FORGEJO.md
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
# Podcastrr - Forgejo Integration Guide
|
||||||
|
|
||||||
|
This guide explains how to set up and use Podcastrr with Forgejo for CI/CD and container registry integration.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- A Forgejo instance with:
|
||||||
|
- CI/CD capabilities (Drone integration)
|
||||||
|
- Container registry enabled
|
||||||
|
- Docker and Docker Compose installed on your local machine
|
||||||
|
- Git installed on your local machine
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
### 1. Repository Setup
|
||||||
|
|
||||||
|
1. Create a new repository in your Forgejo instance
|
||||||
|
2. Push this codebase to your new repository:
|
||||||
|
```bash
|
||||||
|
git init
|
||||||
|
git add .
|
||||||
|
git commit -m "Initial commit"
|
||||||
|
git remote add origin https://your-forgejo-instance.com/username/podcastrr.git
|
||||||
|
git push -u origin main
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Secrets Configuration
|
||||||
|
|
||||||
|
In your Forgejo repository settings, add the following secrets:
|
||||||
|
|
||||||
|
- `docker_username`: Your Forgejo username or container registry username
|
||||||
|
- `docker_password`: Your Forgejo password or container registry password
|
||||||
|
- `webhook_url` (optional): URL for build notifications
|
||||||
|
|
||||||
|
### 3. Environment Variables
|
||||||
|
|
||||||
|
Configure the following environment variables in your Forgejo CI/CD settings:
|
||||||
|
|
||||||
|
- `DRONE_REGISTRY`: Your Forgejo container registry URL (e.g., `registry.your-forgejo-instance.com`)
|
||||||
|
|
||||||
|
## CI/CD Pipeline
|
||||||
|
|
||||||
|
The included `.drone.yml` file defines a CI/CD pipeline that:
|
||||||
|
|
||||||
|
1. Runs tests on every push and pull request
|
||||||
|
2. Builds and pushes a Docker image to your container registry on pushes to the main branch
|
||||||
|
3. Sends notifications about build status (if configured)
|
||||||
|
|
||||||
|
## Using the Docker Image
|
||||||
|
|
||||||
|
### Pulling from Forgejo Container Registry
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker pull registry.your-forgejo-instance.com/username/podcastrr:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running with Docker Compose
|
||||||
|
|
||||||
|
1. Create a `.env` file with your configuration (see `.env.example`)
|
||||||
|
2. Update the `docker-compose.yml` file to use your image:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
image: registry.your-forgejo-instance.com/username/podcastrr:latest
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
volumes:
|
||||||
|
- ./downloads:/app/downloads
|
||||||
|
- ./instance:/app/instance
|
||||||
|
environment:
|
||||||
|
- FLASK_ENV=production
|
||||||
|
- SECRET_KEY=change_this_to_a_secure_random_string
|
||||||
|
- DATABASE_URI=sqlite:///instance/podcastrr.db
|
||||||
|
- DOWNLOAD_PATH=/app/downloads
|
||||||
|
- LOG_LEVEL=INFO
|
||||||
|
restart: unless-stopped
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Run the application:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building Locally
|
||||||
|
|
||||||
|
If you want to build the Docker image locally:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t podcastrr:local .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
- **CI/CD Pipeline Failures**: Check the build logs in Forgejo for detailed error messages
|
||||||
|
- **Container Registry Issues**: Ensure your Forgejo instance has the container registry enabled and you have proper permissions
|
||||||
|
- **Docker Image Not Found**: Verify the image name and tag in your docker-compose.yml file
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
- [Forgejo Documentation](https://forgejo.org/docs/)
|
||||||
|
- [Drone CI Documentation](https://docs.drone.io/)
|
||||||
|
- [Docker Documentation](https://docs.docker.com/)
|
31
docker-compose.override.yml.example
Normal file
31
docker-compose.override.yml.example
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
# Uncomment to use local build instead of Forgejo registry
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
args:
|
||||||
|
# Add build arguments if needed
|
||||||
|
- BUILD_ENV=development
|
||||||
|
|
||||||
|
# Uncomment to use Forgejo registry
|
||||||
|
# image: ${FORGEJO_REGISTRY}/${FORGEJO_USERNAME}/podcastrr:latest
|
||||||
|
|
||||||
|
# Override environment variables for local development
|
||||||
|
environment:
|
||||||
|
- FLASK_ENV=development
|
||||||
|
- LOG_LEVEL=DEBUG
|
||||||
|
|
||||||
|
# Add additional volumes for development
|
||||||
|
volumes:
|
||||||
|
- .:/app
|
||||||
|
|
||||||
|
# Add development-specific ports
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
- "5678:5678" # For debugger if needed
|
||||||
|
|
||||||
|
# Add development tools if needed
|
||||||
|
# command: python -m debugpy --listen 0.0.0.0:5678 main.py
|
|
@ -2,18 +2,23 @@ version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
|
# Use either build or image configuration
|
||||||
|
# For local development:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
# For Forgejo registry (uncomment and update):
|
||||||
|
# image: ${FORGEJO_REGISTRY}/${FORGEJO_USERNAME}/podcastrr:latest
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "${PORT:-5000}:5000"
|
||||||
volumes:
|
volumes:
|
||||||
- ./downloads:/app/downloads
|
- ./downloads:/app/downloads
|
||||||
- ./instance:/app/instance
|
- ./instance:/app/instance
|
||||||
environment:
|
environment:
|
||||||
- FLASK_ENV=production
|
- FLASK_ENV=${FLASK_ENV:-production}
|
||||||
- SECRET_KEY=change_this_to_a_secure_random_string
|
- SECRET_KEY=${SECRET_KEY:-change_this_to_a_secure_random_string}
|
||||||
- DATABASE_URI=sqlite:///instance/podcastrr.db
|
- DATABASE_URI=${DATABASE_URI:-sqlite:///instance/podcastrr.db}
|
||||||
- DOWNLOAD_PATH=/app/downloads
|
- DOWNLOAD_PATH=${DOWNLOAD_PATH:-/app/downloads}
|
||||||
- LOG_LEVEL=INFO
|
- LOG_LEVEL=${LOG_LEVEL:-INFO}
|
||||||
|
- PORT=${PORT:-5000}
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
Loading…
Add table
Add a link
Reference in a new issue