简体   繁体   中英

Add Seeds file after Dokku build

I am using dokku-alot to deploy my Rails 4 app to my staging server and everything is working just swell.

One requirement I have with my current project is in regards to seed file data. I've had to keep my seeds.rb file out of version control because of sensitive information. However, I can't figure out how to add the seeds.rb file into the container after a build.

I've tried ssh root@myhost ap_name which gets me into the VM but even if I scp the files into there, the container doesn't see them. How can I drop a few files where my rails code is in the docker image?

Depending on how much information is in your seeds.rb file, you could use environmental variables . This the solution I ended up using.

You basically set the variable: config:set my-app SECRET=whateversupersecretinfo . Then in your code, you can extract that app variable by using ENV['SECRET'] . (This works pretty much the same in Heroku ) Not sure if that would solve your use case, but leaving this answer here for posterity.

subnote: In Node.js you can extract these variables like process.env.SECRET

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM