如何在 Ubuntu 上部署 Amber 应用程序?

How to Deploy an Amber App on Ubuntu?

刚刚发现 Amber...看起来不错!如何在 Ubuntu 服务器上部署示例应用程序?是否应该像 Rails 一样,将路径路由到 public?还是结构的其他部分?

感谢您的建议。

Amber 将为您提供静态资产,只需将 nginx 指向端口 3000。

这是 nginx 配置作为 Amber 运行 端口 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;
  }
}

然后,使用 AMBER_ENV=production:

启动 Amber
#!/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

这一切都假设您的琥珀色应用程序被命名为 app