Skip to content

Fix errors when switching branches in service repositories#63

Open
Exairnous wants to merge 1 commit intoHubs-Foundation:mainfrom
Exairnous:fix-syncing-on-branch-changed
Open

Fix errors when switching branches in service repositories#63
Exairnous wants to merge 1 commit intoHubs-Foundation:mainfrom
Exairnous:fix-syncing-on-branch-changed

Conversation

@Exairnous
Copy link
Member

What?

Changes docker-compose.yml to make Mutagen use one-way-replica as the sync mode.

Why?

For some reason, using two-way-resolved would sometimes not accept the changes from a branch switch in a service repository and actually push some of the old code from the previous branch in the Docker container back to your filesystem, this would result in both the Docker container and your file system being in a halfway state between branches and cause errors with the affected service. Changing to one-way-replica forces the Docker container to always mirror your file system and prevents this problem.

Examples

No visual change.

How to test

Note: the main thing to test is switching back and forth between the different branches in the hubs repository and seeing if you encounter any errors when trying to use Hubs. I initially worked on this fix many months ago and so I may have missed a step for testing (the testing steps I've listed below would take at least a few hours for me to complete - because of download time - so I have written them from memory).

  1. Run Hubs Compose with all the services on their default branch (bin/up).
  2. Visit the homepage and then a room and see that you are able to load both.
  3. Run bin/down.
  4. Switch the branch for the hubs repository in the services folder to the addons branch.
  5. Run bin/init.
  6. Run bin/up.
  7. Visit the homepage and then a room and see that you are able to load both (previously you may have encountered errors at some point).
  8. Run bin/down.
  9. Switch the branch for the hubs repository in the services folder back to the master branch.
  10. Run bin/init.
  11. Run bin/up.
  12. Visit the homepage and then a room and see that you are able to load both (previously you may have encountered errors at some point).

Documentation of functionality

The previous behaviour wasn't documented and this change aligns the actual functionality with what is expected, so no documentation update is needed.

Limitations

None known.

Alternatives considered

None.

Open questions

  • Was there some reason one-way-replica wasn't used in the first place? E.g. could this cause issues with dependencies that are installed in Docker, but not on your hard drive (it didn't seem to, but I didn't do much testing)?
  • Should an architectural decision be recorded for this, as mentioned in the readme?

Additional details or related context

The issue this pull request solves was mainly noticed when switching between the master branch and the addons branch in the hubs repository (the branches have different dependencies, which could possibly be a contributing factor).

https://mutagen.io/documentation/synchronization/

Issue #56 may or may not be fixed by this.

The Node version update for the hubs Dockerfile from PR #62 is probably needed in order to test this.

What:
Changes docker-compose.yml to make Mutagen use `one-way-replica` as the sync mode.

Why:
For some reason, using `two-way-resolved` would sometimes not accept the changes from the branch switch and actually push some of the old code from the previous branch in the Docker container back to your filesystem, this would result in both the Docker container and your file system being in a halfway state between branches and cause errors with the affected service.  Changing to `one-way-replica` forces the Docker container to always mirror your file system and prevents this problem.

Note:
This was mainly noticed when switching between the master branch and the addons branch in the `hubs` repository (the branches have different dependencies, which could possibly be a contributing factor).
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.

1 participant