Git からコードをコピー
git clone https://github.com/aws-samples/dify-self-hosted-on-aws.git
Python自分用のコードをGITにremore
git remote set-url origin https://github.com/<username>/<new-repository>.git
Pythonpublic codeをupstramとして追加
git remote add upstream https://github.com/aws-samples/dify-self-hosted-on-aws.git
Pythoncheck
git remote -v
Pythonswitch to your branch
git branch master
git checkout master
git push -u origin master
Pythonmerge from public code
git checkout main
git fetch upstream
git merge upstream/main
git checkout master
git merge main
Pythondownload package for ubuntu
sudo snap install docker
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 18
nvm use 18
Pythongit clone https://
npx ci
npx cdk bootstrap
sudo ln -s $(which node) /usr/local/bin/node
sudo ln -s $(which npx) /usr/local/bin/npx
sudo npx cdk deploy --all --require-approval never
Pythonparameterを変更して再Deploy
・api.tsとweb.tsの設定を変更して、上記のDeployコードをもう1回実行すれば再Deployできる。既存のDBは削除されない。
auto scaling
・api.tsを変更
postgres.connections.allowDefaultPortFrom(service);
redis.connections.allowDefaultPortFrom(service);
// add auto scaling setting
const scaling = service.autoScaleTaskCount({
minCapacity: 1, // 闲暇时保持 1 个任务
maxCapacity: 5, // 最多扩展到 5 个任务
});
// add suto scaling policy
scaling.scaleOnCpuUtilization('CpuScaling', {
targetUtilizationPercent: 75, // 当 CPU 使用率达到 75% 时触发扩缩
scaleInCooldown: Duration.seconds(60), // 缩减冷却时间
scaleOutCooldown: Duration.seconds(60), // 扩展冷却时间
});
Python・web.tsを変更
// add auto scaling setting
const scaling = service.autoScaleTaskCount({
minCapacity: 1, // 闲暇时保持 1 个任务
maxCapacity: 5, // 最多扩展到 5 个任务
});
// add suto scaling policy
scaling.scaleOnCpuUtilization('CpuScaling', {
targetUtilizationPercent: 75, // 当 CPU 使用率达到 75% 时触发扩缩
scaleInCooldown: Duration.seconds(60), // 缩减冷却时间
scaleOutCooldown: Duration.seconds(60), // 扩展冷却时间
});
alb.addEcsService('Web', service, port, '/', ['/*']);
Python