Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config/secrets.yml getting blown away when I switch branches #68

Open
ywwg opened this issue Mar 30, 2017 · 3 comments
Open

config/secrets.yml getting blown away when I switch branches #68

ywwg opened this issue Mar 30, 2017 · 3 comments

Comments

@ywwg
Copy link
Owner

ywwg commented Mar 30, 2017

This is happening because prod-2017 doesn't have that file checked in, but master does. Not sure if there's an easy git way around this. Maybe just committing a dummy file to prod-2017 and then being VERY CAREFUL when pulling on the prod server?

@Katee
Copy link

Katee commented Mar 30, 2017

You could also pull in the project to a new folder, verify it is running correctly (you can specify a different port bundle exec rails -p 3001 would run on 3001) and then start hosting from that folder. Generally you DO NOT want to be changing files on a currently running project.

In production mode rails loads itself at startup (instead of loading files as they are used which is how in development mode you can test a change to a controller without restarting) so you could even delete files it needed and it would work until next restarted. However your code does make some explicit calls to File.open which could fail. In general changing the files of a currently running server is more precarious since it can be harder to rollback from and should be avoided.

(The are definitely even better ways to handle deployment but they are probably out of scope given your current experience.)

@Katee
Copy link

Katee commented Mar 30, 2017

Another solution is to include the dotenv gem and then override secrets in the prod-2017 branch by creating a .env file and including config/secrets.yml from master.

@ywwg
Copy link
Owner Author

ywwg commented Mar 30, 2017

This is all just on my laptop, not a deployment scenario. I created a copy of secrets.yml so I can bounce between master and prod-2017 and not have to keep making new secrets. I don't want to make any changes w.r.t. the secrets file on the prod server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants