When you deploy your app, it is reccomended that you run volt with the VOLT_ENV=production environment variable set. This will disable code reloading and sourcemaps and enable some performance boosting settings (at the cost of load time).
In volt, you can precompile all of your apps assets to a /public folder. When precompiling, Volt does the following:
All assets will be compiled into the /public folder, which you can serve directly via something like nginx. Precompiling results in a substantial initial page load speed boost, and results in fewer requests from the browser.
To precompile your app's assets, simply run:
VOLT_ENV=production bundle exec volt precompile
Asset precompiling copies images referenced in css/sass/html files from components into the public folder. You may notice that all assets are renamed during precompiling to have a fingerprint hash on the end (eg:
profile-) This lets you cache all images/fonts/etc. in the public folder for an indefinite amount of time. If the contents of the file changes, a new hash will be assigned. (This is the same process used by rails, see their much more complete docs for more info)
See the Assets section for details on setting up image tags, css, etc. to point to assets correctly.
Volt does all database queries, updates, task calls, etc.. through a websocket connection. Websockets are created by "Upgrading" existing http connections. Typically volt will use the existing http connection to setup the websockets connection. However sometimes you may need to connect to the websocket through a different domain, port, etc.. (usually due to the main app running behind a non-websocket compatible proxy server). You can configure the websocket url in
config/app.rb like so:
# ... Volt.configure do |config| # ... config.public.websocket_url = 'websocket.mysite.com/socket' # ... end
Volt will automatically add ws:// or wss:// to the front of the url if not specified.
The rest of this chapter highlights various deployment options for Volt on popular cloud providers.