strapi/docs/3.x.x/guides/deployment.md

78 lines
2.2 KiB
Markdown
Raw Normal View History

# Deployment
2019-01-15 13:29:39 +01:00
### Docker
::: tip
2019-01-15 13:32:23 +01:00
You can also deploy using [Docker](https://hub.docker.com/r/strapi/strapi])
2019-01-15 13:29:39 +01:00
:::
The method below describes regular deployment using the built-in mechanisms.
2018-10-11 20:51:47 +02:00
#### #1 - Configure
Update the `production` settings with the IP and domain name where the project will be running.
**Path —** `./config/environments/production/server.json`.
```js
{
"host": "domain.io", // IP or domain
"port": 1337,
"autoReload": {
"enabled": false
},
"admin": {
"path": "/dashboard" // We highly recommend to change the default `/admin` path for security reasons.
}
}
```
In case your database is not running on the same server, make sure that the environment of your production
database (`./config/environments/production/database.json`) is set properly.
If you are passing a number of configuration item values via environment variables which is always encouraged for production environment to keep application stateless, checkout the section for [Dynamic Configuration](../configurations/configurations.md#dynamic-configurations). Here is a hint on how to do it for production, for the configuration mentioned above:
**Path —** `./config/environments/production/server.json`.
```js
{
"host": "${process.env.APP_HOST || '127.0.0.1'}"
"port": "${process.env.NODE_PORT || 1337}",
"autoReload": {
"enabled": false
},
"admin": {
"path": "/dashboard" // We highly recommend to change the default `/admin` path for security reasons.
}
}
```
**⚠️ If you changed the path to access to the administration, the step #2 is required.**
#### #2 - Setup (optional)
Run this following command to install the dependencies and build the project with your custom configurations.
```bash
cd /path/to/the/project
npm run setup
```
::: note
To display the build logs use the --debug option `npm run setup --debug`.
:::
#### #3 - Launch the server
Run the server with the `production` settings.
```bash
NODE_ENV=production npm start
```
::: warning
We highly recommend to use [pm2](https://github.com/Unitech/pm2/) to manage your process.
:::
### Advanced configurations
If you want to host the administration on another server than the API, [please take a look at this dedicated section](../advanced/customize-admin.md#deployment).