# "Bare Metal" Installation

If Docker on your OS of choice is buggy or too slow, or you just want to run Nodewood directly on your machine, you absolutely can. In fact, a common way to run Nodewood in production is to just run it directly on a Virtual Machine, no Docker or anything.

# Requirements

First, you must make sure you have Node.js (opens new window) and Yarn (opens new window) installed, same as for running Nodewood in Docker. Next, you'll need to install Nodemon (opens new window), a process monitor that can watch files and restart processes when they change. Finally, you have to make sure you have PostgreSQL (opens new window) installed, or have access to a running PostgreSQL instance.

# Running the API

First, you'll need to make a couple small changes to your .env file:

  • Set DB_HOST, DB_PORT, DB_DB, DB_USER, and DB_PASS to match your new PostgreSQL installation's configuration.
  • Add PORT=80.

To run the API in development mode, just run yarn dev-api from your project root. This is the same command that the Docker container runs.

To run the API in production mode, you can use Nodemon as above, but a more robust solution would involve setting up something like PM2 (opens new window), a process manager that can be configured via a config file and persists through machine restart.

# Running the UI

The API will serve any requests that are prefixed with /app by rewriting to /ui/dist/index.html, so all we need to do is build the UI into that folder.

For development mode, run yarn build-ui --watch from your project root. This will compile assets into the ui/dist folder and then watch UI files for changes, and then recompile as necessary.

For production, just run yarn build-ui. This will also compile assets into the ui/dist folder, but it will perform additional minification steps that make the process much longer, and it will not watch for updates, so you will need to manually trigger this every time your code changes.

# Accessing your installation

To access your installation, just go to http://localhost in your browser. Note that this is NOT a secure ("https") URL, so certain third-party integrations (notably Stripe) may get grumpy. In order to get an https URL working, you have a few options:

  1. Generate self-signed certificates and modify the api.js file that the API uses to start, so that the server starts with those certificates. (opens new window)
  2. Use Nginx or some other server to serve the SSL certificates, and proxy the requests to your Node.js application. (opens new window) This is the approach the Docker solution uses internally, which is why you can use https URLs out-of-the-box when you run Nodewood from Docker.