Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Deploy an Amber App on Ubuntu?

Just discovered Amber...looks nice! How can I deploy a sample App on an Ubuntu Server? Should it be done just like Rails, routing the path to public? Or some other part of the structure?

Thanks for your advice.

like image 802
Werner Avatar asked Feb 09 '18 10:02

Werner


1 Answers

Amber will serve the static assets for you, just point nginx at port 3000.

This is a good starting point for nginx configuration as a front to Amber running on port 3000:

upstream amber {
  server 127.0.0.1:3000;
}

server {
  listen 80 default_server;
  listen [::]:80 default_server;

  root /var/www/html;
  index index.html index.htm index.nginx-debian.html;

  server_name _;

  location / {
    proxy_pass http://amber;
  }
}

Then, start Amber with AMBER_ENV=production:

#!/bin/bash

set -euo pipefail
IFS=$'\n\t'

npm install 
npm run release 
shards build app --production

# if you need it
# export DATABASE_URL="postgres://user:password@hostname:port/database_name"
export AMBER_ENV="production"

exec bin/app

This all assumes your amber app is named app

like image 144
voxobscuro Avatar answered Oct 23 '22 19:10

voxobscuro