Deploy to your own server
This how-to serves the site folder from a machine you run. Any server that sends static files works. It is one option in the Deploy overview.
You need a server with a web server on it, SSH access, and a site-prod folder from the overview's script. The nginx example is the one we checked; use your own server's equivalent.
Check it on your laptop first
Before you upload anything, serve the folder locally. The --single flag sends unknown paths to index.html:
You should see a local address. Open it and click a remote route.
Configure the web server
A server needs four rules. Remotes and hashed files are cached for a year. The index, the config and index.html are checked every time. Unknown app routes fall back to index.html. Unknown files under /mfe/ are a real 404.
add_header is repeated in each location on purpose. nginx only inherits it from the level above when a location sets none of its own.
Test and reload:
You should see syntax is ok and test is successful. Add TLS with the tool you already use. The shell's index holds https addresses, so serve the site over HTTPS.
Upload in the right order
Remote files go first, then the shell, then the two small files that decide what is live. If the index goes up before the files it points to, users get a broken page.
Never use --delete on the mfe folder. Old versions have to stay for a rollback.
Roll back
Keep a copy of each index you publish, such as index-1.2.0.json in a folder outside the web root. To roll back, copy the old one over the live file:
Users get the old version on their next page load. Nothing is rebuilt.
The mfeflow registry server
A plain file server like the one above is enough for deploys and rollbacks by pointer. If you want percentage rollouts, a kill switch and scoped tokens, you can run the mfeflow registry server beside it. It is optional. See Run the registry server.
If you want commands that upload and roll back for you, mfeflow deploy can write to a folder or an S3-compatible bucket. See Deploy and roll back a remote.
Next
- Compare hosts: Deploy overview.