Skip to content

Commit

Permalink
deploy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
seiyria committed Aug 28, 2023
1 parent 87a15eb commit d3df239
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
server/node_modules/
server/dist
17 changes: 17 additions & 0 deletions .github/workflows/fly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Automatic Deploy (Server)
on:
workflow_dispatch:
push:
branches:
- main
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
2 changes: 1 addition & 1 deletion .github/workflows/netlify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
build:
name: Automatic Deploy
name: Automatic Deploy (Client)

runs-on: ${{ matrix.os }}

Expand Down
12 changes: 8 additions & 4 deletions server/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM debian:bullseye as builder

ARG NODE_VERSION=18.9.0
ARG NODE_VERSION=18.15.0

RUN apt-get update; apt install -y curl
RUN curl https://get.volta.sh | bash
Expand All @@ -19,9 +19,12 @@ WORKDIR /app

ENV NODE_ENV production

COPY . .
COPY package.json .
COPY server ./server
COPY shared ./shared

RUN npm install --include=dev && npm run build
RUN cd server && npm install --include=dev
RUN cd server && npm run build
FROM debian:bullseye

LABEL fly_launch_runtime="nodejs"
Expand All @@ -33,4 +36,5 @@ WORKDIR /app
ENV NODE_ENV production
ENV PATH /root/.volta/bin:$PATH

CMD [ "npm", "run", "start" ]
WORKDIR /app/server
CMD [ "npm", "run", "start:prod" ]
39 changes: 39 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# fly.toml file generated for ateoat-api on 2023-08-28T17:09:27-05:00

app = "ateoat-api"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
PORT = "8080"

[experimental]
allowed_public_ports = []
auto_rollback = true

[[services]]
http_checks = []
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 443

[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
4 changes: 2 additions & 2 deletions server/src/app.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ForbiddenException, Injectable } from '@nestjs/common';
import { Injectable } from '@nestjs/common';

@Injectable()
export class AppService {
getHello(): string {
throw new ForbiddenException('Test error');
return 'hello';
}
}
5 changes: 4 additions & 1 deletion server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ async function bootstrap() {
},
});

await app.listen(3000);
const port = +(process.env.PORT || '3000') || 3000;
await app.listen(port);

console.log(`Application is running on: ${await app.getUrl()}`);
}

void bootstrap();

0 comments on commit d3df239

Please sign in to comment.