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

Added Docker support for Talawa Admin repository #1453

Closed
wants to merge 16 commits into from

Conversation

Devesh326
Copy link

What kind of change does this PR introduce?

Docker feature

Issue Number:

Fixes #1075

Did you add tests for your changes?

No

If relevant, did you update the documentation?

Will update the documentation once the solution is approved.

Summary

Dockerization of a repository has the following advantages:

  1. Reduces Setup Issues for Contributors
  2. Eliminates "It Works on My Machine" Problem
  3. Ensures Consistency Across Environments

Have you read the contributing guide?

Yes

Copy link

Our Pull Request Approval Process

We have these basic policies to make the approval process smoother for our volunteer team.

Testing Your Code

Please make sure your code passes all tests. Our test code coverage system will fail if these conditions occur:

  1. The overall code coverage drops below the target threshold of the repository
  2. Any file in the pull request has code coverage levels below the repository threshold
  3. Merge conflicts

The process helps maintain the overall reliability of the code base and is a prerequisite for getting your PR approved. Assigned reviewers regularly review the PR queue and tend to focus on PRs that are passing.

Reviewers

When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congratulations on making your first PR! 🎊 If you haven't already, check out our Contributing Guidelines and PR Reporting Guidelines to ensure that you are following our guidelines for contributing and creating PR.

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (378248d) 97.29% compared to head (83f363d) 97.28%.
Report is 31 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1453      +/-   ##
===========================================
- Coverage    97.29%   97.28%   -0.01%     
===========================================
  Files          133      132       -1     
  Lines         3396     3392       -4     
  Branches      1038     1038              
===========================================
- Hits          3304     3300       -4     
  Misses          87       87              
  Partials         5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@palisadoes palisadoes left a comment

Choose a reason for hiding this comment

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

  1. Update this file with the newly added docker files
    1. https://github.com/PalisadoesFoundation/talawa-admin/blob/develop/.github/workflows/authorized-changes-detection.yml
  2. Update INSTALLATION.md. Users will need to know what to expect. Use the version in Talawa-API as a guide.
  3. Update setup.ts. Use the version in Talawa-API as a guide. This feature must be easy to implement.

@palisadoes
Copy link
Contributor

  1. @kb-0311
  2. @vasujain275
  3. @EshaanAgg

Please take a look and comment. You have been involved with Docker updates to the repos in the recent past

@palisadoes
Copy link
Contributor

Merge your code with the latest upstream. The introspection tests should be passing.

@Devesh326
Copy link
Author

Hey @palisadoes,
There's already an PR for script.ts #1350 , so should i work on it once its merged to avoid merge conflicts?

@palisadoes
Copy link
Contributor

Hey @palisadoes, There's already an PR for script.ts #1350 , so should i work on it once its merged to avoid merge conflicts?

That should be merged in a day or two

@vasujain275
Copy link

@Devesh326 @palisadoes

Wouldn't it be better to push the talawa-admin image to Docker Hub or any public Docker repository and then use that image in the docker-compose file for talawa-api? This way, the talawa-admin container will be in the same Docker network/group with other containers such as mongo, redis, and the talwa-api container. We can have a CI/CD pipeline to push a new image to Docker Hub on every merge, which can be pulled by the docker-compose file in the talawa-api repo.

@Devesh326
Copy link
Author

Devesh326 commented Jan 20, 2024

@Devesh326 @palisadoes

Wouldn't it be better to push the talawa-admin image to Docker Hub or any public Docker repository and then use that image in the docker-compose file for talawa-api? This way, the talawa-admin container will be in the same Docker network/group with other containers such as mongo, redis, and the talwa-api container. We can have a CI/CD pipeline to push a new image to Docker Hub on every merge, which can be pulled by the docker-compose file in the talawa-api repo.

While @palisadoes can provide additional insights but in my opinion

  1. This would increase the build/execution time for talawa-api.
  2. Definitely including docker image for talawa-admin would reduce installation/execution complexity but is there any other specific reason for both to be on the same network?

Pls correct me if i am wrong.

@palisadoes
Copy link
Contributor

  1. Please fix the conflicting files
  2. The setup script PR has been merged. You can add the script updates to this PR

@palisadoes
Copy link
Contributor

I'm not very familiar with Docker Hub but it appears to be similar to an app store.

  1. The repos are too dynamic to have such a tight coupling between Admin and API.
  2. We are constantly adding and removing features in one and/or the other.
  3. This is something we can consider later when:
    1. the compatibilities between the two are more stable.
    2. we feel confident that the main branches are ready for Alpha and Beta testing.

The short term aim of dockerization is to make life of the developer less complicated in getting the app setup.

@vasujain275
Copy link

@palisadoes @Devesh326

  1. Yes, I agree; it is better to have separate docker-compose files for talawa-api and talawa-admin for now.
  2. Once this PR is merged, we can create a different PR for setting up a github workflow to push these images to Docker Hub.
  3. Once the Docker Hub CI/CD pipeline is working, we can provide developers setting up talawa-api using Docker Compose an option parameter to also run talawa-admin by using the Docker Hub image.
  4. This will especially help talawa mobile app developers, as they can run both talawa-api and talawa-admin from the Docker Compose file of the talawa-api repo by passing an optional argument to the docker-compose up command.

@Devesh326
Copy link
Author

Devesh326 commented Jan 21, 2024

Hey @palisadoes,

When I committed the changes my forked branch says 7 files changed, but here it shows 232 files changed, maybe its showing the changed files of the setup script PR since it was mentioned here.

So should i make a new PR or this is fine?

@Devesh326 Devesh326 requested a review from palisadoes January 21, 2024 16:35
@Devesh326
Copy link
Author

Hey @palisadoes,

If any changes are required please let me know!

@palisadoes
Copy link
Contributor

Hey @palisadoes,

When I committed the changes my forked branch says 7 files changed, but here it shows 232 files changed, maybe its showing the changed files of the setup script PR since it was mentioned here.

So should i make a new PR or this is fine?

The documentation file bug has been fixed.

  1. Create a branch based on the current upstream
  2. zip the files in the documentation directory for this branch
  3. Use the PR branch
  4. unzip the documentation over documentation directory
  5. Commit the changes

Merging with your upstream should have no conflicts

@palisadoes
Copy link
Contributor

@kb-0311 @vasujain275 Is this ready to merge? I'm not familiar with docker.

@vasujain275
Copy link

@Devesh326 Please fix the PR, how is this changing 232 files?

Dockerfile Outdated Show resolved Hide resolved
@vasujain275
Copy link

@Devesh326

  1. Implement a multi-stage build for the Docker container.
  2. Instead of including all the source code and Node modules in the Docker container, it should only contain build files and serve from that production build.
  3. You can reference this example from here - https://www.fl0.com/blog/the-perfect-multi-stage-dockerfile-for-node-js-apps.
  4. I am following the same approach and will refactor the talawa-api Dockerfile too once the cloud instance scripts are done, as it is more efficient and offers significant performance and security advantages.

@Devesh326
Copy link
Author

Devesh326 commented Jan 23, 2024

@vasujain275

yeah i dont know why it was showing 232 files changed, merging with the latest upstream fixed it.

@Devesh326
Copy link
Author

@Devesh326

  1. Implement a multi-stage build for the Docker container.
  2. Instead of including all the source code and Node modules in the Docker container, it should only contain build files and serve from that production build.
  3. You can reference this example from here - https://www.fl0.com/blog/the-perfect-multi-stage-dockerfile-for-node-js-apps.
  4. I am following the same approach and will refactor the talawa-api Dockerfile too once the cloud instance scripts are done, as it is more efficient and offers significant performance and security advantages.

Sure Great Idea!

@palisadoes
Copy link
Contributor

Hey @palisadoes,

When I committed the changes my forked branch says 7 files changed, but here it shows 232 files changed, maybe its showing the changed files of the setup script PR since it was mentioned here.

So should i make a new PR or this is fine?

The documentation file bug has been fixed.

  1. Create a branch based on the current upstream
  2. zip the files in the documentation directory for this branch
  3. Use the PR branch
  4. unzip the documentation over documentation directory
  5. Commit the changes

Merging with your upstream should have no conflicts

This is how you fix the 200+ file issue.

We had a bug in one of our GitHub actions

@Devesh326
Copy link
Author

This is how you fix the 200+ file issue.

We had a bug in one of our GitHub actions

Yeah now its resolved, i just merged the upstream branch and now its fixed!!

Noted for future reference, thanks!

Dockerfile Outdated Show resolved Hide resolved
@palisadoes
Copy link
Contributor

@kb-0311 @vasujain275 PTAL once more

@vasujain275
Copy link

@palisadoes

This pr is not ready to merge yet, @Devesh326 is implementing the different and more efficient method for Dockerfile, once those changes are committed I will review them and let you know

@Devesh326
Copy link
Author

I'm in the process of implementing a multi-stage build, which is a bit new concept for me. I'm currently familiarizing myself with how it works and plan to commit the changes in the next couple of days.

Copy link

github-actions bot commented Feb 6, 2024

This pull request did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please verify it has no conflicts with the develop branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.

@github-actions github-actions bot added the no-pr-activity No pull request activity label Feb 6, 2024
@palisadoes
Copy link
Contributor

Closing due to inactivity

@palisadoes palisadoes closed this Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-pr-activity No pull request activity
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants