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

docs: add local setup instructions, cleanup files #10

Merged
merged 1 commit into from
Apr 1, 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
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ docker-compose.yml
docker-compose.yaml
.env
node_modules/
cli/
.next/
.dockerignore
.gitignore
.github/
README.md
SECURITY.md
29 changes: 29 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Postgres Variables
POSTGRES_HOST="langtrace-postgres:5432"
POSTGRES_USER="ltuser"
POSTGRES_PASSWORD="ltpasswd"
POSTGRES_DATABASE="langtrace"
POSTGRES_DB="${POSTGRES_DATABASE}"
POSTGRES_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}/${POSTGRES_DATABASE}"
POSTGRES_PRISMA_URL="${POSTGRES_URL}?pgbouncer=true&connect_timeout=15"
POSTGRES_URL_NO_SSL="${POSTGRES_URL}"
POSTGRES_URL_NON_POOLING="${POSTGRES_URL}"

# Application Variables
NEXT_PUBLIC_APP_NAME="Langtrace"
NEXT_PUBLIC_ENVIRONMENT="development"
NEXT_PUBLIC_HOST="http://localhost:3000"
NEXTAUTH_SECRET="difficultsecret"
NEXTAUTH_URL="${NEXT_PUBLIC_HOST}"
NEXTAUTH_URL_INTERNAL="${NEXT_PUBLIC_HOST}"

# Clickhouse Variables
CLICK_HOUSE_HOST="http://langtrace-clickhouse:8123"
CLICK_HOUSE_USER="default"
CLICK_HOUSE_PASSWORD=""
CLICK_HOUSE_DATABASE_NAME="langtrace_dev"

# Admin login
ADMIN_EMAIL="admin@langtrace.ai"
ADMIN_PASSWORD="langtraceadminpw"
NEXT_PUBLIC_ENABLE_ADMIN_LOGIN="true"
40 changes: 0 additions & 40 deletions .github/workflows/build-cli.yaml

This file was deleted.

70 changes: 39 additions & 31 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
name: "Build Docker Image"
run-name: "Version: ${{ inputs.imageTag }} --> Latest: ${{ inputs.isLatest }}"

on:
workflow_dispatch:
inputs:
RegistryEnv:
type: environment
description: "Select Env"
required: true
imageTag:
description: "Release version"
description: Release version
required: true
default: "latest"
default: example
isLatest:
description: Is this the latest version?
type: boolean
required: true
default: false

jobs:
docker-build:
environment: ${{ inputs.RegistryEnv }}
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: scale3labs/langtrace-client
steps:
- name: "Github Checkout"
uses: actions/checkout@v3
- name: Github Checkout
# v4.1.1
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11

- name: "Login via Azure CLI"
uses: azure/login@v1
- name: Log in to Docker Hub
# v3.1.0
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: "Build and push image"
uses: azure/docker-login@v1
- name: Build and push Docker image with latest tag
# v5.3.0
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
login-server: ${{ vars.REGISTRY_LOGIN_SERVER }}
username: ${{ vars.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- run: |
docker build . -t ${{ vars.REGISTRY_LOGIN_SERVER }}/sampleapp:${{ vars.imageTag }}
docker push ${{ vars.REGISTRY_LOGIN_SERVER }}/sampleapp:${{ vars.imageTag }}
context: .
file: ./Dockerfile
push: true
tags: |
${{ env.DOCKER_REGISTRY }}:${{ inputs.imageTag }}
${{ env.DOCKER_REGISTRY }}:latest
labels: ${{ inputs.imageTag }}
if: ${{ inputs.isLatest }}

# - name: "Deploy to Azure Container Instances"
# uses: "azure/aci-deploy@v1"
# with:
# resource-group: ${{ vars.RESOURCE_GROUP }}
# dns-name-label: ${{ vars.RESOURCE_GROUP }}${{ github.run_number }}
# image: ${{ vars.REGISTRY_LOGIN_SERVER }}/sampleapp:${{ github.sha }}
# registry-login-server: ${{ vars.REGISTRY_LOGIN_SERVER }}
# registry-username: ${{ vars.REGISTRY_USERNAME }}
# registry-password: ${{ secrets.REGISTRY_PASSWORD }}
# name: aci-sampleapp
# location: "west us"
- name: Build and push Docker image without latest tag
# v5.3.0
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.DOCKER_REGISTRY }}:${{ inputs.imageTag }}
if: ${{ !inputs.isLatest }}
18 changes: 2 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
# Debian based node 21.6 image
FROM node:21.6-bookworm as builder
FROM node:21.6-bookworm

WORKDIR /app

COPY . .

RUN npm install
RUN AZURE_OPENAI_API_KEY="" npm run build

FROM node:21.6-alpine3.19

WORKDIR /app

# Copy only the necessary files
COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/package.json .
COPY --from=builder /app/prisma ./prisma

# Install only production dependencies
RUN npm install --only=production --omit=dev

CMD ["npm", "start"]
EXPOSE 3000
Loading