Skip to content

Commit

Permalink
migrate from heroku to fly.io
Browse files Browse the repository at this point in the history
  • Loading branch information
madhums committed Aug 31, 2023
1 parent 376622b commit 867e359
Show file tree
Hide file tree
Showing 6 changed files with 639 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
@@ -0,0 +1,7 @@
node_modules/
.monitor
config/env/env.json
Makefile
.DS_Store
.env
data
39 changes: 39 additions & 0 deletions Dockerfile
@@ -0,0 +1,39 @@
# 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="Node.js"

# Node.js app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"


# 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 pkg-config python-is-python3

# Install node modules
COPY --link package-lock.json package.json ./
RUN npm ci

# Copy application code
COPY --link . .


# Final stage for app image
FROM base

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

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "npm", "run", "start" ]
8 changes: 4 additions & 4 deletions config/env/production.js
Expand Up @@ -10,24 +10,24 @@ module.exports = {
clientID: process.env.TWITTER_CLIENTID,
clientSecret: process.env.TWITTER_SECRET,
callbackURL:
'https://nodejs-express-demo.herokuapp.com/auth/twitter/callback/'
'https://nodejs-express-demo.fly.dev/auth/twitter/callback/'
},
github: {
clientID: process.env.GITHUB_CLIENTID,
clientSecret: process.env.GITHUB_SECRET,
callbackURL:
'https://nodejs-express-demo.herokuapp.com/auth/github/callback'
'https://nodejs-express-demo.fly.dev/auth/github/callback'
},
linkedin: {
clientID: process.env.LINKEDIN_CLIENTID,
clientSecret: process.env.LINKEDIN_SECRET,
callbackURL:
'https://nodejs-express-demo.herokuapp.com/auth/linkedin/callback'
'https://nodejs-express-demo.fly.dev/auth/linkedin/callback'
},
google: {
clientID: process.env.GOOGLE_CLIENTID,
clientSecret: process.env.GOOGLE_SECRET,
callbackURL:
'https://nodejs-express-demo.herokuapp.com/auth/google/callback'
'https://nodejs-express-demo.fly.dev/auth/google/callback'
}
};
17 changes: 17 additions & 0 deletions fly.toml
@@ -0,0 +1,17 @@
# fly.toml app configuration file generated for nodejs-express-demo on 2023-08-31T11:46:03+02:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "nodejs-express-demo"
primary_region = "ams"

[build]

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]

0 comments on commit 867e359

Please sign in to comment.