AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Improve docker setup & config

Open Pwuts opened this issue 2 years ago • 16 comments

Background

The current Dockerfile and docker-compose file seem to have unnecessary convolution of configuration and don't contain an optimal configuration out of the box. Also, it is not consistent with the README. This PR attempts to fix that.

This PR either conflicts with or deprecates PRs #1843, #1830 and #1199

Changes

  • Merge apt-get actions into one layer
  • Uncouple app user and python dependencies: install packages globally instead of in /home/appuser
  • Create appuser with UID 1000 to match probable permissions on Linux host
  • Change workdir to /app (as documented in the README) which is a widely used standard, making it easier to work with for new users
  • Improve/fix docker-compose config
    • Use Redis container as memory backend by default
    • Remove unused (and after this PR, redundant) volume mount to /app
    • Mount ./logs/, ./auto_gpt_workspace/ and ./ai_settings.yaml in /app

Documentation

New configuration is consistent with current configuration; no update needed.

Test Plan

No Python code is changed, so testing succeeds if the container builds and runs properly after these changes, which it does.

PR Quality Checklist

  • [x] My pull request is atomic and focuses on a single change. (as far as I understand this checkbox)
  • [x] I have thoroughly tested my changes with multiple different prompts.
  • [x] I have considered potential risks and mitigations for my changes.
  • [x] I have documented my changes clearly and comprehensively.
  • [x] I have not snuck in any "extra" small tweaks changes

Pwuts avatar Apr 16 '23 10:04 Pwuts

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar Apr 17 '23 15:04 github-actions[bot]

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

github-actions[bot] avatar Apr 17 '23 17:04 github-actions[bot]

May be worth adding Chrome for selenium in docker to the compose file

https://hub.docker.com/r/selenium/standalone-chrome/

See here for examples

https://github.com/SeleniumHQ/docker-selenium

ntindle avatar Apr 18 '23 08:04 ntindle

@ntindle currently, Chrome and Firefox along with some other tools are installed in the docker container, see Dockerfile. I'm not convinced this is the way, but also don't have time to dive into it further atm.

Do you think it is worth it to use standalone selenium containers instead of running headless browsers in the auto-gpt container?

Pwuts avatar Apr 18 '23 10:04 Pwuts

IMO using the selenium headless versions with their drivers makes a lot of sense. Otherwise we’d basically need to duplicate the work they’ve done and will continue to do when things change

ntindle avatar Apr 18 '23 13:04 ntindle

Could you make a PR to implement that as soon as this one merges? Would be nice :)

Pwuts avatar Apr 18 '23 15:04 Pwuts

Can do

ntindle avatar Apr 18 '23 18:04 ntindle

@mikekelly care to review?

Pwuts avatar Apr 19 '23 16:04 Pwuts

Quite a bit of this is covering ground from https://github.com/Significant-Gravitas/Auto-GPT/pull/1199 and will conflict with it

mikekelly avatar Apr 19 '23 16:04 mikekelly

I don't see the purpose in creating a PR that "deprecates" a PR that precedes it, why not simply provide feedback on an existing PR that is waiting to be merged?

mikekelly avatar Apr 19 '23 16:04 mikekelly

I don't see the purpose in creating a PR that "deprecates" a PR that precedes it, why not simply provide feedback on an existing PR that is waiting to be merged?

Because I didn't know about your PR, and submitted it before becoming as actively involved as I am now. We're working on combing through all open PRs, but I hadn't gotten to yours yet.

I wish I had searched better, because now I'm facing a mountain of PRs and issues many of which are also duplicate. :')

Pwuts avatar Apr 19 '23 22:04 Pwuts

Closing in favor of #1199

Pwuts avatar Apr 19 '23 22:04 Pwuts

Reopening since #1199 isn't being updated

Pwuts avatar Apr 23 '23 17:04 Pwuts

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

github-actions[bot] avatar Apr 23 '23 17:04 github-actions[bot]

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

github-actions[bot] avatar Apr 23 '23 17:04 github-actions[bot]

Codecov Report

Patch coverage has no change and project coverage change: -7.78 :warning:

Comparison is base (794a164) 49.40% compared to head (01c662e) 41.62%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1843      +/-   ##
==========================================
- Coverage   49.40%   41.62%   -7.78%     
==========================================
  Files          63       64       +1     
  Lines        3004     3022      +18     
  Branches      494      505      +11     
==========================================
- Hits         1484     1258     -226     
- Misses       1400     1699     +299     
+ Partials      120       65      -55     
Impacted Files Coverage Δ
autogpt/commands/web_selenium.py 0.00% <0.00%> (ø)

... and 17 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Apr 23 '23 17:04 codecov[bot]

This combined with a smoke test of the docker container in CI would be top notch

ntindle avatar Apr 23 '23 21:04 ntindle

@ntindle this PR fixes docker; a draft for a smoke test job is in #3059

Pwuts avatar Apr 23 '23 23:04 Pwuts