Skip to content

Commit 0b22134

Browse files
committed
Add a bootstrap phase to our create server script
There is some more stuff in a PuPHPet VagrantFile that i've skipped, part is ssh keygen stuff that doesn't make sense since keys need to be done ahead of time. The rest is the files stuff in the PuPHPet dir, I should likely copy those parts at some point.
1 parent 46b0c31 commit 0b22134

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
puphpet
22
puphpet-*
3+
puphpet.tar
34
VagrantFile
45
html
56
.vagrant

DigitalOcean/create-server.php

+18
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@
120120
{
121121
foreach($droplet->networks as $network)
122122
{
123+
if ($network->type == "public")
124+
$serverIp = $network->ipAddress;
123125
echo " $network->type: $network->ipAddress\n";
124126
}
125127
}
@@ -130,3 +132,19 @@
130132
echo "region: {$droplet->region->name} - {$droplet->region->slug}\n";
131133
echo "image: {$droplet->image->name} - {$droplet->image->slug}\n";
132134
echo "size: {$droplet->size->slug} cpu({$droplet->size->vcpus}) memory({$droplet->size->memory}) disk({$droplet->size->disk})\n";
135+
136+
if (!empty($argv[1]))
137+
{
138+
$baseDir = realpath(__DIR__.'/../');
139+
140+
// if we are in a real shell we could do this in one pipe, or maybe use rsync
141+
// but lets use a temp file instead so we work in the shell that github ships
142+
echo "Bootstrapping server\n";
143+
passthru("scp setup.sh root@$serverIp:");
144+
145+
chdir($baseDir);
146+
// passthru("tar cf puphpet.tar puphpet");
147+
// passthru("scp puphpet.tar root@$serverIp:/tmp/puphpet.tar");
148+
passthru("ssh root@$serverIp 'sh -c /root/setup.sh'");
149+
150+
}

DigitalOcean/setup.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
#tar xvf /tmp/puphpet.tar
3+
cd /root/puphpet
4+
./shell/initial-setup.sh /root/puphpet
5+
./shell/install-ruby.sh /root/puphpet
6+
./shell/install-puppet.sh /root/puphpet

0 commit comments

Comments
 (0)