FiveonefourFiveonefour
Fiveonefour Docs
MooseStackTemplatesGuides
Release Notes
Source514
  1. MooseStack
  2. Moose Deploy
  3. Offline Deployment

On this page

Build Environment SetupPrerequisitesSetting up the Build EnvironmentInstalling Moose CLI (Optional)Building Your Application1. Initialize a New Project (Optional)2. Build the ApplicationDeployment Environment SetupDeployment PrerequisitesSetting up the Deployment EnvironmentDeploying Your ApplicationTroubleshooting

Building and Deploying Moose Applications

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.

Build Environment Setup

Prerequisites

Before you can build a Moose application, you need to set up your build environment with the following dependencies:

OS:

  • Debian 10+
  • Ubuntu 18.10+
  • Fedora 29+
  • CentOS/RHEL 8+
  • Amazon Linux 2023+
  • Mac OS 13+

Common CLI utilities:

  • zip
  • curl (optional, for installing the Moose CLI)

Python build environment requirements:

  1. Python 3.12 or later (we recommend using pyenv for Python version management)
  2. pip

Setting up the Build Environment

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 20

Verify the installation:

node --version
npm --version  # or yarn --version

First, 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-dev

Install pyenv and configure your shell:

curl -fsSL https://pyenv.run | bash

Add 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.12

Verify the installation:

python --version

Installing Moose CLI (Optional)

You can install the Moose CLI using the official installer:

curl -SfsL https://fiveonefour.com/install.sh | bash -s -- moose
source ~/.bashrc  # Or restart your terminal

or

pip install moose-cli

Building Your Application

1. Initialize a New Project (Optional)

This step is optional if you already have a Moose project. Create a new Moose project:

moose init your-project-name py
cd your-project-name

2. Build the Application

MooseTip:

Make 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 build

Or 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 build

This will create a zip file in your project directory with a timestamp, for example: your-project-name-YYYY-MM-DD.zip

Deployment Environment Setup

Deployment Prerequisites

The deployment server requires:

  1. Python 3.12 or later
  2. Unzip utility

Setting up the Deployment Environment

  1. Install the runtime environment:

Follow the Python installation steps from the build environment setup section.

  1. Install the unzip utility:
sudo apt install unzip

Deploying Your Application

  1. Copy your built application package to the deployment server

  2. Extract the application:

unzip your-project-name-YYYY-MM-DD.zip -d ./app
cd ./app/packager
  1. Start your application:
moose prod
Warning:

Ensure all required environment variables and configurations are properly set before starting your application.

Troubleshooting

  1. Verify that Node.js is properly installed using node --version
  2. Check that your application's dependencies are properly listed in package.json
  3. If you encounter TypeScript compilation errors, ensure your tsconfig.json is properly configured
  1. Verify that Python is properly installed using python --version
  2. Check that your application's dependencies are properly listed in requirements.txt
  3. If you encounter Python import errors, ensure your PYTHONPATH is properly set
  • Overview
Build a New App
  • 5 Minute Quickstart
  • Browse Templates
  • Existing ClickHouse
Add to Existing App
  • Next.js
  • Fastify
Fundamentals
  • Moose Runtime
  • MooseDev MCP
  • Data Modeling
Moose Modules
  • Moose OLAP
  • Moose Streaming
  • Moose Workflows
  • Moose APIs & Web Apps
Deployment & Lifecycle
  • Moose Migrate
  • Moose Deploy
    • Packaging Moose for deployment
    • Preparing Infrastructure
    • Cloud Configuration
    • Kubernetes Deployment
    • AWS ECS Deployment
    • Offline Deployment
    • Docker Compose Deployment
    • Monitoring (moved)
Reference
  • API Reference
  • Data Types
  • Table Engines
  • CLI
  • Configuration
  • Observability Metrics
  • Help
  • Release Notes
Contribution
  • Documentation
  • Framework