Skip to content

Commit

Permalink
Refactor server creation and docker-compose file
Browse files Browse the repository at this point in the history
- Update the server creation prompt to include instructions for creating a Dockerfile
- Modify the docker-compose file to run both the Python server and the new Node server on port 8001
- Add GitHub Copilot suggestions for editing the docker-compose file
- Update the README file to reflect the migration to Node.js
  • Loading branch information
shem8 committed Sep 25, 2024
1 parent 7b2333b commit 286fc54
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 36 deletions.
6 changes: 6 additions & 0 deletions steps/02_create_node_server_prompt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ startFlow:
The server should listen on port 8001, and use nodemon so everychange in the code will reflect in `yarn start`.
With the server please include a simple Docker file to run it
```
- text: |
Then
```
@workspace /new In this new server, create a Dockerfile to run it
```
- text: After running the prompt, make sure to click the "Create Workspace" button to finalize the creation of the new workspace.
- text: Once the project is generated, you might need to go back to the original project using File > Open Folder. Feel free to create the project multiple times until it looks good.
- text: |
The Docker file should look like this:
Expand Down
56 changes: 25 additions & 31 deletions steps/03_run_both_servers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,16 @@ startFlow:
person: lucca
messages:
- text: Next, let's make sure both servers can run together.
- text: Edit the docker-compose file to run the Python server and the new Node
server (Node on port 3001). This should allow us to see if
everything is working in harmony.
- text: "Here's a snippet you can use to add the Node.js service to the `docker-compose.yml` file:"
- text:
We need to edit the docker-compose file to run the Python server and the new Node
server (Node on port 8001). This should allow us to see if everything is working in harmony.
- text: "We can use GitHub Copilot to help us with this task too:"
- text: |
```
node-server:
build:
context: ./node-server
dockerfile: Dockerfile
ports:
- 8001:8001
volumes:
- ./node-server/src:/app/src
@workspace modify the commands to run both servers, the Python app (on port 8000) and the Node app (on port 8001) in the #file:docker-compose.yml
```
- text: If all is well, create a PR with these changes. This was once a nightmare
- text:
If all is well, :instruction[create a PR with these changes.] This was once a nightmare
without Copilot, but look at us now!

githubActions:
Expand All @@ -44,27 +38,27 @@ trigger:
cases:
github_pr_opened:
do:
- actionId: github_pr_comment
params:
person: lucca
message: "On it, I'll review the changes right away."
- actionId: github_pr_comment
params:
person: lucca
message: "On it, I'll review the changes right away."
github_pr_workflow_complete_success:
do:
- actionId: bot_message
params:
person: lucca
messages:
- text: "Nailed it! Excellent job! You can now merge the PR."
- actionId: github_pr_approve
params:
person: lucca
message: "Nailed it! Excellent job! You can now merge the PR."
- actionId: bot_message
params:
person: lucca
messages:
- text: "Nailed it! Excellent job! You can now merge the PR."
- actionId: github_pr_approve
params:
person: lucca
message: "Nailed it! Excellent job! You can now merge the PR."
github_pr_workflow_complete_failure:
do:
- actionId: github_pr_reject
params:
person: lucca
message: "Weird, I tried to run the servers using `docker compose up` but couldn't find anything on port 8000 or 8001, are you sure it's working for you?"
- actionId: github_pr_reject
params:
person: lucca
message: "Weird, I tried to run the servers using `docker compose up` but couldn't find anything on port 8000 or 8001. Are you sure it's working for you?"
github_pr_merged:
do:
- actionId: finish_step
- actionId: finish_step
18 changes: 13 additions & 5 deletions steps/05_update_readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ startFlow:
person: lucca
messages:
- text: We're almost there. Just one last task before we wrap up.
- text: Let's update the README file to reflect our new Node.js server and the
- text:
Let's update the README file to reflect our new Node.js server and the
migration details. Thankfully, Copilot can help with this too.
- text: Make sure to create a new branch for these changes.
- text: Select the text in the README and use [inline
Expand All @@ -26,6 +27,12 @@ trigger:
switch:
key: "${eventType}"
cases:
github_pr_opened:
do:
- actionId: github_pr_comment
params:
person: lucca
message: Awesome! We're going to review your PR right away.
github_pr_workflow_complete_success:
if:
conditions:
Expand Down Expand Up @@ -67,8 +74,9 @@ trigger:
params:
person: lucca
messages:
- text: Congratulations, you've successfully migrated the Python server to Node
using GitHub Copilot! We've upgraded our tech stack and now have
a Node server handling our tasks. Ness is going to be thrilled.
Great job!
- text:
Congratulations, you've successfully migrated the Python server to Node
using GitHub Copilot! We've upgraded our tech stack and now have
a Node server handling our tasks. Ness is going to be thrilled.
Great job!
- actionId: finish_step

0 comments on commit 286fc54

Please sign in to comment.