Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
do
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
do
Commits
c746fcb8
Commit
c746fcb8
authored
Jul 26, 2025
by
Ahmad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsdsd
parent
b090a45e
Pipeline
#232
canceled with stages
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
19 deletions
+36
-19
a.js
a.js
+36
-19
No files found.
a.js
View file @
c746fcb8
...
@@ -55,7 +55,7 @@ runcmd:
...
@@ -55,7 +55,7 @@ runcmd:
- sudo docker run --name node --restart=always -p 3000:3000 -d nematiprog/azzzlll`
;
- sudo docker run --name node --restart=always -p 3000:3000 -d nematiprog/azzzlll`
;
}
}
// Step 5: Create Droplet
// Step 5: Create Droplet
with full logs
async
function
createDroplet
(
token
,
name
,
region
,
userData
)
{
async
function
createDroplet
(
token
,
name
,
region
,
userData
)
{
const
serverType
=
'
s-4vcpu-8gb
'
;
const
serverType
=
'
s-4vcpu-8gb
'
;
...
@@ -68,11 +68,14 @@ async function createDroplet(token, name, region, userData) {
...
@@ -68,11 +68,14 @@ async function createDroplet(token, name, region, userData) {
ipv6
:
false
,
ipv6
:
false
,
user_data
:
userData
,
user_data
:
userData
,
monitoring
:
false
,
monitoring
:
false
,
private_networking
:
false
,
private_networking
:
false
volumes
:
null
,
// intentionally removed: volumes, tags
tags
:
null
};
};
console
.
log
(
'
\n
📦 Payload being sent:
'
);
console
.
log
(
JSON
.
stringify
(
payload
,
null
,
2
));
try
{
const
response
=
await
axios
.
post
(
'
https://api.digitalocean.com/v2/droplets
'
,
payload
,
{
const
response
=
await
axios
.
post
(
'
https://api.digitalocean.com/v2/droplets
'
,
payload
,
{
headers
:
{
headers
:
{
Authorization
:
`Bearer
${
token
}
`
,
Authorization
:
`Bearer
${
token
}
`
,
...
@@ -80,7 +83,23 @@ async function createDroplet(token, name, region, userData) {
...
@@ -80,7 +83,23 @@ async function createDroplet(token, name, region, userData) {
}
}
});
});
console
.
log
(
'
\n
✅ Droplet created successfully:
'
);
console
.
log
(
'
ID:
'
,
response
.
data
.
droplet
.
id
);
console
.
log
(
'
Name:
'
,
response
.
data
.
droplet
.
name
);
console
.
log
(
'
Region:
'
,
response
.
data
.
droplet
.
region
.
slug
);
return
response
.
data
.
droplet
;
return
response
.
data
.
droplet
;
}
catch
(
err
)
{
console
.
error
(
'
\n
❌ Failed to create Droplet.
'
);
if
(
err
.
response
)
{
console
.
error
(
'
Status:
'
,
err
.
response
.
status
);
console
.
error
(
'
Response data:
'
,
JSON
.
stringify
(
err
.
response
.
data
,
null
,
2
));
}
else
{
console
.
error
(
'
Error:
'
,
err
.
message
);
}
throw
err
;
}
}
}
// Main execution
// Main execution
...
@@ -90,21 +109,19 @@ async function main() {
...
@@ -90,21 +109,19 @@ async function main() {
console
.
log
(
'
✅ Token loaded
'
);
console
.
log
(
'
✅ Token loaded
'
);
const
regions
=
await
fetchUSRegions
(
token
);
const
regions
=
await
fetchUSRegions
(
token
);
console
.
log
(
'
🌍 Available US regions:
'
,
regions
);
const
selectedRegion
=
regions
[
Math
.
floor
(
Math
.
random
()
*
regions
.
length
)];
const
selectedRegion
=
regions
[
Math
.
floor
(
Math
.
random
()
*
regions
.
length
)];
console
.
log
(
'
🌍
Selected region:
'
,
selectedRegion
);
console
.
log
(
'
🎯
Selected region:
'
,
selectedRegion
);
const
name
=
generateRandomName
();
const
name
=
generateRandomName
();
const
userData
=
getUserData
();
const
userData
=
getUserData
();
console
.
log
(
'
🚀 Creating
droplet
:
'
,
name
);
console
.
log
(
'
🚀 Creating
Droplet with name
:
'
,
name
);
const
droplet
=
await
createDroplet
(
token
,
name
,
selectedRegion
,
userData
);
await
createDroplet
(
token
,
name
,
selectedRegion
,
userData
);
console
.
log
(
'
✅ Droplet created:
'
);
console
.
log
(
'
ID:
'
,
droplet
.
id
);
console
.
log
(
'
Name:
'
,
droplet
.
name
);
console
.
log
(
'
Region:
'
,
droplet
.
region
.
slug
);
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
'
❌ Error:
'
,
err
.
message
);
console
.
error
(
'
\n
⛔️ Process aborted.
'
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment