Self-Hosting
One of RocketShipIt's greatest advantages over our competitors is that it can be self-hosted on your own servers. This means that you and your customer's data is never shared, API request times are much faster, and you never have to worry about RocketShipIt's servers going down and interrupting business critical operations.
RocketShipIt comes with two major ways to self-host:
- HTTP JSON API
- stdin/stdout JSON directly to the RocketShipIt binary
HTTP JSON API
You can run RocketShipIt as an HTTP server/service in your own project's infrastructure. Just run the RocketShipIt binary with the -s
flag, no installation or dependencies are needed.
By default, the server runs on port 8080
you can change this with the -p
flag. The endpoint for all requests will be at http://localhost:8080/api/v1/
To authenticate with the RocketShipIt HTTP JSON API you need to set the RS_API_KEY
environment variable and use that value as the username in HTTP Basic Auth. Leave the password blank. Example: RS_API_KEY=MySecretAPIKey ./RocketShipIt -s
. Setting this environment variable will also require authentication for the API explorer.
stdin/stdout
If you don't want to run an HTTP server you can also use the RocketShipIt binary as a simple input/output via stdin/stdout.
Just simply copy all the files to your project and make requests with one of the supporting clients in PHP, Ruby, Python, or JavaScript.
Or send JSON directly via stdin:
echo '{"your_json_request":"goes_here"}' | ./RocketShipIt
Setting up RocketShipIt as a Service on Linux
If you would like the RocketShipIt HTTP JSON API to run 24/7 and automatically start on boot you will need to create a service script. This tutorial targets systemd
which is the default for most Linux distributions.
Create file: /lib/systemd/system/rocketshipit.service
:
[Unit]
Description=RocketShipIt
[Service]
Type=simple
Restart=always
RestartSec=5s
# change to match your path
ExecStart=/home/mark/RocketShipIt -s
[Install]
WantedBy=multi-user.target
Start the service:
sudo service rocketshipit start
Start on boot:
sudo service rocketshipit enable
Check service status:
sudo service rocketshipit status
Restart the service:
sudo service rocketshipit restart
Legacy SystemV for CentOS6
Use this script if you are using an older version of CentOS or SystemV:
#!/bin/bash
#
# /etc/init.d/rocketship
#
# Starts the RocketShipIt API Service
#
# chkconfig: 345 95 5
# description: Runs the RocketShip.IT Local API Service on Port 18080.
# processname: rocketship
# Get function from functions library
. /etc/init.d/functions
# Start the service
start() {
echo "starting rocketship API service"
export RS_API_KEY="XXXXX"
export RS_UPS_KEY="XXXXX"
export RS_UPS_USERNAME="XXXXX"
export RS_UPS_PASSWORD="XXXXX"
export RS_UPS_ACCOUNT_NUMBER="XXXXX"
export RS_FEDEX_ACCOUNT_NUMBER="XXXXX"
export RS_FEDEX_METER_NUMBER="XXXXX"
export RS_FEDEX_KEY="XXXXX"
export RS_FEDEX_PASSWORD="XXXXX"
echo "Starting RocketShipIt server:" | /bin/logtimeadd.sh >> /var/log/RocketShipIt.log
/usr/local/rocketship/RocketShipIt -s -p 18080 >> /var/log/RocketShipIt.log 2>&1 &
sleep 2
echo "RocketSHipIt Started with PID of $(ps fax | grep RocketShipIt | grep -v grep | head -1 | awk '{print $1}')"
echo "RocketShipIt Started ["$(tput setaf 2)OK$(tput sgr0)"]"
### Create the lock file ###
touch /var/lock/subsys/RocketShipIt
success $"RocketShipIt server startup"
echo
}
# Restart the service RocketShipIt
stop() {
echo "Stopping RocketShipIt server:" | /bin/logtimeadd.sh >> /var/log/RocketShipIt.log
killproc RocketShipIt
### Now, delete the lock file ###
rm -f /var/lock/subsys/RocketShipIt
echo
}
### main logic ###
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status RocketShipIt
;;
restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
Setting up RocketShipIt as a Service on Windows
At this time RocketShipIt can't natively be installed as a Windows host using typical tools like sc.exe
. However, you can still install RocketShipIt as a Windows service using nssm.
Install the RocketShipIt service with nssm install
command.
For more details see: https://nssm.cc/usage
Running RocketShipIt with Docker
Using the Official RocketShipIt Docker Image
You can always stay up to date with our official RocketShipIt Docker image:
docker run -v /full/path/to/license.lic:/license.lic -p 8080:8080 rocketshipit/rocketshipit:latest /RocketShipIt -s
To update:
docker pull rocketshipit/rocketshipit:latest
Show the version you have:
docker run rocketshipit/rocketshipit:latest /RocketShipIt -v
RocketShipIt Shipping API
Version: 2.8.1.706
Build Hash: e256b36ff6a988ea98ea72a4046dbdef54e48e32
Build Time: 2022-06-29_03:00:23PM_UTC
Copyright (c) 2008-2022 RocketShipIt Inc. All Rights Reserved
Building your own Docker Image
Put your license.lic
and rocketshipit.tar.gz
file in the same folder.
Create a Dockerfile
:
FROM debian:buster
RUN mkdir -p /rocketshipit
WORKDIR /rocketshipit
COPY license.lic .
COPY rocketshipit.tar.gz .
RUN tar -xzf rocketshipit.tar.gz && rm rocketshipit.tar.gz
RUN apt-get update
RUN apt-get -y install ca-certificates
COPY rocketshipit-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/rocketshipit-entrypoint.sh
EXPOSE 8081
ENTRYPOINT ["rocketshipit-entrypoint.sh"]
Create rocketshipit-entrypoint.sh
:
#!/bin/sh
/rocketshipit/RocketShipIt -s -p="8000"
- Build container:
docker build -t rs .
- Run container:
docker run -p 8000:8000 rs
Connect to container for troubleshooting:
docker exec -it <your_container_id> /bin/bash
Errors will be logged in log.log
Does RocketShipIt Send Data Home?
Yes, when using RocketShipIt self-hosted or on-premise, we collect a minimum amount of information to help improve the product. This information is used to inform us which users are actively using RocketShipIt, which version is being used, how many API requests are made, and if RocketShipIt is using too much memory or crashing.
We do NOT collect any carrier request or response information other than the number of requests made. We cannot see you or your customer's data.
Sample of data sent to RocketShipIt:
{
"started_at": "2020-04-22T14:46:01.835246057-04:00",
"ended_at": "2020-04-22T14:56:01.496260187-04:00",
"api_total_requests": 1033,
"os_type": "linux",
"app_mem_usage": 10823968,
"app_mem_total_usage": 735226600048,
"app_uptime": 689400,
"app_version": "2.8.1.351",
"user_id": "abcdefg123",
"version": "1"
}