ywwg / ffagc

Firefly Art Grant Core Website
0 stars 1 forks source link

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

Open ywwg opened 7 years ago

ywwg commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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.