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

Refresh Facebook CDN URLs on deploy #2

Closed
dentarg opened this issue Nov 12, 2016 · 7 comments
Closed

Refresh Facebook CDN URLs on deploy #2

dentarg opened this issue Nov 12, 2016 · 7 comments

Comments

@dentarg
Copy link
Member

dentarg commented Nov 12, 2016

Idea to address #1:

  • Make _plugins/remote_facebook_photos.rb read app_secret from ENV (as a fallback, if possible? to not need ENV locally (e.g. Windows))
  • Add the facebook app secret to env.secure in .travis.yml
  • Remove the files in_data/facebook
  • Exclude any files in _data/facebookfrom git

Then every deploy would refresh the Facebook CDN URLs.

Pros:

  • no need to save even more images in the git repo

Cons:

  • deploy would take longer, currently takes ~50s (see build history), locally doing jekyll build with empty _data/facebook directory reported done in 74.092 seconds. today
  • working iteratively, pushing many commits would build up a big deploy backlog and the Facebook API might not like it?
  • ENV is tricky business on Windows might be able to continue to use jekyll configuration locally
@dentarg
Copy link
Member Author

dentarg commented Jan 6, 2017

Using Travis CI Cron Jobs, some of the cons above would be addressed, it's possible to make a difference on regular deploy and cron:

To check whether a build was triggered by cron, examine the TRAVIS_EVENT_TYPE environment variable to see if it has the value cron.

@dentarg
Copy link
Member Author

dentarg commented Jan 6, 2017

The cron job is configured at https://travis-ci.org/klubbdinmamma/klubbdinmamma.github.io/settings

@dentarg
Copy link
Member Author

dentarg commented Jan 6, 2017

Hmm, I don't want to remove and exclude _data/facebook from git, I think they are good to keep around, makes for fast local builds (though the could easily be outdated, but then you can update them manually).

Then we make _plugins/remote_facebook_photos.rb always fetch fresh data from Facebook if run via cron on Travis by looking at TRAVIS_EVENT_TYPE.

@dentarg
Copy link
Member Author

dentarg commented Jan 6, 2017

Re: the facebook app secret and ENV, Travis can encrypt files: https://docs.travis-ci.com/user/encrypting-files/, so it should be possible to use _config_secrets.yml on Travis

@dentarg
Copy link
Member Author

dentarg commented Jan 6, 2017

Then we make _plugins/remote_facebook_photos.rb always fetch fresh data from Facebook if run via cron

We need to always fetch fresh data from facebook on Travis (i.e. deploying) if the repo can contain stale data.

@dentarg dentarg closed this as completed in cb2eaa3 Jan 6, 2017
@dentarg
Copy link
Member Author

dentarg commented Jan 6, 2017

$ travis encrypt-file _config_secrets.yml --add
Detected repository as klubbdinmamma/klubbdinmamma.github.io, is this correct? |yes| y
encrypting _config_secrets.yml for klubbdinmamma/klubbdinmamma.github.io
storing result as _config_secrets.yml.enc
storing secure env variables for decryption

Make sure to add _config_secrets.yml.enc to the git repository.
Make sure not to add _config_secrets.yml to the git repository.
Commit all changes to your .travis.yml.

@dentarg
Copy link
Member Author

dentarg commented Nov 1, 2017

working iteratively, pushing many commits would build up a big deploy backlog and the Facebook API might not like it?

Not a problem with Auto Cancellation: https://blog.travis-ci.com/2017-03-22-introducing-auto-cancellation

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

1 participant