Skip to content

Commit cb25e04

Browse files
authored
fix: update to modern Node.js and remove source repos
1 parent b889e24 commit cb25e04

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

gce/startup-script.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,21 @@ service google-fluentd restart &
3232
apt-get update
3333
apt-get install -yq ca-certificates git build-essential supervisor
3434

35+
36+
# Fetch source code
37+
export HOME=/root
38+
git clone https://github.com/GoogleCloudPlatform/nodejs-getting-started.git /opt/app
39+
3540
# Install nodejs
3641
mkdir /opt/nodejs
37-
curl https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.gz | tar xvzf - -C /opt/nodejs --strip-components=1
42+
curl https://nodejs.org/dist/v22.14.0/node-v22.14.0-linux-x64.tar.xz | tar xvfJ - -C /opt/nodejs --strip-components=1
3843
ln -s /opt/nodejs/bin/node /usr/bin/node
3944
ln -s /opt/nodejs/bin/npm /usr/bin/npm
4045

41-
# Get the application source code from the Google Cloud Repository.
42-
# git requires $HOME and it's not set during the startup script.
4346
export HOME=/root
44-
git config --global credential.helper gcloud.sh
45-
git clone https://source.developers.google.com/p/${PROJECTID}/r/${REPOSITORY} /opt/app/new-repo
4647

4748
# Install app dependencies
48-
cd /opt/app/new-repo
49+
cd /opt/app/gce
4950
npm install
5051

5152
# Create a nodeapp user. The application will run as this user.
@@ -55,7 +56,7 @@ chown -R nodeapp:nodeapp /opt/app
5556
# Configure supervisor to run the node app.
5657
cat >/etc/supervisor/conf.d/node-app.conf << EOF
5758
[program:nodeapp]
58-
directory=/opt/app/new-repo
59+
directory=/opt/app/gce
5960
command=npm start
6061
autostart=true
6162
autorestart=true

0 commit comments

Comments
 (0)