Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ coverage/
.idea/

# generated content (articles + co-located images)
src/content/articles/
nca-ai-cms-content/
12 changes: 3 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,15 @@ build:
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
script:
# Backup content from old container
- docker cp $SHORTCODE1-web:/app/src/content/articles /tmp/articles 2>/dev/null || true
- docker cp $SHORTCODE1-web:/app/nca-ai-cms-content /tmp/articles 2>/dev/null || true
- docker cp $SHORTCODE1-web:/app/.astro /tmp/astro-db 2>/dev/null || true
# Remove old container and start new one
- docker compose -f docker-compose.conversis.yml -p $SHORTCODE1 rm -sfv || true
- docker compose -f docker-compose.conversis.yml -p $SHORTCODE1 up -d --remove-orphans
# Restore content to new container
- docker cp /tmp/articles/. $SHORTCODE1-web:/app/src/content/articles/ 2>/dev/null || true
- docker cp /tmp/articles/. $SHORTCODE1-web:/app/nca-ai-cms-content/ 2>/dev/null || true
- docker cp /tmp/astro-db/. $SHORTCODE1-web:/app/.astro/ 2>/dev/null || true
# Fix ownership for non-root user
- docker exec -u root $SHORTCODE1-web chown -R astro:nodejs /app/src/content/articles 2>/dev/null || true
- docker exec -u root $SHORTCODE1-web chown -R astro:nodejs /app/nca-ai-cms-content 2>/dev/null || true
- docker exec -u root $SHORTCODE1-web chown -R astro:nodejs /app/.astro 2>/dev/null || true
# Rebuild to pick up restored content (creates DB on first deploy)
- docker exec $SHORTCODE1-web npm run build
# Cleanup
- rm -rf /tmp/articles /tmp/astro-db 2>/dev/null || true

deploy_stage:
Expand Down
12 changes: 12 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

# Auto-fix local plugin reference before commit
# Replaces file: references with pinned version in package.json
if grep -q '"file:.*nca-ai-cms-astro-plugin"' package.json; then
echo "Fixing local plugin reference in package.json..."
sed -i 's|"file:[^"]*nca-ai-cms-astro-plugin"|"1.0.1"|g' package.json
git add package.json
fi

npm run plugin:lint
npm test
4 changes: 2 additions & 2 deletions Dockerfile.conversis
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ FROM deps AS builder
COPY . .
# Build with empty articles folder and local database
ENV ASTRO_DATABASE_FILE=/app/.astro/content.db
RUN mkdir -p .astro && rm -rf src/content/articles/* && npm run build
RUN mkdir -p .astro && rm -rf nca-ai-cms-content/* && npm run build

FROM base AS runner
RUN addgroup -g 1001 -S nodejs && \
Expand All @@ -24,7 +24,7 @@ COPY --from=builder /app/db ./db
COPY --from=builder /app/astro.config.mjs ./
COPY --from=builder /app/tsconfig.json ./

RUN mkdir -p src/content/articles .astro && \
RUN mkdir -p nca-ai-cms-content .astro && \
chown -R astro:nodejs .

USER astro
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Set variables in **GitLab > Settings > CI/CD > Variables**. The pipeline builds
Articles are stored in the filesystem, not the database:

```
src/content/articles/{YEAR}/{MONTH}/{SLUG}/
nca-ai-cms-content/{YEAR}/{MONTH}/{SLUG}/
├── index.md # Article content (Markdown + frontmatter)
└── hero.webp # Generated hero image
```
Expand Down
12 changes: 2 additions & 10 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { loadEnv } from 'vite';
import react from '@astrojs/react';
import node from '@astrojs/node';
import db from '@astrojs/db';
import ncaAiCms from 'nca-ai-cms-astro-plugin';

// Load .env files into process.env for SSR
const {
Expand All @@ -19,19 +20,10 @@ Object.assign(process.env, {
GOOGLE_GEMINI_MODELS,
});

// Start auto-publisher in production (standalone Node server)
if (process.env.NODE_ENV === 'production') {
import('./src/services/AutoPublisher.js').then(({ startAutoPublisher }) => {
startAutoPublisher();
}).catch((err) => {
console.error('[AutoPublisher] Failed to start:', err);
});
}

// https://astro.build/config
export default defineConfig({
site: 'https://semantik-html-barrierefrei.de',
integrations: [react(), db()],
integrations: [react(), ncaAiCms(), db()],
output: 'server',
adapter: node({
mode: 'standalone',
Expand Down
44 changes: 3 additions & 41 deletions db/config.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,6 @@
import { defineDb, defineTable, column } from 'astro:db';

// Site settings (hero, imprint, CTA config)
const SiteSettings = defineTable({
columns: {
key: column.text({ primaryKey: true }),
value: column.text(),
updatedAt: column.date({ default: new Date() }),
},
});

// Scheduled posts for content planner
const ScheduledPosts = defineTable({
columns: {
id: column.text({ primaryKey: true }),
input: column.text(),
inputType: column.text(), // 'url' | 'keywords'
scheduledDate: column.date(),
status: column.text({ default: 'pending' }), // 'pending' | 'generated' | 'published'
generatedTitle: column.text({ optional: true }),
generatedDescription: column.text({ optional: true }),
generatedContent: column.text({ optional: true }),
generatedTags: column.text({ optional: true }), // JSON string
generatedImageData: column.text({ optional: true }), // base64 webp
generatedImageAlt: column.text({ optional: true }),
publishedPath: column.text({ optional: true }),
createdAt: column.date({ default: new Date() }),
},
});

// AI Prompts (editable)
const Prompts = defineTable({
columns: {
id: column.text({ primaryKey: true }),
name: column.text(),
category: column.text(), // 'content' | 'image' | 'analysis'
promptText: column.text(),
updatedAt: column.date({ default: new Date() }),
},
});
import { defineDb } from 'astro:db';

// Tables are provided by nca-ai-cms-astro-plugin via extendDb
export default defineDb({
tables: { SiteSettings, Prompts, ScheduledPosts },
tables: {},
});
12 changes: 0 additions & 12 deletions docker-compose.conversis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ services:
restart: unless-stopped
networks:
- proxy
healthcheck:
test:
[
'CMD',
'node',
'-e',
"require('http').get('http://localhost:4321', (r) => process.exit(r.statusCode === 200 ? 0 : 1))",
]
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.$SHORTCODE1.entrypoints=http'
Expand Down
3 changes: 3 additions & 0 deletions nca-ai-cms-content/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated content — not tracked in git
*
!.gitignore
Loading