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

Convert cron, ceramic and websockets into monorepo apps #4556

Merged
merged 52 commits into from
Sep 9, 2024
Merged

Conversation

mattcasey
Copy link
Member

@mattcasey mattcasey commented Sep 7, 2024

  • enables us to remove some dependencies from the global package.json
  • make clear and standardized boundaries between apps
  • will make future cleanup easier
  • standardize deployment

Tested:

  • Deploy cron to staging
  • Deploy ceramic to staging
  • Deploy websockets to staging

@mattcasey mattcasey changed the title Convert cron and websockets into monorepo apps Convert cron, ceramic and websockets into monorepo apps Sep 7, 2024
@github-actions github-actions bot temporarily deployed to stg-cron-4556-cron-app September 7, 2024 21:11 Destroyed
@github-actions github-actions bot temporarily deployed to stg-cron-4556-cron-app September 8, 2024 00:55 Destroyed
@github-actions github-actions bot temporarily deployed to stg-cron-4556-cron-app September 8, 2024 01:57 Destroyed
@github-actions github-actions bot temporarily deployed to stg-cron-4556-cron-app September 8, 2024 02:20 Destroyed
@github-actions github-actions bot temporarily deployed to stg-webapp-4556-cron-app September 9, 2024 04:10 Destroyed
@github-actions github-actions bot temporarily deployed to stg-websockets-4556-cron-app September 9, 2024 04:17 Destroyed
@github-actions github-actions bot temporarily deployed to stg-webapp-4556-cron-app September 9, 2024 04:50 Destroyed
@github-actions github-actions bot temporarily deployed to stg-webapp-4556-cron-app September 9, 2024 05:38 Destroyed
@github-actions github-actions bot temporarily deployed to stg-websockets-4556-cron-app September 9, 2024 05:47 Destroyed
@github-actions github-actions bot temporarily deployed to stg-webapp-4556-cron-app September 9, 2024 06:01 Destroyed
@github-actions github-actions bot temporarily deployed to stg-websockets-4556-cron-app September 9, 2024 06:13 Destroyed
key: webapp-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.ts', '**/*.tsx', '**/*.gql', '**/*.scss', '!node_modules', '!.next', '!dist', '!apps') }}
restore-keys: |
webapp-${{ hashFiles('**/package-lock.json') }}-

- name: Build
shell: bash
if: steps.restore_build.outputs.cache-hit != 'true'
run: npm run build
Copy link
Member

Choose a reason for hiding this comment

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

Are we not going to save the build cache anymore 😮

Copy link
Member

Choose a reason for hiding this comment

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

Why do we have two separate build actions? Can't we use this one for building the webapp too?

Copy link
Member Author

Choose a reason for hiding this comment

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

the webapp should eventually use build_app but first we should make it a workspace app

@@ -39,13 +43,14 @@ runs:
path: |
./node_modules
./apps/*/node_modules
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we only include the node_modules in the correct app rather than ./apps/*/node_modules?

Copy link
Member Author

Choose a reason for hiding this comment

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

they won't be built so there's nothing to be copied

AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
with:
ecr_registry: cron
Copy link
Member

Choose a reason for hiding this comment

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

I like that we are using a separate registry for cron. I believe previously we were using the webapp one

@@ -138,7 +136,7 @@ jobs:
file_extensions: '**/*.{ts,tsx}'

- name: Run tests
run: npm run test -w apps/scoutgame
Copy link
Member

@Devorein Devorein Sep 9, 2024

Choose a reason for hiding this comment

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

When testing cron we are using the -w apps/cron format. But for scoutgame and I assume other non webapp apps we are using app_name:test format. Shouldn't we stick to a single format?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated


- name: Update Dockerfile
run: |
rm Dockerfile && mv apps/websockets/Dockerfile Dockerfile
Copy link
Member

Choose a reason for hiding this comment

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

Love that now each app have their own ecr registry along with Dockerfile

"typecheck": "../../node_modules/typescript/bin/tsc --project ./tsconfig.json --noEmit"
},
"dependencies": {
"@packages/charmeditor": "^1.0.0"
Copy link
Member

Choose a reason for hiding this comment

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

Nice I didn't know you could do that 😮

prd-sockets:
extends:
service: defaults
ports:
- '80:3000'
command: ['sh', '-c', 'node ./dist/initWebsockets.js']
command: ['sh', '-c', 'node ./apps/websockets/dist/initWebsockets.js']
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we use an npm command like npm run websockets:start:prod or something?

Copy link
Member Author

@mattcasey mattcasey Sep 9, 2024

Choose a reason for hiding this comment

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

we're using node directly in this file. there is a difference when you use npm, i think it changes how the process gets run inside of docker but unfortunately i don't recall the issue we were addressing anymore. so for now it's also to be consistent

@github-actions github-actions bot temporarily deployed to stg-webapp-4556-cron-app September 9, 2024 16:45 Destroyed
@github-actions github-actions bot temporarily deployed to stg-websockets-4556-cron-app September 9, 2024 16:56 Destroyed
@mattcasey mattcasey merged commit 861f7e4 into main Sep 9, 2024
57 checks passed
@mattcasey mattcasey deleted the cron-app branch September 9, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 deploy Deploy main webapp to staging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants