Skip to content

[Encore] Add version support for the --public parameter and a small docker support section #16622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .doctor-rst.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ whitelist:
- '# username is your full Gmail or Google Apps email address'
- '.. _`LDAP injection`: http://projects.webappsec.org/w/page/13246947/LDAP%20Injection'
- '.. versionadded:: 1.9.0' # Encore
- '.. versionadded:: 1.8.2' # Encore
- '.. versionadded:: 0.28.4' # Encore
- '.. versionadded:: 2.4.0' # SwiftMailer
- '.. versionadded:: 1.30' # Twig
Expand Down
49 changes: 49 additions & 0 deletions frontend/encore/virtual-machine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ If your Symfony application is running on a custom domain (e.g.
}
}

.. versionadded:: 1.8.2

The ``--public`` option was added in Encore 1.8.2

After restarting Encore and reloading your web page, you will probably see
different issues in the web console:

Expand All @@ -69,6 +73,25 @@ different issues in the web console:
You still need to make other configuration changes, as explained in the
following sections.

If your Webpack Dev Server HMR hub is unreachable because it is located
in a different url, you may use this option to tell webpack where to look
for it:

.. code-block:: diff

{
...
"scripts": {
- "dev-server": "encore dev-server",
+ "dev-server": "encore dev-server --public http://app.vm:8080 --client-web-socket-url ws://app.vm:8080/ws",
...
}
}

Note that in this particular case, ``--public`` will do the job of telling
webpack where to locate its HMR hub. But there may be edge cases in which
you may need to specify this as well.

Allow External Access
~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -92,6 +115,32 @@ connections:
Make sure to run the development server inside your virtual machine only;
otherwise other computers can have access to it.

Docker support
~~~~~~~~~~~~~~

If you are using ``docker``, to set up a ``nodejs`` ``docker-compose`` setup
that works with the ``localhost:8080`` domain, add this to your
``docker-compose-yml`` file:

.. code-block:: yaml

services:
nodejs:
image: node:16
working_dir: /var/www
ports:
- '8080:8080'
volumes:
- ./:/var/www:rw,cached
- ~/.symfony/certs/default.p12:/root/.symfony/certs/default.p12
command: bash -c "yarn && yarn run dev-server --public https://localhost:8080 --host 0.0.0.0 --server-type https"

.. note::

``https``: You may need to load the ``https://localhost:8080`` url once
with your browser and accept the security exception before your assets
can be loaded correctly under https.

Fix "Invalid Host header" Issue
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down