Skip to content

Commit

Permalink
trying out fly / pm2 setup
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Nov 21, 2023
1 parent 1b2d167 commit a1d7a8e
Show file tree
Hide file tree
Showing 6 changed files with 1,345 additions and 59 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
**/node_modules
**/dist
.vscode
.git
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FROM base as build
# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y build-essential pkg-config python-is-python3
RUN npm i -g webpack-cli
RUN npm i -g webpack-cli pm2

# Copy application code
COPY --link . .
Expand All @@ -35,4 +35,4 @@ COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "npm", "run", "start" ]
CMD [ "npm", "run", "pm2"]
2 changes: 1 addition & 1 deletion demo-server/demo-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const StaticServer = require('node-static').Server
const setupWSConnection = require('y-websocket/bin/utils.js').setupWSConnection

const production = process.env.PRODUCTION != null
const port = process.env.PORT || 8080
const port = process.env.PORT || 3000

const staticServer = new StaticServer('../', { cache: production ? 3600 : false, gzip: production })

Expand Down
17 changes: 15 additions & 2 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
# fly.toml app configuration file generated for yjs-demos on 2023-11-20T20:40:42+01:00
# fly.toml app configuration file generated for yjs-demos on 2023-11-21T21:32:50+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "yjs-demos"
primary_region = "ams"
swap_size_mb = 1024

[build]

[http_service]
internal_port = 8080
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
[http_service.concurrency]
type = "requests"
hard_limit = 1000
soft_limit = 800

[[services]]
protocol = ""
internal_port = 0
[services.concurrency]
type = "connections"
hard_limit = 250
soft_limit = 200
Loading

0 comments on commit a1d7a8e

Please sign in to comment.