Skip to content

Development

Bruce How edited this page Aug 6, 2020 · 2 revisions

Building

Minion is built into an executable .jar using maven. Any changes to the code will require a new build which must be transferred to the AWS EC2 instance via any common file transfer protocol (FTP). If you're using a GUI based terminal to connect to the EC2 instance, such as MobaXTerm, then you can simply just drag and drop the .jar file in.

For simplicity I use ssh and scp to remotely login and transfer files.

Installing Maven

Before you can build the package you will need to have Maven installed. This can be done with the following commands.

sudo apt-get install mvn
# If the above did not successfully install try
sudo apt-get install maven

It is recommended that you validate whether Maven was installed. Use the following commands.

mvn
# Or for more details
mvn -version

Packaging Minion

Building into a .jar can be done using the following command.

# In the root directory of the project
mvn package

This will build two .jar files in the target/ directory. As a standalone, Minion requires the .jar with dependencies.

If all goes to plan you have successfully built the project. Next is to rename the Minion-x.x-with-dependencies.jar file to just Minion.jar and transfer it to the EC2 cloud. You will need to re-run the .jar inside of the instance with the new build. Read more on regarding this.

Deployment

Once you have successfully built and transferred the latest version of Minion.jar, you will need to run the .jar on our EC2 instance. In order to access the EC2 instance, you will require a .pem permission file and have the relevant EC2 server details.

Instance Connection

ssh -i <path/to/pem> <endpoint>

Note that you may need to change the file access for your .pem file.

Bot Deployment

Minion is run using a virtual terminal known as tmux. This is to ensure that the process does not stop when you leave the EC2 instance. Without tmux Minion bot will cease to run once the user exits out of the instance. You can enter the tmux terminal by attatching it back to the local terminal using the following command.

When running Minion, we want to pipe the output to a log file so that we are able to review and track the bot log as it goes. We can check the log by using the following command.

tail -f bot.log

To exit the virtual terminal, you will need to detatch it from the local terminal. This can be done by pressing the following key combinations. Ctrl + b then d.

Clone this wiki locally