persist infrastructure and plattform
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
config:
|
||||
avicenna-infrastructure:hcloudToken:
|
||||
secure: AAABAIi5Eso+isiy15TT2VC45yG73iLmuwhaDFi8180Gm0Vd9zdVSmh9HRPXQMlSU+NxzQDqOx5qbgqvMDiyew4AHkEgUJvJUA0cV0Mn1B4WeGlhzzYmbgdHeVobgv8i
|
||||
+39
-34
@@ -22,8 +22,13 @@ const sshKey = new tls.PrivateKey('sshKey', {
|
||||
|
||||
export const privateKey = sshKey.privateKeyOpenssh;
|
||||
|
||||
const env = pulumi.getStack();
|
||||
|
||||
if (!fs.existsSync(`./.local/${env}`)) {
|
||||
fs.mkdirSync(`./.local/${env}`);
|
||||
}
|
||||
privateKey.apply((privKey) =>
|
||||
fs.writeFileSync('././local/private_key', privKey, { mode: '0600' })
|
||||
fs.writeFileSync(`./.local/${env}/private_key`, privKey, { mode: '0600' })
|
||||
);
|
||||
|
||||
const hetznerSshKey = new hcloud.SshKey(
|
||||
@@ -163,40 +168,40 @@ async function createSwarmCluster(nodeCount: number) {
|
||||
return vm;
|
||||
}
|
||||
|
||||
const geniusceo = digitalocean.Domain.get(
|
||||
'geniusceo',
|
||||
'genius.ceo',
|
||||
);
|
||||
const doToken = config.getSecret('doToken');
|
||||
if (doToken) {
|
||||
const geniusceo = digitalocean.Domain.get('geniusceo', 'genius.ceo');
|
||||
|
||||
const wwwSubDomain = geniusceo.id.apply(
|
||||
(id) =>
|
||||
new digitalocean.DnsRecord('www', {
|
||||
domain: id,
|
||||
type: 'A',
|
||||
value: swarmMaster.ipv4Address,
|
||||
name: 'www',
|
||||
})
|
||||
);
|
||||
const wwwSubDomain = geniusceo.id.apply(
|
||||
(id) =>
|
||||
new digitalocean.DnsRecord('www', {
|
||||
domain: id,
|
||||
type: 'A',
|
||||
value: swarmMaster.ipv4Address,
|
||||
name: 'www',
|
||||
})
|
||||
);
|
||||
|
||||
const noSubDomain = geniusceo.id.apply(
|
||||
(id) =>
|
||||
new digitalocean.DnsRecord('noSub', {
|
||||
domain: id,
|
||||
type: 'A',
|
||||
value: swarmMaster.ipv4Address,
|
||||
name: '@',
|
||||
})
|
||||
);
|
||||
const noSubDomain = geniusceo.id.apply(
|
||||
(id) =>
|
||||
new digitalocean.DnsRecord('noSub', {
|
||||
domain: id,
|
||||
type: 'A',
|
||||
value: swarmMaster.ipv4Address,
|
||||
name: '@',
|
||||
})
|
||||
);
|
||||
|
||||
const wildcardSubDomain = geniusceo.id.apply(
|
||||
(id) =>
|
||||
new digitalocean.DnsRecord('*', {
|
||||
domain: id,
|
||||
type: 'A',
|
||||
value: swarmMaster.ipv4Address,
|
||||
name: '*',
|
||||
})
|
||||
);
|
||||
const wildcardSubDomain = geniusceo.id.apply(
|
||||
(id) =>
|
||||
new digitalocean.DnsRecord('*', {
|
||||
domain: id,
|
||||
type: 'A',
|
||||
value: swarmMaster.ipv4Address,
|
||||
name: '*',
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
const installAnsibleDepsCmd = new command.remote.Command(
|
||||
'installAnsibleDepsCmd',
|
||||
@@ -213,7 +218,7 @@ const installAnsibleDepsCmd = new command.remote.Command(
|
||||
const deployDockerStackCmd = new command.local.Command(
|
||||
'deployDockerStackCmd',
|
||||
{
|
||||
create: pulumi.interpolate`ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u root -i "${swarmMaster.ipv4Address}," --private-key ./private_key ansible/playbook.yml`,
|
||||
create: pulumi.interpolate`ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -u root -i "${swarmMaster.ipv4Address}," --private-key ./.local/${env}/private_key ansible/playbook.yml`,
|
||||
},
|
||||
{
|
||||
dependsOn: [installAnsibleDepsCmd],
|
||||
@@ -233,4 +238,4 @@ const restartCmd = new command.remote.Command(
|
||||
{
|
||||
dependsOn: [deployDockerStackCmd],
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user