Skip to content

Commit

Permalink
feat: added fly deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
uptownhr committed Aug 19, 2023
1 parent b8f44af commit 098e091
Show file tree
Hide file tree
Showing 27 changed files with 14,091 additions and 2 deletions.
31 changes: 31 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# build output
dist/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store

# idea
.idea

# yarn
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
59 changes: 59 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.16.1
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="NestJS/Prisma"

# NestJS/Prisma app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"
ARG YARN_VERSION=3.3.1

# Install Yarn 3
RUN corepack enable && \
yarn set version ${YARN_VERSION}


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y build-essential openssl pkg-config python-is-python3

# Install node modules
COPY --link package.json yarn.lock .yarnrc.yml ./
COPY --link .yarn ./.yarn
RUN yarn install

# Copy application code
COPY --link . .

# RUN yarn install

# Generate Prisma Client
# RUN yarn nx run lov-db:prisma-generate
RUN ls -la ./libs/lov-db/src/generated/client


# Build application
RUN yarn nx run backend:build:production

# Final stage for app image
FROM base

# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y openssl && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "yarn", "run", "start" ]
17 changes: 17 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# fly.toml app configuration file generated for weathered-butterfly-8125 on 2023-08-19T10:40:03-07:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "lov"
primary_region = "lax"

[build]

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
1 change: 1 addition & 0 deletions libs/lov-db/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
generator client {
provider = "prisma-client-js"
output = "../src/generated/client"
binaryTargets = ["native", "linux-musl", "linux-arm64-openssl-1.1.x", "debian-openssl-3.0.x", "darwin-arm64"]
}

datasource db {
Expand Down
1 change: 0 additions & 1 deletion libs/lov-db/src/generated/.gitignore

This file was deleted.

185 changes: 185 additions & 0 deletions libs/lov-db/src/generated/client/index-browser.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@

Object.defineProperty(exports, "__esModule", { value: true });

const {
Decimal,
objectEnumValues,
makeStrictEnum,
Public,
} = require('./runtime/index-browser')


const Prisma = {}

exports.Prisma = Prisma
exports.$Enums = {}

/**
* Prisma Client JS version: 5.1.1
* Query Engine version: 6a3747c37ff169c90047725a05a6ef02e32ac97e
*/
Prisma.prismaVersion = {
client: "5.1.1",
engine: "6a3747c37ff169c90047725a05a6ef02e32ac97e"
}


const runtimeDescription = (() => {
// https://edge-runtime.vercel.app/features/available-apis#addressing-the-runtime
if ("EdgeRuntime" in globalThis && typeof globalThis.EdgeRuntime === "string") {
return "under the Vercel Edge Runtime";
}
// Deno
if ("Deno" in globalThis && typeof globalThis.Deno === "object") {
return "under the Deno runtime";
}
// Default to assuming browser
return "in the browser";
})();


Prisma.PrismaClientKnownRequestError = () => {
throw new Error(`PrismaClientKnownRequestError is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)};
Prisma.PrismaClientUnknownRequestError = () => {
throw new Error(`PrismaClientUnknownRequestError is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.PrismaClientRustPanicError = () => {
throw new Error(`PrismaClientRustPanicError is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.PrismaClientInitializationError = () => {
throw new Error(`PrismaClientInitializationError is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.PrismaClientValidationError = () => {
throw new Error(`PrismaClientValidationError is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.NotFoundError = () => {
throw new Error(`NotFoundError is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.Decimal = Decimal

/**
* Re-export of sql-template-tag
*/
Prisma.sql = () => {
throw new Error(`sqltag is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.empty = () => {
throw new Error(`empty is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.join = () => {
throw new Error(`join is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.raw = () => {
throw new Error(`raw is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.validator = Public.validator

/**
* Extensions
*/
Prisma.getExtensionContext = () => {
throw new Error(`Extensions.getExtensionContext is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}
Prisma.defineExtension = () => {
throw new Error(`Extensions.defineExtension is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)}

/**
* Shorthand utilities for JSON filtering
*/
Prisma.DbNull = objectEnumValues.instances.DbNull
Prisma.JsonNull = objectEnumValues.instances.JsonNull
Prisma.AnyNull = objectEnumValues.instances.AnyNull

Prisma.NullTypes = {
DbNull: objectEnumValues.classes.DbNull,
JsonNull: objectEnumValues.classes.JsonNull,
AnyNull: objectEnumValues.classes.AnyNull
}

/**
* Enums
*/

exports.Prisma.TransactionIsolationLevel = makeStrictEnum({
Serializable: 'Serializable'
});

exports.Prisma.PageScalarFieldEnum = {
id: 'id',
slug: 'slug',
title: 'title',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};

exports.Prisma.QuestionScalarFieldEnum = {
id: 'id',
pageId: 'pageId',
title: 'title',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};

exports.Prisma.QuestionVoteScalarFieldEnum = {
id: 'id',
questionId: 'questionId',
createdAt: 'createdAt'
};

exports.Prisma.AnswerScalarFieldEnum = {
id: 'id',
questionId: 'questionId',
value: 'value',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};

exports.Prisma.AnswerVoteScalarFieldEnum = {
id: 'id',
answerId: 'answerId',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
};

exports.Prisma.SortOrder = {
asc: 'asc',
desc: 'desc'
};


exports.Prisma.ModelName = {
Page: 'Page',
Question: 'Question',
QuestionVote: 'QuestionVote',
Answer: 'Answer',
AnswerVote: 'AnswerVote'
};

/**
* Create the Client
*/
class PrismaClient {
constructor() {
throw new Error(
`PrismaClient is unable to be run ${runtimeDescription}.
In case this error is unexpected for you, please report it in https://github.com/prisma/prisma/issues`,
)
}
}
exports.PrismaClient = PrismaClient

Object.assign(exports, Prisma)

0 comments on commit 098e091

Please sign in to comment.