Skip to content

Commit daa676a

Browse files
authored
Merge pull request #354 from tronprotocol/feature/deploy
feat: add travis to deploy.
2 parents 2360926 + 58553d2 commit daa676a

File tree

5 files changed

+21
-29
lines changed

5 files changed

+21
-29
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ script:
99
addons:
1010
ssh_known_hosts:
1111
- 47.93.9.236:22008
12-
- 47.93.33.201:22008
13-
- 123.56.10.6:22008
14-
- 39.107.80.135:22008
15-
- 47.93.184.2:22008
12+
# - 47.93.33.201:22008
13+
# - 123.56.10.6:22008
14+
# - 39.107.80.135:22008
15+
# - 47.93.184.2:22008
1616
skip_build:
1717
- README.md
1818
- LICENSE

deploy.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
11
#!/bin/bash
2-
./gradlew clean shadowJar
3-
ssh [email protected] -p 22008 mkdir java-tron
4-
scp -P 22008 build/libs/java-tron.jar [email protected]:/home/tron/java-tron/
5-
scp -P 22008 start.sh [email protected]:/home/tron/java-tron/
6-
# ssh [email protected] -p 22008 sh java-tron/start.sh
7-
ls -a
2+
ssh [email protected] -p 22008 sh /home/tron/workspace/deploy_all.sh

src/main/java/org/tron/core/config/Configuration.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,21 @@ public static com.typesafe.config.Config getByPath(final String configurationPat
4040
throw new IllegalArgumentException("Configuration path is required!");
4141
}
4242

43-
//if (config == null) {
44-
4543
File confFile = new File(configurationPath);
4644
if (confFile.exists()) {
47-
logger.info("eee");
48-
logger.info(configurationPath);
49-
5045
config = ConfigFactory.parseFile(new File(configurationPath));
51-
return config;
5246
} else {
53-
logger.info("aaa");
54-
logger.info(configurationPath);
5547
config = ConfigFactory.load(configurationPath);
56-
return config;
5748
}
49+
return config;
50+
}
51+
52+
public static com.typesafe.config.Config getByFile(final File confFile) {
53+
if (!confFile.exists()) {
54+
throw new IllegalArgumentException("Configuration path is required!");
55+
}
56+
config = ConfigFactory.parseFile(confFile);
57+
return config;
5858
}
59-
//logger.info("fff");
60-
//logger.info(configurationPath);
61-
//return config;
6259
}
6360

src/main/java/org/tron/core/config/args/Args.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,14 @@ public static void clearParam() {
183183
/**
184184
* set parameters.
185185
*/
186-
public static void setParam(final String[] args, final String configFile) {
186+
public static void setParam(final String[] args, final String configFilePath) {
187187
Config config;
188-
logger.info(configFile);
189188
JCommander.newBuilder().addObject(INSTANCE).build().parse(args);
190-
if ("" == INSTANCE.confFile) {
191-
config = Configuration.getByPath(configFile);
192-
logger.info(configFile);
189+
File confFile = new File(INSTANCE.confFile);
190+
if (confFile.exists()) {
191+
config = Configuration.getByFile(confFile);
193192
} else {
194-
config = Configuration.getByPath(INSTANCE.confFile);
193+
config = Configuration.getByPath(configFilePath);
195194
}
196195
if (StringUtils.isNoneBlank(INSTANCE.privateKey)) {
197196
INSTANCE.setLocalWitnesses(new LocalWitnesses(INSTANCE.privateKey));

start.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
nohup java -jar java-tron.jar -c config.conf > tron-shell.log 2>&1 &
2+
kill -9 `cat /home/tron/pid.txt`
3+
nohup java -jar /home/tron/java-tron/java-tron.jar --witness -c /home/tron/config.conf > /home/tron/tron-shell.log 2>&1 & echo $! >/home/tron/pid.txt

0 commit comments

Comments
 (0)