Skip to content

Commit

Permalink
feature #8109 [Encore] Adding FAQ about deploy and git (weaverryan)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
weaverryan committed Jul 6, 2017
2 parents 86ee4da + fec9d87 commit 5c66d19
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions frontend/encore/faq.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,57 @@
FAQ and Common Issues
=====================

How do I deploy my Encore Assets?
---------------------------------

There are two important things to remember when deploying your assets.

**1) Run ``encore production``**

Optimize your assets for production by running:

.. code-block:: terminal
$ ./node_modules/.bin/encore production
That will minify your assets and make other performance optimizations. Yay!

But, what server should you run this command on? That depends on how you deploy.
For example, you could execute this locally (or on a build server), and use rsync
or something else to transfer the built files to your server. Or, you could put your
files on your production server first (e.g. via a git pull) and then run this command
on production (ideally, before traffic hits your code). In this case, you'll need
to install Node.js on your production server.

**2) Only Deploy the Built Assets**

The *only* files that need to be deployed to your production servers are the
final, built assets (e.g. the ``web/build`` directory). You do *not* need to install
Node.js, deploy ``webpack.config.js``, the ``node_modules`` directory or even your source
asset files, **unless** you plan on running ``encore production`` on your production
machine. Once your assets are built, these are the *only* thing that need to live
on the production server.

Do I need to Install Node.js on my Production Server?
-----------------------------------------------------

No, unless you plan to build your production assets on your production server,
which is not recommended. See `How do I deploy my Encore Assets?`_.

What Files Should I commit to git? And which should I Ignore?
-------------------------------------------------------------

You should commit all of your files to git, except for the ``node_modules/`` directory
and the built files. Your ``.gitignore`` file should include:

.. code-block:: text
/node_modules/
# whatever path you're passing to Encore.setOutputPath()
/web/build
You *should* commit all of your source asset files, ``package.json`` and ``yarn.lock``.

My App Lives under a Subdirectory
---------------------------------

Expand Down

0 comments on commit 5c66d19

Please sign in to comment.