Additional Setup/Deploy Information

Additional information about Deploy wait time, Deploy check port, SSH keys with passphrase and other server setup details

Deploy Wait Time

Oreact Up checks if the deployment is successful or not just after the deployment. It will wait 15 seconds after starting the docker container before starting the checks. The check runs every second until it either can successfully load the app’s client, or it runs out of time as defined in app.deployCheckWaitTime.

Deploy check port

If you are deploying under a proxy/firewall and need a different port to be checked after deploy, add a variable called deployCheckPort with the value of the port you are publishing your application to.

app: {
 ...
  deployCheckPort: 80
 ...
}

SSH keys with passphrase (or ssh-agent support)

This only tested with Mac/Linux

It's common to use passphrase enabled SSH keys to add an extra layer of protection to your SSH keys. You can use those keys with orup too. In order to do that, you need to use ssh-agent.

Here’s the process:

  • Remove the pem field from orup.js so your orup.js has username and host only.
  • Start ssh agent with eval $(ssh-agent)
  • Add your ssh key with ssh-add <path-to-key>
  • You’ll be asked to enter the passphrase to the key
  • After that, simply invoke orup commands and they’ll just work
  • Once you’ve deployed your app, kill ssh agent with ssh-agent -k

SSH based authentication with sudo

If your username is root or you’re using AWS EC2, you don’t need to follow these steps.

Please ensure your key file (pem) is not protected by a passphrase. This setup process will require NOPASSWD access to sudo. (Since oreact needs port 80, sudo access is required.)

Make sure you also add your ssh key to the /YOUR_USERNAME/.ssh/authorized_keys list.

You can add your user to the sudo group:

sudo adduser *username*  sudo

And you also need to add NOPASSWD to the sudoers file:

sudo visudo

# replace this line
%sudo  ALL=(ALL) ALL

# by this line
%sudo ALL=(ALL) NOPASSWD:ALL

When this process is not working you might encounter the following error:

'sudo: no tty present and no askpass program specified'

Server Setup Details

Oreact Up uses Docker to run and manage your app. It uses OreactD behind the scenes. Here’s how we manage and utilize the server.

  • Your currently running oreact bundle lives at /opt/<appName>/current
  • We have a demonized docker container running the above bundle
  • The docker container is started with --restart=always flag and it’ll re-spawn the container if it dies
  • Logs are maintained via Docker
  • If you decided to use MongoDB, it will be running as its own Docker container. It’s bound to the local interface and to port 27017 (you cannot access it from the outside)
  • The database is named <appName>

Deploy to multiple servers

Add all of the servers to the servers object and modify app.servers to include them.

Multiple Deployment Environments

To deploy to different environments (e.g. staging, production, etc.), use separate Oreact Up configurations in separate directories, with each directory containing separate orup.js file, and set the app.path field in each config to point back to your app’s directory.

Multiple Deployments

Oreact Up supports multiple deployments to a single server. To route requests to the correct app, use the reverse proxy.

Let’s assume we need to deploy production and staging versions of the app to the same server. The production is at myapp.com, and staging is at staging.myapp.com.

We need to have two separate Oreact Up projects. For that, create two directories, initialize Oreact Up, and add the necessary configurations.

In the staging orup.js, change the field app.name to have the value staging. You can add any name you prefer instead of staging.

Next, add the proxy object to both configs. For your production app, it would be:

module.exports = {
  // ... rest of config

  proxy: {
    domains: 'myapp.com'
  }
};

For the staging app, proxy.domains would be staging.myapp.com.

Now, set up both projects and deploy the apps.