This guide will walk you through the process of building a Moose application and deploying it to a server that does not have internet access. We'll cover both the build environment setup and the deployment environment requirements.
Before you can build a Moose application, you need to set up your build environment with the following dependencies:
OS:
Common CLI utilities:
Python build environment requirements:
First, ensure you have Node.js installed. We recommend using nvm (Node Version Manager):
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
# Reload shell configuration
source ~/.bashrc # or ~/.zshrc
# Install and use Node.js 20
nvm install 20
nvm use 20Verify the installation:
node --version
npm --version # or yarn --versionFirst, install the required system dependencies:
sudo apt update
sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev curl git libncursesw5-dev xz-utils \
tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-devInstall pyenv and configure your shell:
curl -fsSL https://pyenv.run | bashAdd the following to your ~/.bashrc or ~/.zshrc:
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"Install and set Python 3.12:
pyenv install 3.12
pyenv global 3.12Verify the installation:
python --versionYou can install the Moose CLI using the official installer:
curl -SfsL https://fiveonefour.com/install.sh | bash -s -- moose
source ~/.bashrc # Or restart your terminalor
pip install moose-cliThis step is optional if you already have a Moose project. Create a new Moose project:
moose init your-project-name py
cd your-project-nameMake sure you have the zip utility installed (sudo apt install zip) before building your application.
If you installed the moose cli to be available globally, you can build the application with the following command:
moose buildOr if you installed the moose cli to be available locally, you can build the application with the following command:
The build process will create a deployable package:
moose buildThis will create a zip file in your project directory with a timestamp, for example: your-project-name-YYYY-MM-DD.zip
The deployment server requires:
Follow the Python installation steps from the build environment setup section.
sudo apt install unzipCopy your built application package to the deployment server
Extract the application:
unzip your-project-name-YYYY-MM-DD.zip -d ./app
cd ./app/packagermoose prodEnsure all required environment variables and configurations are properly set before starting your application.
node --versionpackage.jsontsconfig.json is properly configuredpython --versionrequirements.txtPYTHONPATH is properly set