M
M
mbrut2020-06-15 08:50:47
JavaScript
mbrut, 2020-06-15 08:50:47

What is the best way to update the bundle on prod?

There is a code that is assembled into a webpack bundle, while everything is clear on my locale - I launched watch and the bundle was updated when updating, but what is the best way to update on prod? I see a couple of options:
ignore the bundle itself, and hang the build on the githuk on the prod
, store the bundle under the git, rebuild it on the local before the commit and send it to the prod in this form.
Surely this is already a worked case, but I couldn’t find anything in Google .

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Pautov, 2020-06-15
@mbrut

On the sale, the bundle is being rebuilt !!!! Prod is not a dev mod where everything is assembled and changed on the fly. For prod 1 time gathered and that's it. We made a new feature, edit, etc., rolled it out, rebuilt it.
Bundles are not stored in the git, only when you are developing some libraries, etc., so that you can immediately take and use them. For projects, bundles are not stored in the git, bundles are assembled directly on the server. Because bundles are almost always built based on the environment in which they work.
The environment is a test ground, or a combat ground. Usually, projects are accompanied by environment variables (.env or otherwise, it doesn’t change the essence) in which different data necessary for the project are written. Api url, mode (production, development, sometimes stage), port, application name for easy debugging when starting a named process on which the application will be launched, etc. Therefore, during the build, the environment variables are entered into the bundle and are already stored there.
It is also better not to store environment variables in the git, because any developer should be able to change these values ​​to their own without any problems. For example, the server dev port. For example, my port 3000 can be busy with something of my own, and in order to run the application, I just change the port to my own.
Or collect it on your computer, and then upload it so as not to waste server resources at that moment. And then just restart the server. This option is suitable if you always have 1 data source. And you don't actually need any environment variables. But as for me, they should always be.
We went to the server, created a file with variables in your directory and that's it.
They opened the terminal, gave the command, assembled it. Or automate this process, but that's another story.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question