Compare commits

...

4 Commits
0.0.1 ... 0.0.3

Author SHA1 Message Date
Levente Orban
fefca207c5 feat: remove or refactor unused console.logs 2025-08-27 22:39:42 +02:00
Levente Orban
e89c9b1843 feat: add docker DATABASE_URL 2025-08-27 22:35:21 +02:00
Levente Orban
4b14f649d6 fix: docker-compose renames and fixes 2025-08-27 22:34:06 +02:00
Levente Orban
3cbdd93386 ci: testing the tags pipeline 2025-08-27 17:13:47 +02:00
6 changed files with 32 additions and 25 deletions

View File

@@ -4,7 +4,10 @@ POSTGRES_USER=cactoide
POSTGRES_PASSWORD=cactoide_password POSTGRES_PASSWORD=cactoide_password
POSTGRES_PORT=5432 POSTGRES_PORT=5432
# localhost
DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoied_database" DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoied_database"
# docker
# DATABASE_URL="postgres://cactoide:cactoide_password@postgres:5432/cactoied_database"
# Application configuration # Application configuration
APP_VERSION=latest APP_VERSION=latest

View File

@@ -1,3 +1,4 @@
# .github/workflows/docker-build-and-push.yml
name: build & push the images name: build & push the images
on: on:
@@ -38,8 +39,24 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
# Generate tags & labels:
# - short SHA on all pushes
# - git tag on tag pushes
# - latest only on default branch (e.g., main)
- name: Extract Docker metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}
tags: |
type=sha,format=short
type=ref,event=tag
type=raw,value=latest,enable={{is_default_branch}}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v6
with: with:
context: . context: .
file: ./Dockerfile file: ./Dockerfile
@@ -47,13 +64,5 @@ jobs:
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
tags: | tags: ${{ steps.meta.outputs.tags }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:latest labels: ${{ steps.meta.outputs.labels }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:${{ github.sha }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:${{ github.ref_type == 'tag' && github.ref_name || '' }}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
- name: Output image info
run: |
echo "Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:latest"

View File

@@ -6,11 +6,11 @@ services:
image: postgres:15-alpine image: postgres:15-alpine
container_name: cactoide-db container_name: cactoide-db
environment: environment:
POSTGRES_DB: ${POSTGRES_DB:-cactoied_database} POSTGRES_DB: ${POSTGRES_DB:-cactoide_database}
POSTGRES_USER: ${POSTGRES_USER:-cactoide} POSTGRES_USER: ${POSTGRES_USER:-cactoide}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-cactoide_password} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-cactoide_password}
ports: expose:
- '${POSTGRES_PORT:-5432}:5432' - '${POSTGRES_PORT:-5437}'
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql - ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
@@ -18,7 +18,7 @@ services:
test: test:
[ [
'CMD-SHELL', 'CMD-SHELL',
'pg_isready -U ${POSTGRES_USER:-cactoide} -d ${POSTGRES_DB:-cactoied_database}' 'pg_isready -U ${POSTGRES_USER:-cactoide} -d ${POSTGRES_DB:-cactoide_database}'
] ]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
@@ -31,9 +31,9 @@ services:
image: ghcr.io/polaroi8d/cactoide/cactoide:${APP_VERSION:-latest} image: ghcr.io/polaroi8d/cactoide/cactoide:${APP_VERSION:-latest}
container_name: cactoide-app container_name: cactoide-app
ports: ports:
- '${PORT:-3000}:3000' - '${PORT:-5111}:3000'
environment: environment:
DATABASE_URL: postgres://${POSTGRES_USER:-cactoide}:${POSTGRES_PASSWORD:-cactoide_password}@postgres:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-cactoied_database} DATABASE_URL: ${DATABASE_URL}
PORT: 3000 PORT: 3000
HOSTNAME: ${HOSTNAME:-0.0.0.0} HOSTNAME: ${HOSTNAME:-0.0.0.0}
depends_on: depends_on:

View File

@@ -9,11 +9,11 @@ export function load({ cookies }) {
const PATH = '/'; const PATH = '/';
if (!cactoideUserId) { if (!cactoideUserId) {
console.log(`There is no cactoideUserId cookie, generating new one...`); console.debug(`There is no cactoideUserId cookie, generating new one...`);
cookies.set('cactoideUserId', userId, { path: PATH, maxAge: MAX_AGE }); cookies.set('cactoideUserId', userId, { path: PATH, maxAge: MAX_AGE });
} else { } else {
console.log(`cactoideUserId: ${cactoideUserId}`); console.debug(`cactoideUserId: ${cactoideUserId}`);
console.log(`cactoideUserId cookie found, using existing one...`); console.debug(`cactoideUserId cookie found, using existing one...`);
} }
return { return {

View File

@@ -17,8 +17,6 @@ export const load = async ({ cookies }) => {
.where(eq(events.userId, userId)) .where(eq(events.userId, userId))
.orderBy(desc(events.createdAt)); .orderBy(desc(events.createdAt));
console.log(userEvents);
const transformedEvents = userEvents.map((event) => ({ const transformedEvents = userEvents.map((event) => ({
id: event.id, id: event.id,
name: event.name, name: event.name,

View File

@@ -75,9 +75,6 @@ export const actions: Actions = {
const name = formData.get('newAttendeeName') as string; const name = formData.get('newAttendeeName') as string;
const userId = cookies.get('cactoideUserId'); const userId = cookies.get('cactoideUserId');
console.log(`name: ${name}`);
console.log(`userId: ${userId}`);
if (!name?.trim() || !userId) { if (!name?.trim() || !userId) {
return fail(400, { error: 'Name and user ID are required' }); return fail(400, { error: 'Name and user ID are required' });
} }