Skip to content

Commit

Permalink
Merge pull request #241 from xiao201208/fix/tech_solu_103
Browse files Browse the repository at this point in the history
trance nodejs to java
  • Loading branch information
xiao201208 authored May 10, 2024
2 parents bd71a28 + 567720a commit 5b531ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Parameters:
en: Instance Type
zh-cn: 实例规格
Description:
zh-cn: 本方案会创建一个抢占式实例,并且自动部署node.js服务
zh-cn: 本方案会创建一个抢占式实例,并且自动部署java服务
en: >-
This solution will create a spot instance and automatically deploy a
node.js service.
java service.
Default: ecs.c7.large
InstancePassword:
NoEcho: true
Expand Down Expand Up @@ -139,7 +139,7 @@ Resources:
SpotStrategy: SpotAsPriceGo
Password:
Ref: InstancePassword
InstallNodeJs:
InstallJava:
Type: 'ALIYUN::ECS::RunCommand'
Properties:
InstanceIds:
Expand All @@ -157,7 +157,7 @@ Resources:
# 0 - success
# 1 - unsupported system
# 2 - network not available
# 3 - failed install nodejs
# 3 - failed install java

# 环境变量配置
export PATH=/usr/local/bin:$PATH
Expand Down Expand Up @@ -201,15 +201,9 @@ Resources:
fi
}

function install_nodejs() {
log_info "install nodejs"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> ~/.bash_profile
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bash_profile
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> ~/.bash_profile
source ~/.bash_profile
nvm install 20
node -v && npm -v
function install_java() {
log_info "install java"
yum upgrade & yum install java-1.8.0-openjdk-devel -y
}

log_info "System Information:"
Expand All @@ -219,10 +213,9 @@ Resources:
echo ""

check_network_available
if ! debug_exec install_nodejs; then
log_fatal 3 "install nodejs failed"
if ! debug_exec install_java; then
log_fatal 3 "install java failed"
fi

DomainRecord:
Type: 'ALIYUN::DNS::DomainRecord'
Condition: DnsRecord
Expand Down

0 comments on commit 5b531ba

Please sign in to comment.