Open Source on IBM i

ILEDocs on AWS

Hi folks,

ILEDocs has moved or at least part of it. More specifically the backend of ILEDocs has moved from a private VServer to an AWS EC2 instance. And it was super easy.

  • create an AWS account on the free tier
  • create an EC2 instance on the free tier
  • copy the iledocs.rest.jar to the EC2 instance
  • install MongoDB
  • start ILEDocs REST Service

I think the first two steps doesn't need any further explanation. Just use the info on the AWS web site.

Copy iledocs.rest.jar

I have made a folder on the EC2 instance /opt/iledocs. Then copied the jar file to the folder.

scp -i "~/.ssh/iledocs-aws.pem"  iledocs.rest-2.2.0.jar  ubuntu@ec2-xyz.eu-central-1.compute.amazonaws.com:/opt/iledocs/

Don't forget to create the config.yml in the iledocs folder. It may look like this.

server:
  applicationConnectors:
      - type: http
        port: 8080

  adminConnectors:
      - type: http
        port: 8081

And don't forget to install a Java Runtime Environment.

apt-get install openjdk-8-jre-headless

Note: How to install Java and the package name depends on the linux distribution.

Note: For easier maintenance I made a symbolic link from /opt/iledocs/iledocs.rest-2.2.0.jar to /opt/iledocs/iledocs.jar.

Start ILEDocs REST Service

If you can use /etc/rc.local then add the following line to start ILEDocs REST Service with screen:

screen -dmS iledocs bash -c "/opt/iledocs/iledocs.rest-2.2.0.jar server /opt/iledocs/config.yml"

If your system uses systemd for managing startup processes then use the following script:

#
# ILEDocs systemd start script
#

[Unit]
Description=ILEDocs

# To start/stop iledocs service manually, run:
#
# systemctl start iledocs
# systemctl stop iledocs

[Service]
Type=simple
KillMode=process
ExecStart=java -jar iledocs.jar server config.yml
WorkingDirectory=/opt/iledocs

User=iledocs
Group=iledocs

# Allow many incoming connections
LimitNOFILE=infinity
# Allow core dumps for debugging
LimitCORE=infinity

StandardInput=null
StandardOutput=file:/var/local/logs/iledocs/application.log
StandardError=file:/var/local/logs/iledocs/error.log
Restart=on-failure

[Install]
WantedBy=multi-user.target

Note: You might want to adjust the script to your environment (f. e. logs files).

MongoDB

MongoDB can be installed simply with a one-liner:

apt-get install mongodb-server

By default it installs with no auth on Ubuntu with a binding to localhost. So you can only access the database from inside the EC2 instance and without any authentication which is fine for us.

Note: How to install MongoDB depends on the linux distribution.

Access REST Service

By default everything except SSH (Port 22) is blocked. You need to open up at least the port specified in the config.yml for HTTP.

EC2 -> Security Groups -> Inbound Rules

Note: Be sure to use the same region as you used for the EC2 instance. ;-)

Happy documenting!

Mihael

Tags : iledocs