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

I322 gh actions #331

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Conversation

pushyamig
Copy link
Contributor

@pushyamig pushyamig commented Nov 8, 2024

Fixes #322

I have built this on my forked repo.
https://github.com/pushyamig/canvas-app-explorer/actions/runs/12122482979/job/33795762679

Now with this change, we opted for only one docker file and supervisor will be using in prod as well. Only Backend will be started in Prod and not Frontend

@pushyamig pushyamig requested review from jonespm and zqian November 8, 2024 18:45
jobs:
build:
# to test a feature, change the repo name to your github id
if: github.repository_owner == 'tl-its-umich-edu' || github.event_name == 'workflow_dispatch'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am pointing to TL repo only since I did not want to forked repo for a build ( this step is common to all TL Repos)

workflow_dispatch will let us do a manual trigger of the build

dockerfiles/Dockerfile.prod Outdated Show resolved Hide resolved
@@ -1,6 +1,6 @@
# node-build stage
Copy link
Contributor Author

@pushyamig pushyamig Nov 8, 2024

Choose a reason for hiding this comment

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

I removed all the openshift references, since we will be switching to doing builds on Github and not from Openshift any more.

So this mean we have some workflow change to existing process on Openshift Deployment. I am guessing should be minor as the process has been established from other TL project in Openshift

Copy link
Member

@jonespm jonespm Nov 8, 2024

Choose a reason for hiding this comment

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

I think with this process the Dockerfile.openshift/Dockerfile.prod can just be deleted. That was only if this needed to build on Openshift and we'll just switch that to pull from GH.

We can also delete docker-compose-openshift-test.yml which was used to test this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jonespm , I don't think we can delete openshift/Dockerfile.prod since

Dockerfile: CMD ["/usr/bin/supervisord", "-c", "/code/deploy/supervisor_docker.conf"]
Dockerfile.Prod: CMD ["/code/start_backend.sh"]

RUN npm run build:frontend, This command is missing from Dockerfile I don't see JS Bundle is made with Dockerfile . Here is the output from that build https://github.com/pushyamig/canvas-app-explorer/actions/runs/11746094247/job/32725028305

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jonespm Let me know if you have any further concerns on this change. I will work to resolve it.

Copy link
Member

Choose a reason for hiding this comment

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

I see what you mean. It would be fine running it through supervisord in prod too (possibly better) but we don't need to run both the frontend and backend processes since the frontend is static.

So we'd need a to set it up so it only starts the backend but starts the frontend on development.

I think the way this would be configured would be to just have the backend configured with autostart=true and the frontend be autostart=false. Then either through docker-compose or the startup script also start the frontend.

Copy link
Contributor Author

@pushyamig pushyamig Nov 14, 2024

Choose a reason for hiding this comment

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

So add environmental variable in docker compose and allow it to run FE and BE during dev not in the prod?

@@ -0,0 +1,65 @@
name: CAE Build/Release
Copy link
Member

Choose a reason for hiding this comment

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

since we are rebranding the CAE tool to IPT, can we rename this file to ipt.yml? and replace all occurrence of cae in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do that if that's the direction we are moving toward with naming this app and project

Copy link
Contributor Author

@pushyamig pushyamig Nov 8, 2024

Choose a reason for hiding this comment

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

I renamed CAE reference to IPT

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should make this a more generic like build_release.yml so we can avoid possible name changes? And update the name on the first line.

- main
- '[0-9][0-9][0-9][0-9].[0-9][0-9].*' # 2021.01.x
tags:
- '[0-9][0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]' # 2021.01.01
Copy link
Member

Choose a reason for hiding this comment

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

We actually don't need this to build when pushing to a numbered tag since we'll be triggering that manually.

.github/workflows/ipt.yml Outdated Show resolved Hide resolved
@jonespm
Copy link
Member

jonespm commented Nov 14, 2024

We may want to wait on merging this for at least a week or so as I have a few more thoughts on this. It's not required to test or even release to prod using the current workflow and doing it will involve some more changes to Openshift.

  • I'd probably delete the Dockerfile.prod and make the Dockerfile run supervisor.
  • Supervisor should only start the backend by default
  • The frontend should be started either by docker-compose.yml (which is used locally) or by start_backend.sh if it running locally. Some variable would have to be passed, possibly from docker-compose.yml to indicate that it's running locally
  • Then we'd need to make changes to the Openshift to pull Imagestreams from this new image.

@pushyamig
Copy link
Contributor Author

We may want to wait on merging this for at least a week or so as I have a few more thoughts on this.

Ok, I will think about your ideas and how to implement it. The Supervisor stuff is new to me so it will be good learning

@jonespm
Copy link
Member

jonespm commented Nov 14, 2024

Sure! It looks like the website might be down. It basically allows you to start up multiple processes in a single container/pod rather than running multiple.

When developing this app, I thought this would be more efficient for running in prod due to cost, but isn't a huge advantage locally. And even in prod there's only one process running. Though other advantages are it can attempt to restart the app quicker if it fails and you have better configuration of where the logs are going.

@jonespm jonespm marked this pull request as draft November 14, 2024 14:58
@pushyamig pushyamig force-pushed the i322_gh_actions branch 3 times, most recently from 9b0ea73 to 4574378 Compare December 2, 2024 15:24
@pushyamig
Copy link
Contributor Author

pushyamig commented Dec 2, 2024

This PR is functional but need to test the Build created from GH action on Openshift, since there is a slight change in how the app starts since now supervisor is used to launch.

I will keep the PR in Draft mode, once we pass the Prod release phase I will have it tested and open the PR

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.

Add Github Action workflow for Docker Build
3 participants