Security Upgrades
CVE Fixed: https://nvd.nist.gov/vuln/detail/CVE-2023-48225
Updates
Simple cloud storage API
import cloud from '@lafjs/cloud'
export default async function (ctx: FunctionContext) {
// get bucket
const bucket = cloud.storage.bucket('cloud-bin')
// create file
await bucket.writeFile('test.html', 'hello, laf', { ContentType: 'text/html' })
// read file
const res = await bucket.readFile('test.html')
console.log(await res.Body.transformToString())
// list files
const result = await bucket.listFiles()
console.log(result.Contents)
// delete file
await bucket.deleteFile('test.html')
return { data: 'hi, laf' }
}
Support npm packages caching
The newly added support for node modules caching includes:
- The npm dependencies added by the application are automatically packaged and cached in the cloud-bin bucket. (
node_modules.tar
) - This effectively improves the speed of application startup.
- A cloud-bin bucket is automatically created when the application starts.
Support offline dependencies installation mode
(runtime)
To support offline dependencies installation mode
:
- Add
LF_NODE_MODULES_CACHE=always
environment variable to your application - Upload your
node_modules.tar
to{appid}-cloud-bin
bucket manually
Then the runtime would skip npm install
command, and use node_modules.tar
instead.
Seperate the custom npm packages from built-in's
You can add npm packages which has different version with built-in packages in runtime.
Logging & monitor optimization and some bug fixes
- Upgrade node 18 to node 20 of runtime
- Fix
ObjectId
problem in laf web database management
check the change logs.
What's Changed
- fix(web): fix app monitor longest array by @newfish-cmyk in #1682
- chore(server): update default resource request of runtime pod by @maslow in #1686
- fix(runtime): upgrade node to v20 to fix importModuleDynamic bug by @maslow in #1687
- fix(runtime): object check by @bestlyg in #1684
- fix(server): add field whitelist for validation by @0fatal in #1692
- chore: harmonise lint configuration by @0fatal in #1688
- chore: lint the remaining codes by @0fatal in #1693
- chore: update readme wechat link by @newfish-cmyk in #1700
- feat(server): Add a consolidated multi-pod, multi-container log query by @HUAHUAI23 in #1689
- feat(web): support consolidated multi-pod, multi-container log query by @newfish-cmyk in #1691
- feat(server): support request-limit ratio conf of runtime resource in region by @maslow in #1702
- chore(build): update github workflows to build images for pr events by @maslow in #1705
- chore: fix workflow pr check error by @maslow in #1706
- fix(runtime): fix module.exports error; fix logs error while response.chunkedEncoding is true by @maslow in #1707
- fix(runtime): fix process.env hot reload by @maslow in #1709
- feat(runtime): detach custom dependency, support node_module caching by @skyoct in #1658
- fix(runtime): fix cloud sdk cannot initialize in custom deps module by @maslow in #1711
- feat(runtime): support relative path import of fn by @maslow in #1712
- fix(web): function return shows when not undefined & update current function after edit name by @newfish-cmyk in #1713
- doc: sync features with beta 13 updates by @nightwhite in #1678
- doc: delete expired content by @nightwhite in #1716
- fix(server): fix get_client_ip method, use x-forwarded-fro first by @maslow in #1717
- doc: deprecated the interceptor fn without next method by @maslow in #1720
- chore(runtime): update cloud sdk version in runtime by @maslow in #1721
- fix(web): cannot update database record with ObjectId #1524 by @maslow in #1723
- fix(server): fix runtime logging interface not authenticated by @HUAHUAI23 in #1725
- feat(cli): cli support env by @skyoct in #1718
- fix(server): Fix logging interface error return by @HUAHUAI23 in #1727
- feat(runtime): add cloud.storage api in cloud sdk by @maslow in #1729
- feat(cloud-sdk): add url api to cloud sdk by @maslow in #1732
- fix(web): jsonviewer support to render large data by @newfish-cmyk in #1731
- doc: opt db-ql documents by @yenche123 in #1726
- fix(services): Changing exporter penalty rules by @HUAHUAI23 in #1733
- refactor(cloud-sdk): refacct readFile returns in cloud-sdk by @maslow in #1734
- refactor(cloud-sdk): refactor listFiles paramsof cloud sdk by @maslow in #1735
- refactor(db-proxy): refactor accessor constructor in database-proxy, add objectid type as global in runtime; by @maslow in #1738
- feat(runtime): support LF_NODE_MODULES_CACHE to control if offline deps installation by @maslow in #1743
- fix(cli): fix cli env command description by @skyoct in #1742
- chore(web): fix styles & optimize tips & add running cancel by @newfish-cmyk in #1740
- chore(ci): add digest for images of the pr by @0fatal in #1736
New Contributors
Full Changelog: v1.0.0-beta.13...v1.0.0-beta.14
Migration Guides
Update laf-server & laf-web images:
# upgrade laf SERVER
kubectl set image deployments/laf-server -n laf-system \
laf-server=docker.io/lafyun/laf-server:1.0.0-beta.14
# upgrade laf WEB
kubectl set image deployments/laf-web -n laf-system \
laf-web=docker.io/lafyun/laf-web:1.0.0-beta.14
Update sys_db.Runtime
to upgrade runtime images in MongoDb
use sys_db
// runtime version
const version = "1.0.0-beta.14"
const main_image = `docker.io/lafyun/runtime-node:${version}`
const init_image = `docker.io/lafyun/runtime-node:${version}`
db.Runtime.updateOne({ latest: true }, {
$set: {
version: version,
image: {
main: main_image,
init: init_image
}
}
})
db.Runtime.find().pretty()