Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Merge branch 'production' into main" #712

Merged
merged 2 commits into from
Aug 31, 2024
Merged
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
69 changes: 34 additions & 35 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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 && \
Expand Down
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -87,4 +86,4 @@ services:
condition: service_healthy
networks:
lavalink:
name: lavalink
name: lavalink
117 changes: 36 additions & 81 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -5,112 +5,67 @@
// 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[]
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])
}

model Botchannel {
guildId String @id
textId String
Guild Guild @relation(fields: [guildId], references: [guildId])
@@unique([track, playlistId])
}

model Setup {
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
guildId String @id
textId String
messageId String
Guild Guild @relation(fields: [guildId], references: [guildId])
}