Skip to content

Commit 7b512c0

Browse files
committed
remove docker-compose.env concept
1 parent 8dd2a91 commit 7b512c0

File tree

5 files changed

+16
-33
lines changed

5 files changed

+16
-33
lines changed

deployment-generator/scripts/docker-down.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ if [[ -z $1 ]]; then
1212
exit
1313
fi
1414

15-
docker compose --env-file ../docker-compose.env --profile $1 down
15+
docker compose --profile $1 down
1616

deployment-generator/scripts/docker-up.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ if [[ -z $1 ]]; then
1111
exit
1212
fi
1313

14-
docker compose --env-file ../docker-compose.env --profile $1 pull
15-
docker compose --env-file ../docker-compose.env --profile $1 up -d
14+
docker compose --env-file --profile $1 pull
15+
docker compose --env-file --profile $1 up -d
1616

deployment-generator/src/gen.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ for (let i = 1; i <= config.num_subnet; i++) {
6868
deployconf = gen_env.genContractDeployEnv();
6969

7070
const compose_content = yaml.dump(doc, {});
71-
const compose_conf = gen_compose.genComposeEnv();
7271

7372
// deployment commands list
7473
const commands = gen_other.genCommands();
@@ -142,13 +141,6 @@ function writeGenerated(output_dir) {
142141
);
143142
}
144143

145-
fs.writeFileSync(`${output_dir}/docker-compose.env`, compose_conf, (err) => {
146-
if (err) {
147-
console.error(err);
148-
exit();
149-
}
150-
});
151-
152144
deployment_json = JSON.stringify(deployment_json, null, 2);
153145
fs.writeFileSync(
154146
`${output_dir}/deployment.config.json`,

deployment-generator/src/gen_compose.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ module.exports = {
66
genSubnetNodes,
77
genBootNode,
88
genServices,
9-
genComposeEnv,
109
injectNetworkConfig,
1110
};
1211

@@ -15,7 +14,7 @@ function genSubnetNodes(machine_id, num, start_num = 1) {
1514
for (let i = start_num; i < start_num + num; i++) {
1615
const node_name = "subnet" + i.toString();
1716
const volume = "./xdcchain" + i.toString() + ":/work/xdcchain";
18-
const config_path = "${SUBNET_CONFIG_PATH}/subnet" + i.toString() + ".env";
17+
const config_path = "${PWD}/subnet" + i.toString() + ".env";
1918
const compose_profile = "machine" + machine_id.toString();
2019
const port = 20302 + i;
2120
const rpcport = 8544 + i;
@@ -24,7 +23,7 @@ function genSubnetNodes(machine_id, num, start_num = 1) {
2423
image: `xinfinorg/xdcsubnets:${config.version.subnet}`,
2524
volumes: [
2625
volume,
27-
"${SUBNET_CONFIG_PATH}/genesis.json:/work/genesis.json",
26+
"${PWD}/genesis.json:/work/genesis.json",
2827
],
2928
restart: "always",
3029
network_mode: "host",
@@ -44,7 +43,7 @@ function genSubnetNodes(machine_id, num, start_num = 1) {
4443
}
4544

4645
function genBootNode(machine_id) {
47-
let config_path = "${SUBNET_CONFIG_PATH}/common.env";
46+
let config_path = "${PWD}/common.env";
4847
const machine = "machine" + machine_id.toString();
4948
const bootnode = {
5049
image: `xinfinorg/xdcsubnets:${config.version.bootnode}`,
@@ -60,7 +59,7 @@ function genBootNode(machine_id) {
6059
}
6160

6261
function genServices(machine_id) {
63-
const config_path = "${SUBNET_CONFIG_PATH}/common.env";
62+
const config_path = "${PWD}/common.env";
6463
const machine = "services";
6564
const frontend = {
6665
image: `xinfinorg/subnet-frontend:${config.version.frontend}`,
@@ -99,12 +98,6 @@ function genServices(machine_id) {
9998
return services;
10099
}
101100

102-
function genComposeEnv() {
103-
// conf_path = `SUBNET_CONFIG_PATH=${config.deployment_path}/generated/`;
104-
conf_path = `SUBNET_CONFIG_PATH=$PWD`
105-
return conf_path;
106-
}
107-
108101
function injectNetworkConfig(compose_object) {
109102
// networks:
110103
// docker_net:

deployment-generator/src/gen_other.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ function genDeploymentJson(keys) {
7070
// }
7171

7272
function genCommands() {
73-
const conf_path = __dirname + "/config/";
74-
const set_env = "SUBNET_CONFIG_PATH=" + conf_path;
7573
let csc_mode = "full";
7674
if (config.relayer_mode == "lite") {
7775
csc_mode = "lite";
@@ -86,10 +84,10 @@ function genCommands() {
8684
machine_name + `: deploy subnet on machine${i}\n`;
8785
}
8886
if (i !== 1) {
89-
commands += ` Prerequisite: copy docker-compose.yml,docker-compose.env,config/subnetX.env to ${machine_name}. Make sure docker-compose.env points to subnetX.env directory.\n`;
87+
commands += ` Prerequisite: copy docker-compose.yml, genesis.json, config/subnetX.env to ${machine_name}.\n`;
9088
}
91-
commands += ` docker compose --env-file docker-compose.env --profile ${machine_name} pull\n`;
92-
commands += ` docker compose --env-file docker-compose.env --profile ${machine_name} up -d\n\n`;
89+
commands += ` docker compose --profile ${machine_name} pull\n`;
90+
commands += ` docker compose --profile ${machine_name} up -d\n\n`;
9391
}
9492
commands +=
9593
"\n2. After 60 seconds, confirm the Subnet is running correctly\n";
@@ -100,8 +98,8 @@ function genCommands() {
10098
commands += "\n4. Add CSC configuration to common.env\n";
10199
commands += " - copy step 3. output CHECKPOINT_CONTRACT to common.env\n";
102100
commands += "\n5. Start services (relayer, backend, frontend)\n";
103-
commands += ` docker compose --env-file docker-compose.env --profile services pull\n`;
104-
commands += ` docker compose --env-file docker-compose.env --profile services up -d\n`;
101+
commands += ` docker compose --profile services pull\n`;
102+
commands += ` docker compose --profile services up -d\n`;
105103
commands += "\n6. Confirm Subnet services through browser UI\n";
106104
commands += ` Frontend: http://${config.public_ip}:5214\n`;
107105
commands += ` Relayer: http://${config.public_ip}:5215\n`;
@@ -134,8 +132,8 @@ function genCommands() {
134132
commands +=
135133
" - Add PARENTNET_ZERO_WALLET_PK to common.env, this should be different from PARENTNET_WALLET_PK\n";
136134
commands += "\n4. Restart Relayer\n";
137-
commands += ` docker compose --env-file docker-compose.env --profile services down\n`;
138-
commands += ` docker compose --env-file docker-compose.env --profile services up -d\n`;
135+
commands += ` docker compose --profile services down\n`;
136+
commands += ` docker compose --profile services up -d\n`;
139137
commands += "\n5. Confirm Relayer is running \n";
140138
commands += ` Relayer: http://${config.public_ip}:5215\n`;
141139
commands += ` Frontend: http://${config.public_ip}:5214\n`;
@@ -179,8 +177,8 @@ function genCommands() {
179177
commands += " - check keys.json for the Grandmaster Key as the source wallet\n"
180178
commands += " - for the destination wallet you should use the public address of SUBNET_WALLET_PK and SUBNET_ZERO_WALLET_PK\n"
181179
commands += "\n6. Restart Relayer\n";
182-
commands += ` docker compose --env-file docker-compose.env --profile services down\n`;
183-
commands += ` docker compose --env-file docker-compose.env --profile services up -d\n`;
180+
commands += ` docker compose --profile services down\n`;
181+
commands += ` docker compose --profile services up -d\n`;
184182
commands += "\n7. Confirm Relayer is running \n";
185183
commands += ` Relayer: http://${config.public_ip}:5215\n`;
186184
commands += ` Frontend: http://${config.public_ip}:5214\n`;

0 commit comments

Comments
 (0)