Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove controller solo #1260

Merged
merged 2 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The Golang build container.
# TODO This should be split out into the cosmos-connector.
FROM golang:1.13-stretch
FROM golang:1.14-stretch

WORKDIR /usr/src/app
COPY go.mod go.sum ./
Expand Down
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"
44 changes: 25 additions & 19 deletions packages/deployment/ansible/roles/init-controller/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
- 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: "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: "Create provisioning mnemonic"
delegate_to: localhost
shell:
cmd: "ag-cosmos-helper keys mnemonic 2>&1 | tee provisioning-mnemonic.txt"
chdir: "{{ SETUP_HOME }}"
register: mnemonic

- name: "Initialize {{ service }}"
- name: "Delete {{ service }} ag-solo key"
become: yes
become_user: "{{ service }}"
shell:
cmd: "rm -rf controller && ag-solo init controller"
chdir: "/home/{{ service }}"
cmd: "ag-cosmos-helper --home=/home/{{ service }}/.ag-pserver/ag-cosmos-helper-statedir --keyring-backend=test keys delete ag-solo --yes"
removes: "/home/{{ service }}/.ag-pserver/ag-cosmos-helper-statedir"
ignore_errors: yes

- name: "Ensure /home/{{ service }}/.ag-pserver/wwwroot/{{ CHAIN_NAME }} exists"
- name: "Create {{ service }} ag-solo key"
become: yes
become_user: "{{ service }}"
file:
path: "/home/{{ service }}/.ag-pserver/wwwroot/{{ CHAIN_NAME }}"
state: directory
shell:
cmd: "ag-cosmos-helper --home=/home/{{ service }}/.ag-pserver/ag-cosmos-helper-statedir --keyring-backend=test keys add --recover ag-solo"
stdin: "{{ mnemonic.stdout }}"

- name: "Clone ag-cosmos-helper-statedir to pserver"
- 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=/home/{{ service }}/.ag-pserver/ag-cosmos-helper-statedir \
--keyring-backend=test keys show -a ag-solo > /home/{{ service }}/.ag-pserver/ag-cosmos-helper-address"
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 }}"
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@
path: "/home/{{ service }}/.{{ service }}/wwwroot/current"
src: "{{ CHAIN_NAME }}"

- name: "set-gci-ingress for controller"
become_user: "{{ service }}"
become: true
shell:
cmd: "ag-solo set-gci-ingress --chainID={{ CHAIN_NAME }} {{ GCI }} {{ RPC_ADDRS }}"
chdir: "/home/{{ service }}/controller"

- name: "Add {{ NETWORK_NAME }} keys"
synchronize:
src: "{{ SETUP_HOME }}/{{ NETWORK_NAME }}.{{ item }}"
Expand Down
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"
4 changes: 0 additions & 4 deletions packages/deployment/docker/ag-setup-cosmos
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ show-*)
TTY=-i
;;
esac
if test -n "$CONTROLLER_VATS"; then
# Mount the specified controller vats directory.
FLAGS="$FLAGS --volume=`cd "$CONTROLLER_VATS" && pwd`:/usr/src/app/lib/ag-solo/vats"
fi
exec docker run --rm $TTY $FLAGS \
--volume=ag-setup-cosmos-chains:/usr/src/app/chains \
--volume=ag-cosmos-helper-state:/root/.ag-cosmos-helper \
Expand Down
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