From 5d8fe99307f652fb26f1d38e5c1dea3b6f40e1fb Mon Sep 17 00:00:00 2001 From: hwangsihu Date: Sun, 1 Sep 2024 00:07:57 +0900 Subject: [PATCH 1/2] Revert "Merge branch 'production' into main" This reverts commit 6695f2c9a3e70c8780cd305f3d73c75beae38bbb, reversing changes made to e1fb761f4235c024248dfce9777c03f026bfedab. --- .github/workflows/build-docker.yml | 69 +++++++++-------- Dockerfile | 6 +- docker-compose.yml | 5 +- prisma/schema.prisma | 117 +++++++++++------------------ 4 files changed, 80 insertions(+), 117 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 145fc16c8..ab8a208f0 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -2,38 +2,37 @@ name: Build and publish a Docker image to ghcr.io on: push jobs: - docker_publish: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - - name: Available platforms - run: echo ${{ steps.buildx.outputs.platforms }} - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/appujet/lavamusic - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: | - linux/amd64 - linux/arm64 - build-args: | - DATABASE_URL=${{ secrets.DATABASE_URL }} + docker_publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + - name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/appujet/lavamusic + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: | + linux/amd64 + linux/arm64 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 28c9447cd..67a223ae8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,15 +20,13 @@ COPY tsconfig.json ./ # Copy prisma COPY prisma ./prisma # Generate Prisma client -RUN npx prisma generate +RUN npx prisma db push # Build TypeScript RUN npm run build # Stage 2: Create production image FROM node:22-slim -ARG DATABASE_URL -ENV DATABASE_URL=${DATABASE_URL} ENV NODE_ENV=production WORKDIR /opt/lavamusic/ @@ -47,7 +45,7 @@ COPY --from=builder /opt/lavamusic/locales ./locales RUN npm install --omit=dev RUN npx prisma generate -RUN npx prisma migrate deploy +RUN npx prisma db push # Ensure application.yml is a file, not a directory RUN rm -rf /opt/lavamusic/application.yml && \ diff --git a/docker-compose.yml b/docker-compose.yml index f39cc39a1..8d42fdbd1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,7 +61,7 @@ services: # services for lavamusic lavamusic: container_name: lavamusic - image: ghcr.io/appujet/lavamusic:production + image: ghcr.io/appujet/lavamusic:main environment: # Your lavalink url - LAVALINK_URL=lavalink:2333 @@ -72,7 +72,6 @@ services: # Your lavalink secure (true or false) - LAVALINK_SECURE=false # database url - - DATABASE_URL=DATABASE_URL # - DATABASE_URL= put your database url here (mongodb or postgres) # - DATABASE_URL=postgresql://lavamusic:lavamusic@postgres:5432/lavamusic (for postgres) # - DATABASE_URL=mongodb://mongoadmin:mongopassword@mongodb:27017/lavamusic?authSource=admin (for mongodb) @@ -87,4 +86,4 @@ services: condition: service_healthy networks: lavalink: - name: lavalink + name: lavalink \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 6502bfa67..1a61c9c3e 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -5,112 +5,79 @@ // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init generator client { - provider = "prisma-client-js" - binaryTargets = ["native", "debian-openssl-3.0.x"] + provider = "prisma-client-js" + binaryTargets = ["native", "debian-openssl-3.0.x"] } datasource db { - provider = "postgresql" - url = env("DATABASE_URL") + provider = "sqlite" + url = "file:./lavamusic.db" } model Guild { - guildId String @id - prefix String - language String? - stay Stay? - dj Dj? - roles Role[] - botchannel Botchannel? - setup Setup? + guildId String @id + prefix String + language String? + stay Stay? + dj Dj? + roles Role[] + botchannel Botchannel? + setup Setup? } model Stay { - guildId String @id - textId String - voiceId String - Guild Guild @relation(fields: [guildId], references: [guildId]) + guildId String @id + textId String + voiceId String + Guild Guild @relation(fields: [guildId], references: [guildId]) } model Dj { - guildId String @id - mode Boolean - Guild Guild @relation(fields: [guildId], references: [guildId]) + guildId String @id + mode Boolean + Guild Guild @relation(fields: [guildId], references: [guildId]) } model Role { - guildId String - roleId String - Guild Guild @relation(fields: [guildId], references: [guildId]) + guildId String + roleId String + Guild Guild @relation(fields: [guildId], references: [guildId]) - @@unique([guildId, roleId]) + @@unique([guildId, roleId]) } model Playlist { - id String @id @default(uuid()) - userId String - name String - songs Song[] + id String @id @default(uuid()) + userId String + name String + songs Song[] - @@unique([userId, name]) + @@unique([userId, name]) } model Song { - id String @id @default(uuid()) - track String - playlistId String - playlist Playlist @relation(fields: [playlistId], references: [id]) + id String @id @default(uuid()) + track String + playlistId String + playlist Playlist @relation(fields: [playlistId], references: [id]) - @@unique([track, playlistId]) + @@unique([track, playlistId]) } model Botchannel { - guildId String @id - textId String - Guild Guild @relation(fields: [guildId], references: [guildId]) + guildId String @id + textId String + Guild Guild @relation(fields: [guildId], references: [guildId]) } model Setup { - guildId String @id - textId String - messageId String - Guild Guild @relation(fields: [guildId], references: [guildId]) + guildId String @id + textId String + messageId String + Guild Guild @relation(fields: [guildId], references: [guildId]) } model Premium { - userId String @id - guildId String -} - -enum Languages { - EnglishUS - EnglishGB - German - Bulgarian - ChineseCN - ChineseTW - Croatian - Czech - Danish - Dutch - Finnish - French - Greek - Hindi - Hungarian - Italian - Japanese - Korean - Lithuanian - Norwegian - Polish - PortugueseBR - Romanian - Russian - SpanishES - Swedish - Thai - Turkish - Ukrainian - Vietnamese + userId String @id + guildId String } From 74de4e5349b64722c4b1322940f250ff1a2626be Mon Sep 17 00:00:00 2001 From: LucasB25 <50886682+LucasB25@users.noreply.github.com> Date: Sat, 31 Aug 2024 17:12:12 +0200 Subject: [PATCH 2/2] Update schema.prisma Signed-off-by: LucasB25 <50886682+LucasB25@users.noreply.github.com> --- prisma/schema.prisma | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 1a61c9c3e..6ea936c86 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -21,7 +21,6 @@ model Guild { stay Stay? dj Dj? roles Role[] - botchannel Botchannel? setup Setup? } @@ -64,20 +63,9 @@ model Song { @@unique([track, playlistId]) } -model Botchannel { - guildId String @id - textId String - Guild Guild @relation(fields: [guildId], references: [guildId]) -} - model Setup { guildId String @id textId String messageId String Guild Guild @relation(fields: [guildId], references: [guildId]) } - -model Premium { - userId String @id - guildId String -}