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

๐Ÿ‘ท build: add docker image for server database #3387

Merged
merged 8 commits into from
Aug 3, 2024

Conversation

arvinxx
Copy link
Contributor

@arvinxx arvinxx commented Aug 2, 2024

๐Ÿ’ป ๅ˜ๆ›ด็ฑปๅž‹ | Change Type

  • โœจ feat
  • ๐Ÿ› fix
  • โ™ป๏ธ refactor
  • ๐Ÿ’„ style
  • ๐Ÿ”จ chore
  • ๐Ÿ‘ท build
  • โšก๏ธ perf
  • ๐Ÿ“ docs

๐Ÿ”€ ๅ˜ๆ›ด่ฏดๆ˜Ž | Description of Change

  • ๅขžๅŠ ๆœๅŠก็ซฏ Database ็‰ˆ็š„ Docker ้•œๅƒ๏ผŒ็ฎ€ๅŒ–็”จๆˆทๆž„ๅปบ้•œๅƒ้ƒจ็ฝฒ

๐Ÿ“ ่กฅๅ……ไฟกๆฏ | Additional Information

็”ฑไบŽๆ–ฐๅขžไบ†ไธ€ไธช docker ้•œๅƒ๏ผŒไผš break ไธ€ๆฌก vercel ็”จๆˆท็š„ๅŒๆญฅ workflow

ๆœๅŠก็ซฏ DB Docker ้ƒจ็ฝฒๆ–‡ๆกฃ้œ€่ฆๅฏน็Žฐๆœ‰ๆ–‡ๆกฃ็ป“ๆž„ๅšไธ€ๆฌกๅคง็š„่ฐƒๆ•ด๏ผŒๅ…ˆๆ”พไธคไธช้…็ฝฎ็คบไพ‹ใ€‚

้’ˆๅฏน็†Ÿๆ‚‰็Žฏๅขƒๅ˜้‡็š„ๅฐไผ™ไผดๅฏไปฅๆๅ‰ๅฐ้ฒœ่ตทๆฅ

  1. ็›ดๆŽฅๅœจ mac/windows ๆœฌๅœฐๅฏๅŠจ

ๅ‡่ฎพๆœฌๅœฐๆœ‰ไธ€ไธช 5432 ็ซฏๅฃๅฏ็”จ๏ผŒ่ดฆๅทไธบ postgres ๏ผŒๅฏ†็ ๆ˜ฏ mysecretpassword ็š„ pg ๅฎžไพ‹ใ€‚

docker run -it -d -p 3210:3210 \
-e DATABASE_URL=postgres://postgres:[email protected]:5432/postgres \
-e KEY_VAULTS_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk= \
-e NEXT_AUTH_SECRET=3904039cd41ea1bdf6c93db0db96e250 \
-e NEXT_AUTH_SSO_PROVIDERS=auth0 \
-e AUTH0_CLIENT_ID=xxxxxx \
-e AUTH0_CLIENT_SECRET=cSX_xxxxx \
-e AUTH0_ISSUER=https://lobe-chat-demo.us.auth0.com \
-e NEXTAUTH_URL=http://localhost:3210/api/auth \
-e S3_ACCESS_KEY_ID=xxxxxxxxxx \
-e S3_SECRET_ACCESS_KEY=xxxxxxxxxx \
-e S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com \
-e S3_BUCKET=lobechat \
-e NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com \
lobehub/lobe-chat-database
  1. ๅœจๆœๅŠก็ซฏๅฏๅŠจ

ๅ‡่ฎพๆœๅŠก็ซฏ docker ไธญๅฏๅŠจไบ†ๅไธบ my-postgres ็š„ pg ๅฎžไพ‹๏ผŒๅนถไธ”ๅŠ ๅ…ฅไบ† network ๅไธบ pg-db ็š„็ฝ‘็ปœ

docker run -it -d -p 3210:3210 \
--network pg-db \
-e DATABASE_URL=postgres://postgres:mysecretpassword@my-postgres:5432/postgres \
-e KEY_VAULTS_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk= \
-e NEXT_AUTH_SECRET=3904039cd41ea1bdf6c93db0db96e250 \
-e NEXT_AUTH_SSO_PROVIDERS=auth0 \
-e AUTH0_CLIENT_ID=xxxxxx \
-e AUTH0_CLIENT_SECRET=cSX_xxxxx \
-e AUTH0_ISSUER=https://lobe-chat-demo.us.auth0.com \
-e NEXTAUTH_URL=https://your-prod-domain.com/api/auth \
-e S3_ACCESS_KEY_ID=xxxxxxxxxx \
-e S3_SECRET_ACCESS_KEY=xxxxxxxxxx \
-e S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com \
-e S3_BUCKET=lobechat \
-e NEXT_PUBLIC_S3_DOMAIN=https://s3-for-lobechat.your-domain.com \
lobehub/lobe-chat-database

Copy link

vercel bot commented Aug 2, 2024

The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Comments Updated (UTC)
lobe-chat-database โœ… Ready (Inspect) Visit Preview ๐Ÿ’ฌ Add feedback Aug 3, 2024 8:14am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
lobe-chat-preview โฌœ๏ธ Ignored (Inspect) Visit Preview Aug 3, 2024 8:14am

@lobehubbot
Copy link
Member

๐Ÿ‘ @arvinxx

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
้žๅธธๆ„Ÿ่ฐขๆ‚จๆๅ‡บๆ‹‰ๅ–่ฏทๆฑ‚ๅนถไธบๆˆ‘ไปฌ็š„็คพๅŒบๅšๅ‡บ่ดก็Œฎ๏ผŒ่ฏท็กฎไฟๆ‚จๅทฒ็ป้ตๅพชไบ†ๆˆ‘ไปฌ็š„่ดก็ŒฎๆŒ‡ๅ—๏ผŒๆˆ‘ไปฌไผšๅฐฝๅฟซๅฎกๆŸฅๅฎƒใ€‚
ๅฆ‚ๆžœๆ‚จ้‡ๅˆฐไปปไฝ•้—ฎ้ข˜๏ผŒ่ฏท้šๆ—ถไธŽๆˆ‘ไปฌ่”็ณปใ€‚

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


The latest updates on your projects. Learn more about Vercel for Git โ†—๏ธŽ

Name Status Preview Updated (UTC)
lobe-chat-preview โœ… Ready (Inspect) Visit Preview Aug 2, 2024 6:01pm

Copy link

codecov bot commented Aug 2, 2024

Codecov Report

All modified and coverable lines are covered by tests โœ…

Project coverage is 94.21%. Comparing base (56ffa22) to head (cdfdf37).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3387    +/-   ##
========================================
  Coverage   94.21%   94.21%            
========================================
  Files         403      403            
  Lines       25651    25647     -4     
  Branches     2752     1882   -870     
========================================
- Hits        24166    24164     -2     
+ Misses       1485     1483     -2     
Flag Coverage ฮ”
app 94.21% <100.00%> (+<0.01%) โฌ†๏ธ
server 70.66% <100.00%> (+<0.01%) โฌ†๏ธ

Flags with carried forward coverage won't be shown. Click here to find out more.

โ˜” View full report in Codecov by Sentry.
๐Ÿ“ข Have feedback on the report? Share it here.

@arvinxx arvinxx merged commit 72306f5 into main Aug 3, 2024
11 checks passed
@arvinxx arvinxx deleted the build/database-docker branch August 3, 2024 08:18
@lobehubbot
Copy link
Member

โค๏ธ Great PR @arvinxx โค๏ธ

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.
้กน็›ฎ็š„ๆˆ้•ฟ็ฆปไธๅผ€็”จๆˆทๅ้ฆˆๅ’Œ่ดก็Œฎ๏ผŒๆ„Ÿ่ฐขๆ‚จ็š„่ดก็Œฎ! ๅฆ‚ๆžœๆ‚จๅฏน LobeHub ๅผ€ๅ‘่€…็คพๅŒบๆ„Ÿๅ…ด่ถฃ๏ผŒ่ฏทๅŠ ๅ…ฅๆˆ‘ไปฌ็š„ discord๏ผŒ็„ถๅŽ็งไฟก @arvinxx ๆˆ– @canisminor1990ใ€‚ไป–ไปฌไผš้‚€่ฏทๆ‚จๅŠ ๅ…ฅๆˆ‘ไปฌ็š„็งๅฏ†ๅผ€ๅ‘่€…้ข‘้“ใ€‚ๆˆ‘ไปฌๅฐ†ไผš่ฎจ่ฎบๅ…ณไบŽ Lobe Chat ็š„ๅผ€ๅ‘๏ผŒๅˆ†ไบซๅ’Œ่ฎจ่ฎบๅ…จ็ƒ่Œƒๅ›ดๅ†…็š„ AI ๆถˆๆฏใ€‚

@Matinal111
Copy link

lobehub/lobe-chat-database:test๏ผŒ้™„ไธŠtestๆ ‡็ญพๆ‰่ƒฝๆ‹‰ๅ–้•œๅƒ

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


lobehub/lobe-chat-database:test, attach the test tag to pull the image

@arvinxx
Copy link
Contributor Author

arvinxx commented Aug 3, 2024

@Matinal111 latest ็‰ˆ่ฟ˜ๆฒกๅ‘๏ผŒ็ญ‰ไธ€ไผšๅ‘ไธชๅฐ็‰ˆๆœฌๅ‡บๆฅ

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


@Matinal111 The latest version has not been released yet, a small version will be released later.

@Matinal111
Copy link

@Matinal111ๆœ€ๆ–ฐ็‰ˆๆœฌ่ฟ˜ๆฒกๅ‘๏ผŒ็ญ‰ไธ€ไผšๅ‘ไธชๅฐ็‰ˆๆœฌๅ‡บๆฅ

test็‰ˆๅทฒไธŠๆ‰‹๏ผŒ็™ปๅฝ•ๆญฃๅธธ

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


@Matinal111 The latest version has not been released yet, a smaller version will be released later.

The test version has been started and the login is normal.

@lobehubbot
Copy link
Member

๐ŸŽ‰ This PR is included in version 1.8.1 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

@arvinxx
Copy link
Contributor Author

arvinxx commented Aug 3, 2024

@Matinal111 ๅ“ๅบ”้€Ÿๅบฆๅฆ‚ไฝ•๏ผŸ

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


@Matinal111 How responsive is it?

@Matinal111
Copy link

@Matinal111 ๅ“ๅบ”้€Ÿๅบฆๅฆ‚ไฝ•๏ผŸ

ๅฏไปฅ๏ผŒ้™คไบ†ๅˆš็™ป้™†ๆ—ถไผšๅก้กฟไธ‹๏ผŒๅŽ็ปญ้ƒฝๅพˆๆต็•…

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


@Matinal111 How is the response speed?

Yes, except for the lag when you first log in, the follow-up is smooth.

@darkelfzdy
Copy link

ๆฒกๅคชๆ˜Ž็™ฝ่ฟ™ไธช็ป“ๆž„๏ผŒ้ƒฝๅทฒ็ปdockerๆœฌๅœฐๅŒ–ไบ†๏ผŒ่ฟ˜้œ€่ฆs3๏ผŸ

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


I donโ€™t quite understand this structure. Docker has been localized. Do I still need s3?

@arvinxx
Copy link
Contributor Author

arvinxx commented Aug 3, 2024

@darkelfzdy s3 ๆ˜ฏ็”จๆฅๅญ˜ๆ–‡ไปถ็š„ใ€‚ไฝ ๅฏไปฅๆขๆˆๅ…ถไป–ๆœฌๅœฐ็š„ๆ–‡ไปถๅญ˜ๅ‚จ

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. ๐Ÿ‘ฏ๐Ÿ‘ญ๐Ÿป๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘๐Ÿ‘ซ๐Ÿง‘๐Ÿฟโ€๐Ÿคโ€๐Ÿง‘๐Ÿป๐Ÿ‘ฉ๐Ÿพโ€๐Ÿคโ€๐Ÿ‘จ๐Ÿฟ๐Ÿ‘ฌ๐Ÿฟ


@darkelfzdy s3 is used to store files. You can change it to other local file storage.

qinyuhang pushed a commit to qinyuhang/lobe-chat that referenced this pull request Aug 5, 2024
* ๐Ÿ‘ท build: add docker database image

* ๐Ÿ’š ci: add database image workflow

* fix docker build

* Update PULL_REQUEST_TEMPLATE.md

* ๐ŸŽจ chore: improve migration script

* ๐Ÿ› fix: throws error in nextauth db adapter (lobehub#3390)

* ๐Ÿ‘ท chore: update action

---------

Co-authored-by: cy948 <[email protected]>
davidreis97 pushed a commit to davidreis97/lobe-chat that referenced this pull request Aug 7, 2024
* ๐Ÿ‘ท build: add docker database image

* ๐Ÿ’š ci: add database image workflow

* fix docker build

* Update PULL_REQUEST_TEMPLATE.md

* ๐ŸŽจ chore: improve migration script

* ๐Ÿ› fix: throws error in nextauth db adapter (lobehub#3390)

* ๐Ÿ‘ท chore: update action

---------

Co-authored-by: cy948 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants