Skip to content

Commit

Permalink
fix: remove controller ag-solo, as it is obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Jul 5, 2020
1 parent b2bb165 commit c698e4c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
fetch:
dest: "{{ data | default(service + '/data') }}/{{ inventory_hostname }}/boot-address.txt"
flat: yes
src: "/home/{{ service }}/controller/ag-cosmos-helper-address"
src: "/home/{{ service }}/.{{ service }}/ag-cosmos-helper-address"
37 changes: 17 additions & 20 deletions packages/deployment/ansible/roles/init-controller/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
- name: Synchronize vat directory
synchronize:
src: "{{ APPDIR }}/lib/ag-solo/vats/"
dest: /usr/src/ag-solo/lib/ag-solo/vats/
dirs: yes
delete: yes
mode: push

- name: "Initialize {{ service }}"
become: yes
become_user: "{{ service }}"
shell:
cmd: "rm -rf controller && ag-solo init controller"
chdir: "/home/{{ service }}"

- name: "Ensure /home/{{ service }}/.ag-pserver/wwwroot/{{ CHAIN_NAME }} exists"
become: yes
become_user: "{{ service }}"
file:
path: "/home/{{ service }}/.ag-pserver/wwwroot/{{ CHAIN_NAME }}"
state: directory

- name: "Clone ag-cosmos-helper-statedir to pserver"
- name: "Create provisioning mnemonic"
delegate_to: localhost
shell:
cmd: "ag-cosmos-helper keys mnemonic | tee provisioning-mnemonic.txt"
register: mnemonic

- name: "Create {{ service }} ag-solo key"
become: yes
become_user: "{{ service }}"
shell:
cmd: "ag-cosmos-helper --home=.{{ service }}/ag-cosmos-helper-statedir --keyring-backend=test keys add ag-solo"
stdin: "{{ mnemonic.stdout_lines }}"

- name: "Create ag-cosmos-helper-address"
become: yes
become_user: "{{ service }}"
delegate_to: "{{ inventory_hostname }}"
synchronize:
src: "/home/{{ service }}/controller/ag-cosmos-helper-statedir/"
dest: "/home/{{ service }}/.ag-pserver/ag-cosmos-helper-statedir/"
shell:
cmd: "ag-cosmos-helper --home=.{{ service }}/ag-cosmos-helper-statedir \
--keyring-backend=test keys show -a ag-solo > .{{ service }}/ag-cosmos-helper-address"
5 changes: 0 additions & 5 deletions packages/deployment/ansible/roles/init-cosmos/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,3 @@
become: yes
become_user: "{{ service }}"
shell: "{{ service }} init --overwrite {{ inventory_hostname }} --chain-id={{ CHAIN_NAME }}"

#- name: "Add coins to {{ service }}"
# become: yes
# become_user: "{{ service }}"
# shell: "{{ service }} add-genesis-account {{ BOOTSTRAP_ADDRESS }} {{ BOOTSTRAP_TOKENS }}"
3 changes: 1 addition & 2 deletions packages/deployment/ansible/roles/start/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: start service
service: "name={{service}} state=started"

service: "name={{service}} state=started enabled=yes"
3 changes: 1 addition & 2 deletions packages/deployment/ansible/roles/stop/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

- name: stop service
service: "name={{service}} state=stopped"

service: "name={{service}} state=stopped enabled=no"
61 changes: 1 addition & 60 deletions packages/deployment/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,17 +407,13 @@ show-config display the client connection parameters
needReMain(['play', 'install-cosmos']),
);

const bootAddress = await needBacktick(
`${shellEscape(progname)} show-bootstrap-address`,
);
await guardFile(`${COSMOS_DIR}/service.stamp`, () =>
needReMain([
'play',
'install',
`-eexecline=${shellEscape(
'/usr/src/cosmic-swingset/bin/ag-chain-cosmos start --pruning=nothing',
)}`,
`-eserviceLines="Environment=BOOT_ADDRESS=${bootAddress}"`,
]),
);
await guardFile(`${COSMOS_DIR}/start.stamp`, () =>
Expand Down Expand Up @@ -460,43 +456,6 @@ show-config display the client connection parameters
needReMain(['play', 'install-controller']),
);

await guardFile(`${CONTROLLER_DIR}/solo-service.stamp`, () =>
needReMain([
'play',
'install',
'-eservice=ag-controller',
'-euser=ag-pserver',
'-echdir=/home/ag-pserver/controller',
`-eexecline="/usr/local/bin/ag-solo start --role=controller"`,
]),
);
await guardFile(`${CONTROLLER_DIR}/solo-start.stamp`, async () => {
await needReMain([
'play',
'start',
'-eservice=ag-controller',
'-euser=ag-pserver',
]);

const svc = 'ag-controller';
await waitForStatus(
'ag-pserver', // user
PROVISIONER_NODE, // host
svc, // service
_retries =>
sleep(
SECONDS_BETWEEN_BLOCKS + 1,
`to check if ${chalk.underline(svc)} has found a block`,
),
(buf, code) => {
if (code) {
return undefined;
}
return buf.match(/: new block on/) ? true : undefined;
},
);
});

// Install any pubkeys from a former instantiation.
await guardFile(`${CONTROLLER_DIR}/pubkeys.stamp`, () =>
needReMain([
Expand Down Expand Up @@ -578,15 +537,6 @@ ${chalk.yellow.bold(`curl ${pserverUrl}/request-code?nickname=MY-NICK`)}
break;
}

case 'show-bootstrap-address': {
await inited();
const bootAddress = await trimReadFile(
`${CONTROLLER_DIR}/data/${PROVISIONER_NODE}/boot-address.txt`,
);
process.stdout.write(bootAddress);
break;
}

case 'ssh': {
const [host, ...sshArgs] = args.slice(1);
if (!host) {
Expand Down Expand Up @@ -618,19 +568,12 @@ ${chalk.yellow.bold(`curl ${pserverUrl}/request-code?nickname=MY-NICK`)}
setSilent(true);
await chdir(SETUP_HOME);
await inited();
const [
chainName,
gci,
peers,
rpcAddrs,
bootstrapAddress,
] = await Promise.all(
const [chainName, gci, peers, rpcAddrs] = await Promise.all(
[
'show-chain-name',
'show-gci',
'show-peers',
'show-rpcaddrs',
'show-bootstrap-address',
].map(subcmd =>
needBacktick([progname, subcmd].map(shellEscape).join(' ')),
),
Expand All @@ -640,7 +583,6 @@ ${chalk.yellow.bold(`curl ${pserverUrl}/request-code?nickname=MY-NICK`)}
gci,
peers: peers.split(','),
rpcAddrs: rpcAddrs.split(','),
bootstrapAddress,
};
process.stdout.write(`${JSON.stringify(obj, undefined, 2)}\n`);
break;
Expand Down Expand Up @@ -959,7 +901,6 @@ ${name}:
? `\
units:
- ag-pserver.service
- ag-controller.service
- ag-chain-cosmos.service
`
: '';
Expand Down

0 comments on commit c698e4c

Please sign in to comment.