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

feat: add start commands to devcontainer #3902

Merged
merged 4 commits into from
Apr 28, 2024

Conversation

perzeuss
Copy link
Contributor

@perzeuss perzeuss commented Apr 26, 2024

Description

I work with the dify repo every week and every time I forget the whole command to start the api or the worker. I added these commands because they are intuitive and easy to remember.

This change just introduces shortcut commands to run services, which are made available via alias in the devcontainer:

  • start-api: starts the flask app in debug mode
  • start-worker: starts the worker
  • start-web: starts the nextjs web app in dev mode
  • start-containers: runs docker compose for the middleware compose file to start containers like dbs and sandbox

Type of Change

  • Improvement, including but not limited to code refactoring, performance optimization, and UI/UX improvement

How Has This Been Tested?

  • Open the dify workspace in a devcontainer
  • Run the VS Code script "Rebuild Container"
  • Watch the logs, after the container is created, it should run an npm install for web (as it did before)
  • After the container has been created, it should run pip install for api (as it did before)
  • run start-containers (just type it in the terminal and press enter)
    • this should run docker compose to run required containers for local development
  • run start-api
    • this should start the dify api
  • run start-worker
    • this should start the the dify worker
  • run start-web
    • this should start the dify web
  • open ~/.bashrc you should see 4 commands defined at the end of the file
  • close vs code and reopen it
  • the devcontainer should run pip install but should not create the aliases again
  • open ~/.bashrc again
  • it should still contain only the 4 commands once

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • optional I have made corresponding changes to the documentation
  • optional I have added tests that prove my fix is effective or that my feature works
  • optional New and existing unit tests pass locally with my changes

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. 🔨 feat:tools Tools for agent, function call related stuff. labels Apr 26, 2024
crazywoola
crazywoola previously approved these changes Apr 26, 2024
@perzeuss
Copy link
Contributor Author

I did not add docs because I don't want to confuse people with these commands, but maybe you have an idea where to add a hint that these commands exist?

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 26, 2024
@perzeuss
Copy link
Contributor Author

To not change existing behaviour, I did place cd api && pip install -r requirements.txt in the post start command. However it might make sense to place it in the post create command too. Maybe it was just in postStartCommand field before, because devcontainer config file supports only one command in the postCreateCommand field?

@perzeuss perzeuss changed the title Feat/devcontiner start commands feat: add start commands to devcontainer Apr 26, 2024
@crazywoola
Copy link
Member

I think you need to fix the ci builds. I think it's ok to left the docs blank for this pr.

@crazywoola crazywoola merged commit 0ca4e30 into langgenius:main Apr 28, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 feat:tools Tools for agent, function call related stuff. lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants