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

Various Possible Improvements #304

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

william-riley-land
Copy link

I've been setting up cal.com using Docker, and found some possible improvements that may be of use to the community:

  • Improvements to build speed
  • Some security hardening
  • Simplify environment variable handling
  • Skip need to run replacement script (this may not have been working as intended)
  • Remove need for DOCKER_BUILDKIT=0 by moving DB migration to container start up
  • Disable telemetry of various packages (you probably won't like this, which I understand, but I am compelled to suggest it for the pro-opt-in side of the debate :)

Of any use?

@william-riley-land william-riley-land changed the title Updates. Various Possible Improvements Nov 2, 2023
@krumware
Copy link
Member

krumware commented Nov 3, 2023

Lots of great things in here, thanks especially for the security hardening.
Can you by chance re-add the database_password portion back to the .env?

I'll need to verify the changes for the database at build-time. That was required by the build process for doing inserts based on env config values for the plugins, and not required only for the migrations. Did you by chance check on that as well?

@william-riley-land william-riley-land force-pushed the refactor/simplify branch 10 times, most recently from c3a5a6f to 2e0b4f4 Compare November 4, 2023 02:01
@william-riley-land
Copy link
Author

Thanks for taking a look. I think I addressed the two issues, let me know how it looks.

@william-riley-land william-riley-land force-pushed the refactor/simplify branch 4 times, most recently from 27fe632 to 8ad507e Compare November 5, 2023 03:45
@william-riley-land
Copy link
Author

Here's what I think the main open questions are, in summary:

  • Remove need for submodule
    • Remove need to use the submodule during build
    • Remove submodule as trigger for GitHub action. I have a few ideas how this could be done, but it is probably better done by someone with access to test the GitHub actions (?)
  • Remove need for buildX/database access during build
    • Run migrations and seed app store at container start
    • Is the app store script idempotent? If so, fine to run every container start. Otherwise, need a check before running it. Or, run it manually with something like docker compose run calcom npx ts-node --transpile-only packages/prisma/seed-app-store.ts

@krumware
Copy link
Member

krumware commented Nov 20, 2023

Remove submodule as trigger for GitHub action. I have a few ideas how this could be done, but it is probably better done by someone with access to test the GitHub actions (?) - it's a remote action trigger, still necessary because the release is actually performed in the cal.com repo. Using the release as an arg should be fine, the way you have it.
But another thought is this could be challenging for development workflow if folks still want to use a local directory with changes and not pull from remote every build. Is there a good solution to allow both?

I'm still working to get some confirmation on the changes that have allowed the removal of the build-time variable insertion.

@william-riley-land
Copy link
Author

That makes sense. This set up assumes that the user wants to take the Dockerfile and get the software running as quickly as possible, but there are other considerations around publishing the official image and supporting workflows with custom updates to the codebase. Are there any of the updates from this PR that seem ready to go (or close)? I can pull them out into a separate PR if you'd like.

To me it seems straightforward for a user to change the main ADD line to a different git URL or just ADD . if needed. (As an aside, why not just include the Dockerfile in the main repo? Of course cal.com probably has a good reason for setting it up in its own repo, but it seems like an area where the build/publish process could be simplified.)

Note that by default, using ADD with a git link does not pull from the repo every time, it is cached and only pulled when the tag (or commit SHA) has changed. Of course if that layer is deleted, for example by running docker system prune, the repo will be pulled again. The pull takes only a few seconds, which is a small fraction of the build time in my experience.

@william-riley-land
Copy link
Author

I've continued to work on this. I've made some updates and now I have it running with v4.0.7. I haven't pushed it here.

Is there any interest in any of the features in the PR? Zoom works fine; that's the only integration I am using though. Happy to run other tests if there is interest. Also happy to separate into smaller PRs, if the work is valuable to anyone else.

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.

None yet

2 participants