A
A
Alex2017-03-13 12:42:16
git
Alex, 2017-03-13 12:42:16

How to deploy a nuxt application?

Hello. I'm just starting to understand this topic and it's not entirely clear to me how to implement the application on a production server.
To build a nuxt application, you need to run
npm run build
To run a nuxt server in production mode, you need to run
npm start
After that, the application is available at localhost:3000. This is enough for development.
How to upload the application to the server? Use FTP? Or git push? Or maybe some kind of Codeship service for example? How to stop an already running nuxt server and then start it back? Do I need to use nginx?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2017-03-13
@Kozack

How to upload the application to the server? Use FTP? Or git push? Or maybe some kind of Codeship service for example?

Yes, how convenient, all options have the right to life to one degree or another. I clone applications from github, then I do npm install.
If there is no stop command in package.json, then stop with kill -9 <pid процесса>:) In general, there should be some kind of nodemon / pm2 / forever, which restart the process when the code changes.
To respond on port 80, you need super-user rights. It is possible to run the application as root in the sale, but this is somehow dumb. Therefore, they are proxying with nginx. Plus, it distributes static more efficiently.
PS: https://nuxtjs.org/guide/commands/

A
Alexander Antonyuk, 2018-07-15
@Alex_42

Hello.
As mentioned above, I clone from github (then it is convenient to do pull when changing the code)
The application needs to be run, let's say, in the background, for this I use pm2 on the server.
Command order:
1. Clone / pull the project
2. npm install
3. npm run build
4. pm2 start app
To stop: pm2 stop app

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question