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

trance nodejs to java #241

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading