Skip to content

Commit 5c66d19

Browse files
committed
feature #8109 [Encore] Adding FAQ about deploy and git (weaverryan)
This PR was merged into the 3.3 branch. Discussion ---------- [Encore] Adding FAQ about deploy and git This answers a few other common questions :). Commits ------- fec9d87 Adding FAQ about deploy and git
2 parents 86ee4da + fec9d87 commit 5c66d19

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

frontend/encore/faq.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,57 @@
11
FAQ and Common Issues
22
=====================
33

4+
How do I deploy my Encore Assets?
5+
---------------------------------
6+
7+
There are two important things to remember when deploying your assets.
8+
9+
**1) Run ``encore production``**
10+
11+
Optimize your assets for production by running:
12+
13+
.. code-block:: terminal
14+
15+
$ ./node_modules/.bin/encore production
16+
17+
That will minify your assets and make other performance optimizations. Yay!
18+
19+
But, what server should you run this command on? That depends on how you deploy.
20+
For example, you could execute this locally (or on a build server), and use rsync
21+
or something else to transfer the built files to your server. Or, you could put your
22+
files on your production server first (e.g. via a git pull) and then run this command
23+
on production (ideally, before traffic hits your code). In this case, you'll need
24+
to install Node.js on your production server.
25+
26+
**2) Only Deploy the Built Assets**
27+
28+
The *only* files that need to be deployed to your production servers are the
29+
final, built assets (e.g. the ``web/build`` directory). You do *not* need to install
30+
Node.js, deploy ``webpack.config.js``, the ``node_modules`` directory or even your source
31+
asset files, **unless** you plan on running ``encore production`` on your production
32+
machine. Once your assets are built, these are the *only* thing that need to live
33+
on the production server.
34+
35+
Do I need to Install Node.js on my Production Server?
36+
-----------------------------------------------------
37+
38+
No, unless you plan to build your production assets on your production server,
39+
which is not recommended. See `How do I deploy my Encore Assets?`_.
40+
41+
What Files Should I commit to git? And which should I Ignore?
42+
-------------------------------------------------------------
43+
44+
You should commit all of your files to git, except for the ``node_modules/`` directory
45+
and the built files. Your ``.gitignore`` file should include:
46+
47+
.. code-block:: text
48+
49+
/node_modules/
50+
# whatever path you're passing to Encore.setOutputPath()
51+
/web/build
52+
53+
You *should* commit all of your source asset files, ``package.json`` and ``yarn.lock``.
54+
455
My App Lives under a Subdirectory
556
---------------------------------
657

0 commit comments

Comments
 (0)