|
|
@@ -5,40 +5,55 @@ images:
|
|
|
- "/docs/deployment/deploy-to-northflank/deploy-to-northflank.webp"
|
|
|
---
|
|
|
|
|
|
+import Tabs from '@theme/Tabs';
|
|
|
+import TabItem from '@theme/TabItem';
|
|
|
+
|
|
|

|
|
|
|
|
|
[Northflank](https://northflank.com) is a comprehensive developer platform to build and scale your apps. It has an outstanding developer experience and has a free tier for small projects, and is well-suited for deploying and scaling Vendure applications.
|
|
|
|
|
|
This guide will walk you through the steps to deploy [a sample Vendure application](https://github.com/vendure-ecommerce/one-click-deploy) to Northflank.
|
|
|
|
|
|
-## Set up your free Northflank account
|
|
|
+## Set up a Northflank account
|
|
|
|
|
|
Go to the Northflank [sign up page](https://app.northflank.com/signup) to create a new account. As part of the sign-up you'll be asked for credit card details, but you won't be charged unless you upgrade to a paid plan.
|
|
|
|
|
|
## Create a custom template
|
|
|
|
|
|
-A template defines the infrastructure that is needed to run your Vendure server. Namely, a **server**, a **worker**, and a **Postgres database**.
|
|
|
+A template defines the infrastructure that is needed to run your Vendure server. Namely, a **server**, a **worker**,
|
|
|
+**MinIO object storage** for assets and a **Postgres database**.
|
|
|
|
|
|
-Click the templates menu item in the left sidebar and click the "Create template" button.
|
|
|
+Click the templates menu item in the navbar and click the "Create template" button.
|
|
|
|
|
|

|
|
|
|
|
|
-Fill in the name of the template (though note that the name will be replaced by the name "Vendure Template" based on the configuration below).
|
|
|
-
|
|
|
-Now paste the following configuration into the "Template" code editor:
|
|
|
+Now paste the following configuration into the editor in the "code" tab:
|
|
|
|
|
|

|
|
|
|
|
|
+<Tabs>
|
|
|
+<TabItem label="Full Template" value="Full Template">
|
|
|
+
|
|
|
+:::note
|
|
|
+This template configures a production-like setup for Vendure, with the server and worker running in separate processes
|
|
|
+and a separate MinIO instance for asset storage.
|
|
|
+
|
|
|
+The resources configured here will cost around $20 per month.
|
|
|
+
|
|
|
+If you want to use the free plan, use the "Lite Template".
|
|
|
+:::
|
|
|
+
|
|
|
+<div class="limited-height-code-block">
|
|
|
|
|
|
```json
|
|
|
{
|
|
|
"name": "Vendure Template",
|
|
|
- "description": "Vendure is a modern, open-source headless commerce framework built with TypeScript & Node.js.",
|
|
|
+ "description": "Vendure is a modern, open-source composable commerce platform",
|
|
|
"apiVersion": "v1",
|
|
|
"project": {
|
|
|
"spec": {
|
|
|
- "name": "Vendure Template",
|
|
|
- "description": "Vendure is a modern, open-source headless commerce framework built with TypeScript & Node.js.",
|
|
|
+ "name": "Vendure",
|
|
|
+ "description": "Vendure is a modern, open-source composable commerce platform",
|
|
|
"region": "europe-west",
|
|
|
"color": "#57637A"
|
|
|
}
|
|
|
@@ -55,7 +70,7 @@ Now paste the following configuration into the "Template" code editor:
|
|
|
"type": "postgres",
|
|
|
"version": "latest",
|
|
|
"billing": {
|
|
|
- "deploymentPlan": "nf-compute-10",
|
|
|
+ "deploymentPlan": "nf-compute-20",
|
|
|
"storageClass": "ssd",
|
|
|
"storage": 4096,
|
|
|
"replicas": 1
|
|
|
@@ -64,6 +79,28 @@ Now paste the following configuration into the "Template" code editor:
|
|
|
"externalAccessEnabled": false
|
|
|
}
|
|
|
},
|
|
|
+ {
|
|
|
+ "kind": "Addon",
|
|
|
+ "spec": {
|
|
|
+ "name": "minio",
|
|
|
+ "description": "",
|
|
|
+ "type": "minio",
|
|
|
+ "tags": [],
|
|
|
+ "version": "latest",
|
|
|
+ "billing": {
|
|
|
+ "deploymentPlan": "nf-compute-20",
|
|
|
+ "storageClass": "ssd",
|
|
|
+ "storage": 4096,
|
|
|
+ "replicas": 1
|
|
|
+ },
|
|
|
+ "tlsEnabled": true,
|
|
|
+ "externalAccessEnabled": false,
|
|
|
+ "ipPolicies": [],
|
|
|
+ "pitrEnabled": false,
|
|
|
+ "typeSpecificSettings": {},
|
|
|
+ "backupSchedules": []
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
"kind": "SecretGroup",
|
|
|
"spec": {
|
|
|
@@ -76,7 +113,8 @@ Now paste the following configuration into the "Template" code editor:
|
|
|
"COOKIE_SECRET": "${fn.randomSecret(32)}",
|
|
|
"SUPERADMIN_USERNAME": "superadmin",
|
|
|
"SUPERADMIN_PASSWORD": "superadmin",
|
|
|
- "DB_SCHEMA": "public"
|
|
|
+ "DB_SCHEMA": "public",
|
|
|
+ "ASSET_UPLOAD_DIR": "/data"
|
|
|
}
|
|
|
},
|
|
|
"addonDependencies": [
|
|
|
@@ -104,6 +142,29 @@ Now paste the following configuration into the "Template" code editor:
|
|
|
"aliases": ["DB_PASSWORD"]
|
|
|
}
|
|
|
]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "addonId": "minio",
|
|
|
+ "keys": [
|
|
|
+ {
|
|
|
+ "keyName": "MINIO_ENDPOINT",
|
|
|
+ "aliases": [
|
|
|
+ "MINIO_ENDPOINT"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "keyName": "ACCESS_KEY",
|
|
|
+ "aliases": [
|
|
|
+ "MINIO_ACCESS_KEY"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "keyName": "SECRET_KEY",
|
|
|
+ "aliases": [
|
|
|
+ "MINIO_SECRET_KEY"
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
@@ -139,7 +200,7 @@ Now paste the following configuration into the "Template" code editor:
|
|
|
"spec": {
|
|
|
"name": "server",
|
|
|
"billing": {
|
|
|
- "deploymentPlan": "nf-compute-10"
|
|
|
+ "deploymentPlan": "nf-compute-20"
|
|
|
},
|
|
|
"deployment": {
|
|
|
"instances": 1,
|
|
|
@@ -187,6 +248,29 @@ Now paste the following configuration into the "Template" code editor:
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
+ {
|
|
|
+ "kind": "Volume",
|
|
|
+ "spec": {
|
|
|
+ "name": "storage",
|
|
|
+ "mounts": [
|
|
|
+ {
|
|
|
+ "volumeMountPath": "",
|
|
|
+ "containerMountPath": "/data"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "spec": {
|
|
|
+ "storageSize": 5120,
|
|
|
+ "storageClassName": "ssd",
|
|
|
+ "accessMode": "ReadWriteOnce"
|
|
|
+ },
|
|
|
+ "attachedObjects": [
|
|
|
+ {
|
|
|
+ "id": "server",
|
|
|
+ "type": "service"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
"kind": "Build",
|
|
|
"spec": {
|
|
|
@@ -201,6 +285,173 @@ Now paste the following configuration into the "Template" code editor:
|
|
|
}
|
|
|
```
|
|
|
|
|
|
+</div>
|
|
|
+
|
|
|
+</TabItem>
|
|
|
+
|
|
|
+
|
|
|
+<TabItem label="Lite Template" value="Lite Template">
|
|
|
+
|
|
|
+:::note
|
|
|
+This template runs the Vendure server & worker in a single process, and as such will fit within the
|
|
|
+resource limits of the Northflank free plan. Local disk storage is used for assets, which means that
|
|
|
+horizontal scaling is not possible.
|
|
|
+
|
|
|
+This setup is suitable for testing purposes, but is not recommended for production use.
|
|
|
+:::
|
|
|
+
|
|
|
+
|
|
|
+<div class="limited-height-code-block">
|
|
|
+
|
|
|
+```json
|
|
|
+{
|
|
|
+ "name": "Vendure Template Lite",
|
|
|
+ "description": "Vendure is a modern, open-source composable commerce platform",
|
|
|
+ "apiVersion": "v1",
|
|
|
+ "project": {
|
|
|
+ "spec": {
|
|
|
+ "name": "Vendure",
|
|
|
+ "description": "Vendure is a modern, open-source composable commerce platform",
|
|
|
+ "region": "europe-west",
|
|
|
+ "color": "#57637A"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "spec": {
|
|
|
+ "kind": "Workflow",
|
|
|
+ "spec": {
|
|
|
+ "type": "sequential",
|
|
|
+ "steps": [
|
|
|
+ {
|
|
|
+ "kind": "Addon",
|
|
|
+ "spec": {
|
|
|
+ "name": "database",
|
|
|
+ "type": "postgres",
|
|
|
+ "version": "latest",
|
|
|
+ "billing": {
|
|
|
+ "deploymentPlan": "nf-compute-20",
|
|
|
+ "storageClass": "ssd",
|
|
|
+ "storage": 4096,
|
|
|
+ "replicas": 1
|
|
|
+ },
|
|
|
+ "tlsEnabled": false,
|
|
|
+ "externalAccessEnabled": false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "kind": "SecretGroup",
|
|
|
+ "spec": {
|
|
|
+ "name": "secrets",
|
|
|
+ "secretType": "environment-arguments",
|
|
|
+ "priority": 10,
|
|
|
+ "secrets": {
|
|
|
+ "variables": {
|
|
|
+ "APP_ENV": "production",
|
|
|
+ "COOKIE_SECRET": "${fn.randomSecret(32)}",
|
|
|
+ "SUPERADMIN_USERNAME": "superadmin",
|
|
|
+ "SUPERADMIN_PASSWORD": "superadmin",
|
|
|
+ "DB_SCHEMA": "public",
|
|
|
+ "ASSET_UPLOAD_DIR": "/data",
|
|
|
+ "RUN_JOB_QUEUE_FROM_SERVER": "true"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "addonDependencies": [
|
|
|
+ {
|
|
|
+ "addonId": "database",
|
|
|
+ "keys": [
|
|
|
+ {
|
|
|
+ "keyName": "HOST",
|
|
|
+ "aliases": ["DB_HOST"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "keyName": "PORT",
|
|
|
+ "aliases": ["DB_PORT"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "keyName": "DATABASE",
|
|
|
+ "aliases": ["DB_NAME"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "keyName": "USERNAME",
|
|
|
+ "aliases": ["DB_USERNAME"]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "keyName": "PASSWORD",
|
|
|
+ "aliases": ["DB_PASSWORD"]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "kind": "BuildService",
|
|
|
+ "spec": {
|
|
|
+ "name": "build",
|
|
|
+ "billing": {
|
|
|
+ "deploymentPlan": "nf-compute-10"
|
|
|
+ },
|
|
|
+ "vcsData": {
|
|
|
+ "projectUrl": "https://github.com/vendure-ecommerce/one-click-deploy",
|
|
|
+ "projectType": "github"
|
|
|
+ },
|
|
|
+ "buildSettings": {
|
|
|
+ "dockerfile": {
|
|
|
+ "buildEngine": "kaniko",
|
|
|
+ "dockerFilePath": "/Dockerfile",
|
|
|
+ "dockerWorkDir": "/",
|
|
|
+ "useCache": false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "kind": "DeploymentService",
|
|
|
+ "spec": {
|
|
|
+ "name": "server",
|
|
|
+ "billing": {
|
|
|
+ "deploymentPlan": "nf-compute-20"
|
|
|
+ },
|
|
|
+ "deployment": {
|
|
|
+ "instances": 1,
|
|
|
+ "docker": {
|
|
|
+ "configType": "customCommand",
|
|
|
+ "customCommand": "yarn start:server"
|
|
|
+ },
|
|
|
+ "internal": {
|
|
|
+ "id": "build",
|
|
|
+ "branch": "master",
|
|
|
+ "buildSHA": "latest"
|
|
|
+ }
|
|
|
+ },
|
|
|
+ "ports": [
|
|
|
+ {
|
|
|
+ "name": "p01",
|
|
|
+ "internalPort": 3000,
|
|
|
+ "public": true,
|
|
|
+ "protocol": "HTTP"
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "kind": "Build",
|
|
|
+ "spec": {
|
|
|
+ "id": "build",
|
|
|
+ "type": "service",
|
|
|
+ "branch": "master"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+```
|
|
|
+
|
|
|
+</div>
|
|
|
+
|
|
|
+</TabItem>
|
|
|
+</Tabs>
|
|
|
+
|
|
|
Then click the "Create template" button.
|
|
|
|
|
|
## Run the template
|
|
|
@@ -233,9 +484,12 @@ Congratulations on deploying your Vendure server!
|
|
|
|
|
|
## Next steps
|
|
|
|
|
|
-Now that you have a basic Vendure server up and running, you can explore some of the other features offered by Northflank that you might need for a full production setup:
|
|
|
+Now that you have a basic Vendure server up and running, you can explore some of the other features offered by Northflank
|
|
|
+that you might need for a full production setup:
|
|
|
|
|
|
-- [Set up a MinIO instance](https://northflank.com/docs/v1/application/databases-and-persistence/deploy-databases-on-northflank/deploy-minio-on-northflank) for storing assets using our [S3 asset storage integration]({{< relref "s3asset-storage-strategy" >}}#configures3assetstorage).
|
|
|
-- [Set up a Redis instance](https://northflank.com/docs/v1/application/databases-and-persistence/deploy-databases-on-northflank/deploy-redis-on-northflank) so that you can take advantage of our highly performant [BullMQJobQueuePlugin]({{< relref "bull-mqjob-queue-plugin" >}}) and set up [Redis-based session caching]({{< relref "session-cache-strategy" >}}) to handle multi-instance deployments.
|
|
|
+- Configure [health checks](https://northflank.com/docs/v1/application/observe/configure-health-checks) to ensure any container crashes are rapidly detected and restarted. Also see the
|
|
|
+[Vendure health check docs](/guides/deployment/using-docker#healthreadiness-checks).
|
|
|
+- [Set up a Redis instance](https://northflank.com/docs/v1/application/databases-and-persistence/deploy-databases-on-northflank/deploy-redis-on-northflank) so that you can take advantage of our highly performant [BullMQJobQueuePlugin](/reference/core-plugins/job-queue-plugin/bull-mqjob-queue-plugin) and set up [Redis-based session caching](/reference/typescript-api/auth/session-cache-strategy/) to handle multi-instance deployments.
|
|
|
- With the above in place, you can safely start to [scale your server instances](https://northflank.com/docs/v1/application/scale/scaling-replicas) to handle more traffic.
|
|
|
- [Add a custom domain](https://northflank.com/docs/v1/application/domains/add-a-domain-to-your-account) using Northflank's powerful DNS management system.
|
|
|
+- Set up [infrastructure alerts](https://northflank.com/docs/v1/application/observe/set-infrastructure-alerts) to be notified when any of your containers crash or experience load spikes.
|