开发、暂存和生产环境 Rails 应用
我正在创建一个应用程序,除了实时生产环境之外,还需要开发和暂存环境。生产环境目前已上线并位于其自己的 VPS 实例上。记录:
myapp.com 1.2.3.4
开发和登台环境将位于它们自己的 VPS 实例上。我已经配置了适当的 DNS 记录,因此每个环境都有自己的子域(myapp.com 域中指向开发/登台服务器的记录:
dev.myapp.com 5.6.7.8
staging.myapp.com 5.6.7.8
Nginx confix(Rails、Passenger)为每个服务器设置根(wild)卡 SSL 在 http 定义中配置,端口 80 重定向到端口 443):
server {
listen 443;
server_name dev.myapp.com
root /apps/myapp/dev/public
}
server {
listen 443;
server_name staging.myapp.com
root /apps/myapp/staging/public
}
我在 Rails 方面有点困惑,我还需要做什么来配置环境,以便我可以通过 URL 访问单独的开发和临时环境:
staging.myapp.com
dev.myapp.com
我知道 Capistrano 允许您设置生产和暂存环境,但我需要开发和暂存 URL 都处于活动状态,还是这应该足够了?
I'm creating an app that in addition to the live production environment requires a development and staging environment. The production environment is currently live and on its own VPS instance. A record:
myapp.com 1.2.3.4
The development and staging environments will be on their own VPS instance. I've configured the appropriate DNS records so each environment has its own sub-domain (A record in the myapp.com domain pointing to the dev/staging server:
dev.myapp.com 5.6.7.8
staging.myapp.com 5.6.7.8
The Nginx confix (Rails, Passenger) sets the root for each server (wild card SSL is configure in the http definition and port 80 redirects to port 443):
server {
listen 443;
server_name dev.myapp.com
root /apps/myapp/dev/public
}
server {
listen 443;
server_name staging.myapp.com
root /apps/myapp/staging/public
}
I'm a bit confused on the Rails side what else do I need to do to configure the environments so I can access the individual dev and staging environments by URL:
staging.myapp.com
dev.myapp.com
I know Capistrano allows you to set production and staging environments but I need both the dev and staging URLs to be live or should this be sufficient?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
rails_env
选项。例如:You can set the environment for each instance using the
rails_env
option. For example: