Heroku的:在本地文件系统中使用外部挂载 [英] Heroku: Using external mount in local filesystem

查看:283
本文介绍了Heroku的:在本地文件系统中使用外部挂载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是可能使用保险丝装入一个Amazon S3存储(s3fs [或s3fsr红宝石宝石?])。

I know it's possible to mount an Amazon S3 bucket using Fuse (s3fs [or s3fsr ruby gem?]).

我的情况是特定的Heroku。

My case is specific to Heroku.

Heroku的文件系统是只读的可扩展性等,但有没有办法安装一个Amazon S3在Heroku的文件系统?

Heroku's filesystem is readonly for scalability and such, but is there a way to mount an amazon s3 in Heroku's filesystem?

在我的情况,我用管理平台在Heroku上,并想用管理平台内置的Git仓库管理环节code审查,以我的问题。管理平台需要克隆库到本地目录,这是可能的,但不是永久的在Heroku。

In my case, I use Redmine on Heroku and would like to use Redmine's built-in git repository management to link code reviews to my issues. Redmine needs to clone the repository to a local directory, which is possible but not persistent on Heroku.

我想管理平台,以保持对已安装的S3存储桶一个Git仓库。这可能吗?如果有可能,如何慢会是这样?是否有任何其他办法来实现这一点?

I would like Redmine to maintain a git repository on a mounted S3 bucket. Is this possible? If it was possible, how slow would that be? Are there any other alternatives to achieve this?

推荐答案

我还没有找到完美的答案,我的问题,但这里有一个确定的解决方法。

I haven't found the perfect answer to my question but here's an OK workaround.

您可以通过创建一个名为Procfile文件,在项目的根目录下覆盖默认Heroku的启动脚本(等等)。

You can override the default Heroku boot script (and much more) by creating a file called Procfile at the root of your project.

这里的Procfile:

Here's the Procfile :

# run custom boot scirpt
web: sh /app/config/web-boot.sh

它告诉Heroku的,这个脚本启动管理平台。

It tells Heroku that this script boots Redmine.

我用用到位桶的私人资料库,所以我创建了一个SSH密钥对,并把他们安置在配置/ SSH /。然后,我添加了公钥到我的帐户到位桶的部署键到位桶增加的公钥来我的'配置/ SSH / know_hosts文件

I'm using Bitbucket with a private repository, so I created a SSH key pair and placed them in 'config/ssh/'. Then, I added the Public key to my Bitbucket account's deploy keys and added Bitbucket's public Key to my 'config/ssh/know_hosts' file

这里的配置/ web-boot.sh'文件:

Here's the 'config/web-boot.sh' file :

# move ssh keys
mkdir /app/.ssh
cp /app/config/ssh/* /app/.ssh/

# git clone code repos
mkdir /tmp/repos

# Do this for every repo you want to clone
git clone --bare ssh://git@bitbucket.org/[YOUR_ACCOUNT]/[YOUR_REPO].git /tmp/repos/[YOUR_REPO]
git --git-dir=/tmp/repos/[YOUR_REPO] remote add origin ssh://git@bitbucket.org/[YOUR_ACCOUNT]/[YOUR_REPO].git
git --git-dir=/tmp/repos/[YOUR_REPO] fetch origin

# run Unicorn http server
cd /app
bundle exec unicorn -p $PORT -c ./config/unicorn.rb

然后,你可以在Git仓库通过指定添加到您的管理平台项目的/ tmp /回购/ [YOUR_REPO]

Then you can just add the Git repository to your Redmine project by specifying '/tmp/repos/[YOUR_REPO]'

您可以使用 管理平台挂钩到位桶插件 拉当你把修改到位桶资料库修改。

You can use Redmine Bitbucket Hook plugin to pull changes to your repository when you push changes to Bitbucket.

这不是理想的有一个私钥希望身边这个样子,但是在我的特定情况下,这个键是唯一的这个程序,并仅用于获取只读访问我的code库。

It's not ideal to have a private key hoping around like this, but in my specific case, this key is unique to this app and is only used to gain readonly access to my code repository.

这篇关于Heroku的:在本地文件系统中使用外部挂载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆