Skip to content

Commit

Permalink
Merge branch 'main' into redirection-push-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gilzow authored Dec 4, 2024
2 parents a6bf4e2 + 982bf8a commit 9ee65e9
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions sites/upsun/src/get-started/stacks/nextjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ To create your Next.js app, follow these steps.
To fast track the process, run the following commands:

```bash {location="Terminal"}
npx create-next-app@latest
npx create-next-app@latest myapp
```

2. To initialize the local Git repository and commit local files, run the following commands:

```bash {location="Terminal"}
cd my-app
cd myapp
git init
git add .
git commit -m "Init Next.js application."
Expand Down Expand Up @@ -81,7 +81,7 @@ title=Using the Console
2. Click **Create from scratch**.

3. Fill in details like the project name and [region](/development/regions.md).

{{% note %}}

You can define resources for your project later on, after your first push.
Expand Down Expand Up @@ -171,7 +171,7 @@ They are located in a `.{{% vendor/cli %}}/` folder at the root of your source c
and structured in a similar way to this:
```txt
my-express-app
myapp
├── .{{% vendor/cli %}}
│ └── config.yaml
├── [.environment]
Expand All @@ -184,19 +184,35 @@ To generate these files, run the following command at the root of your project:
{{% vendor/cli %}} project:init
```
Follow the prompts.
Follow the prompts, and you should result in such a config file.
```yaml {configFile="apps"}
applications:
myapp:
type: "nodejs:20"
hooks:
build: |
set -eux
npm run build
web:
commands:
start: npm run start -- -p $PORT
myapp:
source:
root: "/"
type: "nodejs:{{% latest "nodejs" %}}"
mounts:
"/.npm":
source: "storage"
source_path: "npm"
hooks:
build: |
set -eux
npm i
npm run build
web:
commands:
start: npm run start -p $PORT
upstream:
socket_family: tcp
locations:
"/":
passthru: true
routes:
"https://{default}/": { type: upstream, upstream: "myapp:http" }
"http://{default}/": { type: redirect, to: "https://{default}/" }
```
As an example, above is the minimum configuration needed to deploy a Next.js application on {{% vendor/name %}} without any services.
Expand Down Expand Up @@ -305,7 +321,7 @@ To make changes to your project, follow these steps:
--- a/views/index.jade
+++ b/views/index.jade
@@ -2,4 +2,4 @@ extends layout
block content
h1= title
- p Welcome to #{title}
Expand Down Expand Up @@ -337,7 +353,7 @@ To make changes to your project, follow these steps:
{{% vendor/cli %}} environment:delete feat-a
git fetch --prune
```
Note that deploying to production is fast because the image built for the `feat-a` environment is reused.
For a long running branch, to keep the code up-to-date with the main branch, use `git merge main` or `git rebase main`.
Expand Down

0 comments on commit 9ee65e9

Please sign in to comment.