preparing for public release
All checks were successful
Build and Publish Docker Image / build (push) Successful in 41s

This commit is contained in:
Timothy Rogers 2025-05-24 17:09:58 -04:00
parent 5d37c7720d
commit 85086c0077
4 changed files with 116 additions and 2 deletions

12
.env.example Normal file
View file

@ -0,0 +1,12 @@
## Database Configuration
DATABASE_URL=sqlite:///instance/app.db
## File Storage
#STORAGE_URL=file://some/local/path/uploads
## S3 Storage Back-end
#STORAGE_URL=s3://bucketname
#S3_ACCESS_KEY=some-secure-user-key
#S3_SECRET_KEY=some-secure-secret-key
#S3_ENDPOINT_URL=http://localhost:9000 # Optional, for S3-compatible services
#S3_PUBLIC_URL=http://your-public-url # Optional, for direct file access

103
README.md
View file

@ -1 +1,104 @@
# Assets Site
A digital asset management system built with Flask and S3-compatible storage.
## Features
- Digital asset management with metadata
- S3-compatible storage backend (works with MinIO, public buckets only atm)
- Automatic WebP conversion for images
- License key management
- Docker container support
## Container Registry
This project includes automated container builds using Forgejo CI/CD. The container images are published to the project's container registry.
### Using the Container Image
To pull the latest image:
```bash
docker pull git.hack13.dev/hack13/personal-digital-asset-manager:latest
```
For a specific version:
```bash
docker pull git.hack13.dev/hack13/personal-digital-asset-manager:v1.0.0
```
### CI/CD Setup
The project uses Forgejo CI/CD to automatically build and publish container images. To set up the CI/CD pipeline:
1. Configure the following variables in your Forgejo repository settings (Settings > Variables):
- `FORGEJO_REGISTRY`: Your Forgejo registry URL (e.g., forgejo.yourdomain.com)
- `FORGEJO_OWNER`: Your Forgejo username or organization name
- `FORGEJO_USER`: Username for registry authentication
2. Add the following secret in your Forgejo repository settings (Settings > Secrets):
- `FORGEJO_TOKEN`: Access token for Forgejo registry authentication
3. Enable Forgejo Actions in your repository settings
### Container Tags
The following tags are automatically generated:
- `latest`: Latest build from the main branch
- `v*`: Release tags (e.g., v1.0.0)
- `sha-*`: Build for specific commit
## Development
### Local Setup
1. Clone the repository
2. Create and activate a virtual environment
3. Install dependencies: `pip install -r requirements.txt`
4. Set up environment variables (see `.env.example`)
5. Run migrations: `flask db upgrade`
6. Start the server: `flask run`
### Database Migrations
This project uses Flask-Migrate (Alembic) for database migrations. The migrations folder is version controlled and should be included in your commits.
#### Working with Migrations
1. Create a new migration after model changes:
```bash
flask db migrate -m "Description of changes"
```
2. Review the generated migration in `migrations/versions/`
3. Apply migrations:
```bash
flask db upgrade
```
4. Rollback migrations:
```bash
flask db downgrade
```
#### First-time Setup
When cloning the repository:
1. Initialize the database: `flask db upgrade`
2. This will apply all existing migrations in order
### Docker Development
Build the container:
```bash
docker build -t personal-digital-asset-manager .
```
Run the container:
```bash
docker run -p 5000:5000 \
-v $(pwd)/static/uploads:/app/static/uploads \
personal-digital-asset-manager
```

1
app.py
View file

@ -27,7 +27,6 @@ app = create_app()
storage = StorageBackend(app.config['STORAGE_URL'])
def generate_unique_filename(original_filename):
"""Generate a unique filename while preserving the original extension"""
# Get the file extension
ext = os.path.splitext(original_filename)[1] if '.' in original_filename else ''
# Generate a unique filename using UUID

View file

@ -17,7 +17,7 @@ check_required_vars() {
# Check required environment variables (add your required variables here)
check_required_vars "FLASK_APP" "FLASK_ENV" "STORAGE_URL"
# Wait for database to be ready (if using PostgreSQL)
# Wait for database to be ready (for future use)
# until PGPASSWORD=$DATABASE_PASSWORD psql -h "$DATABASE_HOST" -U "$DATABASE_USER" -d "$DATABASE_NAME" -c '\q'; do
# echo "Waiting for database..."
# sleep 1