Skip to content

Commit

Permalink
Update app for deploy guide
Browse files Browse the repository at this point in the history
  • Loading branch information
imchairmanm committed Jan 18, 2024
1 parent 7ae3037 commit f067ea6
Show file tree
Hide file tree
Showing 8 changed files with 650 additions and 263 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
.gitignore
Dockerfile
.dockerignore
node_modules
.env
README.md
1 change: 0 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ jobs:
app-name: expressjs-${{ github.ref_name }}
service-ports: "3000:http"
service-routes: "/:3000"
git-run-command: "node app.js"
skip-cache: true
149 changes: 122 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,35 +1,130 @@
# compiled output
/dist
/node_modules

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

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# OS
.DS_Store

# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:slim

WORKDIR /app
COPY . .
RUN npm ci

ARG PORT
EXPOSE ${PORT:-3000}

CMD ["npm", "run", "start"]
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@

## About Koyeb and the Node Express example application

Koyeb is a developer-friendly serverless platform to deploy apps globally. No-ops, servers, or infrastructure management.
This repository contains a Node Express application you can deploy on the Koyeb serverless platform for testing.
Koyeb is a developer-friendly serverless platform to deploy apps globally. No-ops, servers, or infrastructure management. This repository contains a Node Express application you can deploy on the Koyeb serverless platform for testing.

This example application is designed to show how a Node Express application can be deployed on Koyeb.
This example application is designed to show how a Node Express application can be deployed on Koyeb. You can follow the associated [deploy guide](https://www.koyeb.com/docs/deploy/express) to learn more about the application and how to extend it.

## Getting Started

Expand All @@ -36,7 +35,7 @@ You need a Koyeb account to successfully deploy and run this application. If you

The fastest way to deploy the Node Express application is to click the **Deploy to Koyeb** button below.

[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=git&repository=github.com/koyeb/example-expressjs&branch=main&run_command=node%20app.js&name=express-on-koyeb)
[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=git&repository=github.com/koyeb/example-expressjs&branch=main&name=express-on-koyeb)

Clicking on this button brings you to the Koyeb App creation page with everything pre-set to launch this application.

Expand All @@ -46,18 +45,18 @@ _To modify this application example, you will need to fork this repository. Chec

If you want to customize and enhance this application, you need to fork this repository.

If you used the **Deploy to Koyeb** button, you can simply link your service to your forked repository to be able to push changes.
Alternatively, you can manually create the application as described below.
If you used the **Deploy to Koyeb** button, you can simply link your service to your forked repository to be able to push changes. Alternatively, you can manually create the application as described below.

On the [Koyeb Control Panel](//app.koyeb.com/apps), click the **Create App** button to go to the App creation page.

1. Select `GitHub` as the deployment method to use
2. In the repositories list, select the repository you just forked
3. Specify the branch to deploy, in this case `main`
4. To let Koyeb know how to launch the application, add `node app.js` as the run command
5. Then, give your App a name, i.e `express-on-koyeb`, and click **Create App.**
1. Select `GitHub` as the deployment method to use.
2. In the repositories list, select the repository you just forked.
3. Specify the branch to deploy, in this case `main`.
4. Set the name for the Service and App. For example, `express-on-koyeb`.
5. Choose either the Buildpack or Docker builder. This repository can be built using buildpacks or a Dockerfile.
6. Click **Deploy**.

You land on the deployment page where you can follow the build of your Node Express application. Once the build is completed, your application is being deployed and you will be able to access it via `<YOUR_APP_NAME>-<YOUR_ORG_NAME>.koyeb.app`.
You will be taken to the deployment page where you can follow the build of your Express application. Once the build is completed, your application will be deployed and you will be able to access it via `<YOUR_APP_NAME>-<YOUR_ORG_NAME>.koyeb.app`.

## Contributing

Expand Down
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ app.get('/', (req, res) => {
})

app.listen(port, () => {
console.log(`App listening at http://localhost:${port}`)
})
console.log(`App is listening on port ${port}`)
})
Loading

0 comments on commit f067ea6

Please sign in to comment.