Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tutorials): add Next.js x Serverless SQL DB tutorial #79

Merged
merged 8 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ Table of Contents:
| **[Kong API Gateway](projects/kong-api-gateway/README.md)** <br/> Deploying a Kong Gateway on containers to provide routing to functions. | CaaS & FaaS | Python | [Serverless Framework] |
| **[Serverless Gateway](https://github.com/scaleway/serverless-gateway)** <br/> Our serverless gateway for functions and containers. | API Gateway | Python | [Python API Framework] |
| **[Monitoring Glaciers](projects/blogpost-glacier/README.md)** <br/> A project to monitor glaciers and the impact of global warming. | S3 & RDB | Golang | [Serverless Framework] |
| **[Manage large message](projects/large-messages/README.md)** <br/> An example of infrastructure to manage large messages. | PaaS & S3 | Python | [Terraform] |
| **[Serverless scraping](projects/serverless-scraping/README.md)** <br/> An example of infrastructure to scrape the hackernews website. | PaaS & RDB | Python | [Terraform] |
| **[Serverless NextJS app](projects/tutorial-sdb-nextjs-terraform/README.md)** <br/> A serverless Next.js blog with a Serverless Database. | PaaS & SDB | JS | [Terraform] - [CLI] |

[Serverless Framework]: https://github.com/scaleway/serverless-scaleway-functions
[Terraform]: https://registry.terraform.io/providers/scaleway/scaleway/latest/docs
Expand Down
34 changes: 34 additions & 0 deletions projects/tutorial-sdb-nextjs-terraform/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

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

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
20 changes: 20 additions & 0 deletions projects/tutorial-sdb-nextjs-terraform/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# syntax=docker/dockerfile:1

FROM node:20-alpine

WORKDIR /usr/app
COPY ./ ./
RUN npm install
RUN npm run build

#Web application configuration
ENV PORT=8080

#Database configuration used for dynamically rendered data
ENV PGHOST=localhost
ENV PGPORT=5432
ENV PGDATABASE=database
ENV PGUSER=user
ENV PGPASSWORD=password

CMD npm run start
23 changes: 23 additions & 0 deletions projects/tutorial-sdb-nextjs-terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Deploy a Next.js application using Serverless Containers and Serverless SQL Databases

This repository contains the source code for this tutorial:
[Deploy a Next.js application using Serverless Containers and Serverless SQL Databases](https://www.scaleway.com/en/docs/tutorials/nextjs-app-serverless-functions-sqldb/)

## Requirements

This tutorial assumes that you have basic knowledge of:
- Terminals and Command Line Interfaces (CLI)
- [Docker](https://docs.docker.com/build/cloud/) for building and pushing container images
- [Node.js](https://nodejs.org/docs/latest/api/synopsis.html) for importing and manipulating packages
- [Terraform](https://developer.hashicorp.com/terraform/intro) (optional)

## Context

This tutorial will allow you to deploy a fully serverless Next.js application using Scaleway's [Serverless Containers](https://www.scaleway.com/en/docs/serverless/containers/) and [Serverless SQL Databases](https://www.scaleway.com/en/docs/serverless/sql-databases/) in a few minutes.

## Disclaimer

The application used for the purpose of this tutorial is the `starter-blog` example available in the public [Next.js repository](https://github.com/vercel/next.js/tree/canary/examples/blog-starter).

Refer to the [Vercel licence](./licence) for more information.

9 changes: 9 additions & 0 deletions projects/tutorial-sdb-nextjs-terraform/license
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2024 Vercel, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading
Loading