Compare commits

...

8 Commits

Author SHA1 Message Date
Schuwi
6548a06b43 ci: fix container tags again
All checks were successful
Code Quality / Code Quality (Elixir 1.15.7 OTP 26.2) (push) Successful in 1m53s
Docker Build and Publish / docker-build (push) Successful in 1m2s
2025-09-21 11:33:15 +02:00
Schuwi
7ce80b6026 ci: fix container tag policy
Some checks failed
Code Quality / Code Quality (Elixir 1.15.7 OTP 26.2) (push) Successful in 1m53s
Docker Build and Publish / docker-build (push) Failing after 25s
- only move `latest` on tagged releases
2025-09-21 10:58:39 +02:00
Schuwi
d620a9c620 docs: use pre-built docker image 2025-09-21 10:53:19 +02:00
Schuwi
4c7751f1ea ci: re-enable docker cache
All checks were successful
Code Quality / Code Quality (Elixir 1.15.7 OTP 26.2) (push) Successful in 3m41s
Docker Build and Publish / docker-build (push) Successful in 4m38s
2025-09-21 10:35:00 +02:00
a714d5a28f ci: disable docker cache for now
All checks were successful
Code Quality / Code Quality (Elixir 1.15.7 OTP 26.2) (push) Successful in 22m7s
Docker Build and Publish / docker-build (push) Successful in 4m4s
2025-09-20 20:15:19 +02:00
e33f700485 Merge pull request 'ci: fix quality checks pipeline' (#5) from schuwi-patch-1 into main
Some checks failed
Code Quality / Code Quality (Elixir 1.15.7 OTP 26.2) (push) Successful in 22m8s
Docker Build and Publish / docker-build (push) Failing after 5m9s
Reviewed-on: #5
2025-09-20 18:58:40 +02:00
cff6680f3a ci: change postgres hostname to service
All checks were successful
Code Quality / Code Quality (Elixir 1.15.7 OTP 26.2) (pull_request) Successful in 22m9s
2025-09-20 17:01:27 +02:00
49b639e422 ci: allow setting db hostname
Some checks failed
Code Quality / Code Quality (Elixir 1.15.7 OTP 26.2) (pull_request) Has been cancelled
2025-09-20 16:58:44 +02:00
5 changed files with 44 additions and 16 deletions

View File

@@ -72,9 +72,11 @@ jobs:
- name: Run tests
run: mix test
env:
POSTGRES_HOSTNAME: db
POSTGRES_PASSWORD: postgres
- name: Run precommit (should pass if all above passed)
run: mix precommit
env:
POSTGRES_HOSTNAME: db
POSTGRES_PASSWORD: postgres

View File

@@ -26,9 +26,12 @@ jobs:
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
# Latest tag will automatically be generated for the latest tagged release
# Version tag on releases (e.g., v1.2.3)
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
# Keep a moving branch tag (e.g., main)
type=ref,event=branch
# Snapshot tag for commits on the default branch (e.g., snapshot-<hash>)
type=raw,value=snapshot-{{sha}},enable={{is_default_branch}}
- name: Log in to Container Registry
@@ -46,6 +49,8 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# GitHub Actions cache needs proper runner configuration
# https://docs.gitea.com/usage/actions/act-runner#configuring-cache-when-starting-a-runner-using-docker-image
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |

View File

@@ -208,37 +208,58 @@ The project includes:
### 🐳 Docker Deployment (Recommended)
Docker provides the easiest deployment method with all dependencies included.
Docker provides the easiest deployment method with a pre-built container image including all dependencies.
#### Quick Start
1. **Clone and setup:**
1. **Download the docker-compose file:**
```bash
git clone <repository-url>
cd components_elixir
cp docker-compose.yml.example docker-compose.yml
curl -O https://git.maxboeer.com/schuwi/component-system/raw/branch/main/docker-compose.yml.example
mv docker-compose.yml.example docker-compose.yml
```
2. **Configure environment** (edit `docker-compose.yml`):
2. **Generate a secure secret key:**
**With Elixir/Phoenix installed:**
```bash
mix phx.gen.secret
```
**Without Elixir/Phoenix (Linux/Unix):**
```bash
dd if=/dev/random bs=1 count=64 status=none | base64 -w0 | cut -c1-64
```
> **Note**: The SECRET_KEY_BASE must be a cryptographically random string that's at least 64 characters long. Phoenix uses it to sign session cookies, CSRF tokens, and other security-sensitive data.
3. **Configure environment** (edit `docker-compose.yml`):
```yaml
environment:
SECRET_KEY_BASE: "your-64-character-secret-key" # Generate with: mix phx.gen.secret
AUTH_PASSWORD: "your-secure-password"
SECRET_KEY_BASE: "your-generated-64-character-secret-key"
AUTH_PASSWORD: "your-secure-password" # Login password for the app
PHX_HOST: "localhost" # Change to your domain
```
3. **Deploy:**
4. **Deploy:**
```bash
docker compose up --build
docker compose up -d
```
4. **Access:** [http://localhost:4000](http://localhost:4000)
5. **Access:** [http://localhost:4000](http://localhost:4000)
The container image is automatically built and published from the main branch at https://git.maxboeer.com/schuwi/component-system.
#### Production Configuration
For production environments:
- **Generate secure keys**: Use `mix phx.gen.secret` for SECRET_KEY_BASE
- **Use specific versions**: Pin to specific tags like `git.maxboeer.com/schuwi/components-elixir:v1.0.0` instead of `:latest`
- **Available tags**:
- `:latest` - Latest stable release from main branch
- `:main` - Latest build from main branch
- `:v*` - Specific version tags
- `:snapshot-<hash>` - Specific commit builds
- **Generate secure keys**: Generate a 64+ character random string for SECRET_KEY_BASE (see Quick Start section for methods)
- **Set strong passwords**: Use AUTH_PASSWORD environment variable
- **Configure domain**: Set PHX_HOST to your actual domain
- **Database security**: Use strong PostgreSQL credentials

View File

@@ -8,7 +8,7 @@ import Config
config :components_elixir, ComponentsElixir.Repo,
username: "postgres",
password: System.get_env("POSTGRES_PASSWORD") || "fCnPB8VQdPkhJAD29hq6sZEY",
hostname: "localhost",
hostname: System.get_env("POSTGRES_HOSTNAME") || "localhost",
database: "components_elixir_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: System.schedulers_online() * 2

View File

@@ -16,7 +16,7 @@ services:
retries: 5
app:
build: .
image: git.maxboeer.com/schuwi/components-elixir:latest
ports:
- "4000:4000"
environment: