Serverless Containers Using Docker
Deploying Serverless Trellis Enterprise Containers using Docker
System Requirements
Software and Hardware
- Minimum Machine Requirements
-
- Hard Disk: At least 256 GB
- RAM: At least 32 GB
- Cores: 4
- Operating System: Linux (Ubuntu, RedHat, Fedora, Debian or OpenSuse), MacOS 13.x+ or Windows 10.x+
- Software Installed
- Python 3.9.x+
- If Windows, then Docker Desktop.
- If Linux or MacOS, then native
Docker
andKubernetes
libraries.- ZSH or BASH enabled
- Homebrew (optional)
- Minimum Pods Required: 4
- Internet Connectivity
Package Verifications
Docker
Verify the Docker installation by running the below command.
docker --version
The output of the command should be something like below.
Docker version 27.0.3, build 7d4bcd8
Python
Verify the Python installation by running the below command
python --verion
The output should be like below:
Python 3.11.2
Installing pip
locally
python -m ensurepip --upgrade
Alternatively, you can also run the below command to install pip
python get-pip.py
NOTE If any of the above steps fail, please do not proceed to the next steps. Contact your Trellis account representative for assistance with verifying your environment.
Deployment
Connect to your Cloud Provider
If you would like us to also connect to your private cloud such as AWS, Azure, or GCP, then add the below in the root directory and save the file as .trellis_env
in your user's root directory.
[default]
cloud=AWS
deployment=kubernetes-cluster
AWS_ACCESS_KEY=abcdefgh123456
AWS_SECRET_ACCESS_KEY=abcdefghijklmnopqrstuvwxyz
If you are using Azure or GCP, then the value of cloud
will be azure
or gcp
respectively.
Installation
You'll need your enterprise license key, which your Trellis Account representative will share separately.
Download the Trellis Enterprise Python package and run the commands below individually.
# Create a directory for your trellis installation
mkdir -p trellis-enterprise
# Set up the virtual environment
python -m venv .trellis-venv-enterprise
# Activate the virtual environment
source .trellis-venv-enterprise/bin/activate
# Install the trellis python libraries
pip install trellis-enterprise
# Set up the enterprise license key in your environment.
# This will be shared with you by your Trellis Account representative.
export TRELLIS_ENTERPRISE_LICENSE_KEY=ABCDE-12345-PQRST-67890-JKLMN
Trellis Logs
All the application logs are saved to the directory where the installer was run. In the above, it will be trellis-enterprise
- If you wish to transfer the logs to another storage, such as AWS - S3, please set up the file
.trellis_env
in your user's root directory with below. TheAWS_ACCESS_KEY
andAWS_SECRET_ACCESS_KEY
will be the access keys with the permission to push the logs to theS3
directory. The logs will be sent directly from the worker nodes within the cluster.
[default]
cloud=AWS
logs_path=s3://my_s3_directory
deployment=kubernetes-cluster
AWS_ACCESS_KEY=abcdefgh123456
AWS_SECRET_ACCESS_KEY=abcdefghijklmnopqrstuvwxyz
Windows Only Deployment
If you use Windows, open your preferred editor and copy/paste the script below.
import os
import platform
import subprocess
import urllib.request
import trellis-enterprise
def install_trellis():
try:
# Download Trellis installer
url = f'https://download.runtrellis.com/?product=trellis-enterprise-win&lang=en-US'
installer_path = 'trellis_enterprise.exe'
urllib.request.urlretrieve(url, installer_path)
# Install Trellis-Enterprise silently
subprocess.check_call([installer_path, '-ms'])
# Delete the installer file
os.remove(installer_path)
print(f"Successfully installed 'trellis-enterprise'")
except subprocess.CalledProcessError:
print(f"Failed to installed 'trellis-enterprise'")
Save the above script as download_trellis.py
and then run the below command to execute it
python download_trellis.py
The above command will download the packages and install Trellis on your Kubernetes cluster. If you are not running as an administrator, you will be prompted to enter the admin password to approve the package access.
Non-Windows Only Deployment
The steps below are only for non-Windows operating systems. If you have a Windows environment, use the preceding section for Windows-only deployment.
import os
import platform
import subprocess
import zipfile
import shutil
import tarfile
import urllib.request
import trellis-enterprise
def install_trellis():
try:
# Download Trellis installer
url = f'https://download.runtrellis.com/?product=trellis-enterprise-non-win&lang=en-US'
installer_path = 'trellis_enterprise.zip'
urllib.request.urlretrieve(url, installer_path)
# Install Trellis-Enterprise silently
if installer_path.endswith('.zip'):
opener, mode = zipfile.ZipFile, 'r'
elif installer_path.endswith('.tar.gz') or installer_path.endswith('.tgz'):
opener, mode = tarfile.open, 'r:gz'
file = opener(installer_path, mode)
file.extractall("trellis_enterprise_pckgs")
# Delete the installer file
os.remove(installer_path)
print(f"Successfully downloaded 'trellis-enterprise'")
except subprocess.CalledProcessError:
print(f"Failed to downloaded 'trellis-enterprise'")
Save the above script as download_trellis.py
and then run the below command to execute it
# To run the script as admin and avoid being prompted for passwords.
# If you don't want to run as admin, then just run the below command without the sudo in the beginning.
sudo python download_trellis.py
The above command will download the packages and install Trellis on your Kubernetes cluster. If you are not running as an administrator, you will be prompted to enter the admin password to approve the package access.
Verify Deployment
If the installation works, you will receive a Success pop-up message. At the command prompt, you can run the below command to verify your Trellis environment.
trellis status
The output should confirm the status and display the expiration date based on your enterprise contract.
###############################################################################
Trellis Environment Status
Plan: Enterprise
Expires On: Jan 01, 2020
-------------------------------------------------------
Deployment Type: Docker
-------------------------------------------------------
Container Node(s): 4
- Worker 1: IP: a.a.a.a:abcd
- Worker 2: IP: b.b.b.b:efgh
- Worker 3: IP: c.c.c.c:pqrst
- Worker 4: IP: d.d.d.d:mnop
###############################################################################
NOTE If any of the above steps fail, please do not proceed to the next steps. Contact your Trellis account representative for assistance with verifying your environment.
Updated 24 days ago