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

Run Backups in the jobs Container #114

Closed
1 of 3 tasks
harshkhandeparkar opened this issue Oct 23, 2023 · 4 comments · Fixed by #127
Closed
1 of 3 tasks

Run Backups in the jobs Container #114

harshkhandeparkar opened this issue Oct 23, 2023 · 4 comments · Fixed by #127
Assignees

Comments

@harshkhandeparkar
Copy link
Member

harshkhandeparkar commented Oct 23, 2023

The jobs container is used for running recurrent jobs like updating the trending pages and the spam IP list. Backup is also a recurrent job, so there is no need to make a separate container for it.

TODO

  • Fix the backup script.
  • Make the backup script delete backups older than one month (excluding the last backup that has images).
  • Merge the backup script into the jobs container.
@shikharish
Copy link
Member

Pls assign me this issue.

@harshkhandeparkar
Copy link
Member Author

Sure!

@shikharish
Copy link
Member

The backup script works fine, the issue is with the dropbox api token. Apparently dropbox only issues short-span tokens now(expires in about 4hrs). To get a token to last, we can request for a refresh token and store both the tokens and they will be used every time the script runs.
So, up until now all we used was a token and it just worked. There was no oauth flow, no need to authenticate as we had provided the token which was generated from the dropbox app console. But, the console cannot generate refresh tokens, that has to be done with a script. And the script needs: app_key, app_secret, access_token, refresh_token. The first two can be found in the app console. For the last two, we can run the script just once, which will fetch both(after authentication) and can store them somewhere.
The recurring backup will also require all four variables. So maybe we can add three more environment variables(?) and the script which needs to be run only once for setting up dropbox.

@harshkhandeparkar
Copy link
Member Author

The backup script works fine, the issue is with the dropbox api token. Apparently dropbox only issues short-span tokens now(expires in about 4hrs). To get a token to last, we can request for a refresh token and store both the tokens and they will be used every time the script runs. So, up until now all we used was a token and it just worked. There was no oauth flow, no need to authenticate as we had provided the token which was generated from the dropbox app console. But, the console cannot generate refresh tokens, that has to be done with a script. And the script needs: app_key, app_secret, access_token, refresh_token. The first two can be found in the app console. For the last two, we can run the script just once, which will fetch both(after authentication) and can store them somewhere. The recurring backup will also require all four variables. So maybe we can add three more environment variables(?) and the script which needs to be run only once for setting up dropbox.

Nice find! Can you submit the changes pertaining to just the refresh token in a PR? We can work on the other two action items in subsequent PRs. Thanks!

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

Successfully merging a pull request may close this issue.

2 participants