forked from jmug/cactoide
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fefca207c5 | ||
|
|
e89c9b1843 | ||
|
|
4b14f649d6 | ||
|
|
3cbdd93386 |
@@ -4,7 +4,10 @@ POSTGRES_USER=cactoide
|
||||
POSTGRES_PASSWORD=cactoide_password
|
||||
POSTGRES_PORT=5432
|
||||
|
||||
# localhost
|
||||
DATABASE_URL="postgres://cactoide:cactoide_password@localhost:5432/cactoied_database"
|
||||
# docker
|
||||
# DATABASE_URL="postgres://cactoide:cactoide_password@postgres:5432/cactoied_database"
|
||||
|
||||
# Application configuration
|
||||
APP_VERSION=latest
|
||||
|
||||
31
.github/workflows/build-and-push.yml
vendored
31
.github/workflows/build-and-push.yml
vendored
@@ -1,3 +1,4 @@
|
||||
# .github/workflows/docker-build-and-push.yml
|
||||
name: build & push the images
|
||||
|
||||
on:
|
||||
@@ -38,8 +39,24 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
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
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
@@ -47,13 +64,5 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
tags: |
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:latest
|
||||
${{ 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"
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
@@ -6,11 +6,11 @@ services:
|
||||
image: postgres:15-alpine
|
||||
container_name: cactoide-db
|
||||
environment:
|
||||
POSTGRES_DB: ${POSTGRES_DB:-cactoied_database}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-cactoide_database}
|
||||
POSTGRES_USER: ${POSTGRES_USER:-cactoide}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-cactoide_password}
|
||||
ports:
|
||||
- '${POSTGRES_PORT:-5432}:5432'
|
||||
expose:
|
||||
- '${POSTGRES_PORT:-5437}'
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
@@ -18,7 +18,7 @@ services:
|
||||
test:
|
||||
[
|
||||
'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
|
||||
timeout: 5s
|
||||
@@ -31,9 +31,9 @@ services:
|
||||
image: ghcr.io/polaroi8d/cactoide/cactoide:${APP_VERSION:-latest}
|
||||
container_name: cactoide-app
|
||||
ports:
|
||||
- '${PORT:-3000}:3000'
|
||||
- '${PORT:-5111}:3000'
|
||||
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
|
||||
HOSTNAME: ${HOSTNAME:-0.0.0.0}
|
||||
depends_on:
|
||||
|
||||
@@ -9,11 +9,11 @@ export function load({ cookies }) {
|
||||
const PATH = '/';
|
||||
|
||||
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 });
|
||||
} else {
|
||||
console.log(`cactoideUserId: ${cactoideUserId}`);
|
||||
console.log(`cactoideUserId cookie found, using existing one...`);
|
||||
console.debug(`cactoideUserId: ${cactoideUserId}`);
|
||||
console.debug(`cactoideUserId cookie found, using existing one...`);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -17,8 +17,6 @@ export const load = async ({ cookies }) => {
|
||||
.where(eq(events.userId, userId))
|
||||
.orderBy(desc(events.createdAt));
|
||||
|
||||
console.log(userEvents);
|
||||
|
||||
const transformedEvents = userEvents.map((event) => ({
|
||||
id: event.id,
|
||||
name: event.name,
|
||||
|
||||
@@ -75,9 +75,6 @@ export const actions: Actions = {
|
||||
const name = formData.get('newAttendeeName') as string;
|
||||
const userId = cookies.get('cactoideUserId');
|
||||
|
||||
console.log(`name: ${name}`);
|
||||
console.log(`userId: ${userId}`);
|
||||
|
||||
if (!name?.trim() || !userId) {
|
||||
return fail(400, { error: 'Name and user ID are required' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user