Alexandre Bodin da910b0b39 Fix create new project cli option for mongo not handled correctly
Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>

Fix typos

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>

Add tests for env helpers

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>

Typo

Signed-off-by: Alexandre Bodin <bodin.alex@gmail.com>
2020-04-29 11:06:44 +02:00

7.1 KiB

Deployment

Strapi gives you many possible deployment options for your project or application. Strapi can be deployed on traditional hosting servers or services such as Heroku, AWS, Azure and others. The following documentation covers how to develop locally with Strapi and deploy Strapi with various hosting options.

::: tip Deploying databases along with Strapi is covered in the Databases Guide. :::

Hosting Provider Guides

Manual guides for deployment on various platforms, for One-click and docker please see the installation guides.

Amazon AWS Step by step guide for deploying on AWS EC2
Azure Step by step guide for deploying on Azure web app
DigitalOcean Manual step by step guide for deploying on DigitalOcean droplets
Google App Engine Manual step by step guide for deploying on GCP's App Engine
Heroku Step by step guide for deploying on Heroku

Optional Software Guides

Additional guides for optional software additions that compliment or improve the deployment process when using Strapi in a production or production-like environment.

Nginx Overview of proxying Strapi with Nginx

Application Configuration

1. Configure

We always recommend you use environment variables to configure your application based on the environment. Here is an example:

Path — ./config/server.js.

module.exports = ({ env }) => ({
  host: env('APP_HOST', '0.0.0.0'),
  port: env.int('NODE_PORT', 1337),
});

Then you can create a .env file or directly use the deployment platform you use to set environment variables:

Path — .env.

APP_HOST=10.0.0.1
NODE_PORT=1338

::: tip To learn more about configuration you can read the documentation here :::

2. Launch the server

Before running your server in production you need to build your admin panel for production

:::: tabs

::: tab yarn

NODE_ENV=production yarn build

:::

::: tab npm

NODE_ENV=production npm run build

:::

::: tab Windows

npm install cross-env

Then in your package.json scripts section:

"production": "cross-env NODE_ENV=production npm run build"

:::

::::

Run the server with the production settings.

:::: tabs

::: tab yarn

NODE_ENV=production yarn start

:::

::: tab npm

NODE_ENV=production npm start

:::

::: tab Windows

npm install cross-env

Then in your package.json scripts section:

"production": "cross-env NODE_ENV=production npm start"

:::

::::

::: warning We highly recommend using pm2 to manage your process. :::

If you need a server.js file to be able to run node server.js instead of npm run start then create a ./server.js file as follows:

const strapi = require('strapi');

strapi(/* {...} */).start();

Advanced configurations

If you want to host the administration on another server than the API, please take a look at this dedicated section.