Skip to content

Prepare an example on how to run MFYNAB in Docker#56

Open
davidstosik wants to merge 2 commits into
mainfrom
sto/docker
Open

Prepare an example on how to run MFYNAB in Docker#56
davidstosik wants to merge 2 commits into
mainfrom
sto/docker

Conversation

@davidstosik

@davidstosik davidstosik commented Feb 27, 2025

Copy link
Copy Markdown
Owner

First step towards a deploy process based on Kamal: getting MFYNAB to run in a Docker container.

The hardest parts were:

  • getting Chrome(ium) to run in the container on Apple Silicon
  • forwarding environment to cron

Note this PR is based on sto/refresh-mf-accounts.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR prepares an example to run MFYNAB in Docker, laying the groundwork for a deploy process based on Kamal.

  • Gemfile updated to pull MFYNAB from a specific GitHub branch
  • Adjustments to Ferrum configuration in the session for Docker compatibility
  • Freshness limit for account status reduced and README updated with Docker run instructions

Reviewed Changes

File Description
docker_example/Gemfile Added gem dependency with a FIXME note to update to the latest RubyGems release
lib/mfynab/money_forward/session.rb Updated Ferrum browser instantiation to support running Chromium as root in Docker
lib/mfynab/money_forward/account_status.rb Adjusted the freshness limit from 1 day to 1 hour
README.md Extended documentation with instructions on running MFYNAB with cron and Docker

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

lib/mfynab/money_forward/account_status.rb:70

  • The freshness limit has been reduced from 24 hours to 1 hour. Confirm that this shorter interval meets the intended caching or update frequency requirements.
FRESHNESS_LIMIT = 60 * 60 # 1 hour

Comment on lines +81 to +84
# FIXME: this was needed to be able to run Chromium headless
# within Docker as root, but I'd rather not rely on it.
browser_options: { "no-sandbox": nil },

Copilot AI Feb 27, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the 'no-sandbox' option can expose security vulnerabilities. Consider conditionally enabling it only when running in Docker by checking an environment variable to better isolate production and container-specific behavior.

Suggested change
# FIXME: this was needed to be able to run Chromium headless
# within Docker as root, but I'd rather not rely on it.
browser_options: { "no-sandbox": nil },
browser_options: ENV.key?("IN_DOCKER") ? { "no-sandbox": nil } : {},
# FIXME: this was needed to be able to run Chromium headless
# within Docker as root, but I'd rather not rely on it.

Copilot uses AI. Check for mistakes.
@davidstosik
davidstosik force-pushed the sto/docker branch 2 times, most recently from 73f36f2 to c077317 Compare February 28, 2025 00:24
Base automatically changed from sto/refresh-mf-accounts to main March 25, 2025 02:27
@davidstosik
davidstosik force-pushed the sto/docker branch 3 times, most recently from d7d57fb to 1fd0451 Compare March 25, 2025 13:52
Also don't commit Gemfile.lock in that example, since versions should follow with time.
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 this pull request may close these issues.

2 participants