# Moose / Deploying / Deploying On An Offline Server Documentation – TypeScript ## Included Files 1. moose/deploying/deploying-on-an-offline-server/deploying-on-an-offline-server.mdx ## Deploying on an offline server Source: moose/deploying/deploying-on-an-offline-server/deploying-on-an-offline-server.mdx Deploying on an offline server # 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) Typescript build environment requirements: 1. Node.js 20 or later 2. npm, yarn or pnpm package manager 3. Moose CLI ### Setting up the Build Environment First, ensure you have Node.js installed. We recommend using nvm (Node Version Manager): ```bash # 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: ```bash node --version npm --version # or yarn --version ``` ### Installing Moose CLI (Optional) You can install the Moose CLI using the official installer: ```bash curl -SfsL https://fiveonefour.com/install.sh | bash -s -- moose source ~/.bashrc # Or restart your terminal ``` or ```bash npm install -g @514labs/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: ```bash moose init your-project-name ts cd your-project-name ``` Install dependencies: ```bash npm install # or yarn install ``` ### 2. Build the Application 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: ```bash moose build ``` Or if you installed the moose cli to be available locally, you can build the application with the following command: Create the deployable package: ```bash npm run moose-cli 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 ### Prerequisites The deployment server requires: 1. Node.js 20 or later 3. Unzip utility ### Setting up the Deployment Environment 1. Install the runtime environment: Follow the Node.js installation steps from the build environment setup section. 2. Install the unzip utility: ```bash sudo apt install unzip ``` ## Deploying Your Application 1. Copy your built application package to the deployment server 2. Extract the application: ```bash unzip your-project-name-YYYY-MM-DD.zip -d ./app cd ./app/packager ``` 3. Start your application: ```bash # If using npm scripts npm run moose-cli prod # Or directly with moose moose prod ``` Ensure all required environment variables and configurations are properly set before starting your application. ## Troubleshooting - Verify that Node.js is properly installed using `node --version` - Check that your application's dependencies are properly listed in `package.json` - If you encounter TypeScript compilation errors, ensure your `tsconfig.json` is properly configured