Skip to main content

Deploying to Northflank

./deploy-to-northflank.webp

Northflank 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 to Northflank.

Set up a Northflank account

Go to the Northflank sign up page 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, MinIO object storage for assets and a Postgres database.

Click the templates menu item in the navbar and click the "Create template" button.

./01-create-template-screen.webp

Now paste the following configuration into the editor in the "code" tab:

./02-paste-config.webp

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".

{
"apiVersion": "v1",
"name": "Vendure Template",
"description": "Vendure is a modern, open-source composable commerce platform",
"project": {
"spec": {
"name": "Vendure",
"region": "europe-west",
"description": "Vendure is a modern, open-source composable commerce platform",
"color": "#57637A"
}
},
"spec": {
"kind": "Workflow",
"spec": {
"type": "sequential",
"steps": [
{
"kind": "Workflow",
"spec": {
"type": "parallel",
"steps": [
{
"kind": "Addon",
"ref": "database",
"spec": {
"name": "database",
"type": "postgres",
"version": "14-latest",
"billing": {
"deploymentPlan": "nf-compute-20",
"storageClass": "ssd",
"storage": 4096,
"replicas": 1
},
"tlsEnabled": false,
"externalAccessEnabled": false,
"ipPolicies": [],
"pitrEnabled": false
}
},
{
"kind": "Addon",
"ref": "storage",
"spec": {
"name": "minio",
"type": "minio",
"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": {
"secretType": "environment-arguments",
"priority": 10,
"name": "secrets",
"secrets": {
"variables": {
"APP_ENV": "production",
"COOKIE_SECRET": "${fn.randomSecret(32)}",
"SUPERADMIN_USERNAME": "superadmin",
"SUPERADMIN_PASSWORD": "${fn.randomSecret(16)}",
"DB_SCHEMA": "public"
},
"files": {}
},
"addonDependencies": [
{
"addonId": "${refs.database.id}",
"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"
]
}
]
},
{
"addonId": "${refs.storage.id}",
"keys": [
{
"keyName": "MINIO_ENDPOINT",
"aliases": [
"MINIO_ENDPOINT"
]
},
{
"keyName": "ACCESS_KEY",
"aliases": [
"MINIO_ACCESS_KEY"
]
},
{
"keyName": "SECRET_KEY",
"aliases": [
"MINIO_SECRET_KEY"
]
}
]
}
],
"restrictions": {
"restricted": false,
"nfObjects": [],
"tags": []
}
}
},
{
"kind": "BuildService",
"ref": "builder",
"spec": {
"name": "builder",
"billing": {
"deploymentPlan": "nf-compute-20"
},
"vcsData": {
"projectUrl": "https://github.com/vendure-ecommerce/one-click-deploy",
"projectType": "github"
},
"buildSettings": {
"dockerfile": {
"buildEngine": "kaniko",
"dockerFilePath": "/Dockerfile",
"dockerWorkDir": "/",
"useCache": false
}
},
"disabledCI": false,
"buildArguments": {}
}
},
{
"kind": "Build",
"spec": {
"id": "${refs.builder.id}",
"type": "service",
"branch": "master",
"buildOverrides": {
"buildArguments": {}
},
"reuseExistingBuilds": true
},
"condition": "success",
"ref": "build"
},
{
"kind": "Workflow",
"spec": {
"type": "parallel",
"steps": [
{
"kind": "DeploymentService",
"spec": {
"deployment": {
"instances": 1,
"docker": {
"configType": "customCommand",
"customCommand": "node ./dist/index.js"
},
"internal": {
"buildId": "${refs.build.id}",
"buildSHA": "latest"
}
},
"name": "server",
"billing": {
"deploymentPlan": "nf-compute-20"
},
"ports": [
{
"name": "app",
"internalPort": 3000,
"public": true,
"protocol": "HTTP",
"security": {
"credentials": [],
"policies": []
},
"domains": [],
"disableNfDomain": false
}
],
"runtimeEnvironment": {},
"runtimeFiles": {}
}
},
{
"kind": "DeploymentService",
"spec": {
"name": "worker",
"billing": {
"deploymentPlan": "nf-compute-10"
},
"deployment": {
"instances": 1,
"docker": {
"configType": "customCommand",
"customCommand": "node ./dist/index-worker.js"
},
"internal": {
"buildId": "${refs.build.id}",
"buildSHA": "latest"
}
},
"ports": [],
"runtimeEnvironment": {}
}
}
]
}
}
]
}
}
}

Then click the "Create template" button.

Run the template

Next, click the "run template" button to start the deployment process.

./03-run-template.webp

Once the template run has completed, you should be able to see the newly-created project in the project selector.

./04-find-project.webp

Find the public URL

Click the "Services" menu item in the left sidebar and then click the "Server" service.

./05-server-service.webp

In the top right corner you'll see the public URL of your new Vendure server!

Note that it may take a few minutes for the server to start up and populate all the test data because the free tier has limited CPU and memory resources.

Once it is ready, you can navigate to the public URL and append /admin to the end of the URL to access the admin panel.

./06-find-url.webp

note

The superadmin password was generated for you by the template, and can be found in the "Secrets" section from the project nav bar as SUPERADMIN_PASSWORD.

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: