Skip to content

Deployment Overview of MEAN on Server

Prerequisites and Basic Requirements

The deployment process requires a Linux server running either Ubuntu or Debian. The system must have the following components installed or installed as part of the automated process:

  • Operating System: Ubuntu or Debian.

  • Privileges: Root access or a user with sudo privileges is required to install system packages.

  • Network Access: The server must have outbound internet access to download dependencies from public repositories.

  • Ports: The default ports for Node.js applications and PostgreSQL are utilized. Ensure that the firewall allows traffic on these ports for local access or specific remote access as configured.

Application Installation Process

The MEAN stack is installed by manually executing specific commands to set up the runtime environment, database, and development tools. The installation includes the following components:

  • Node.js: Installed via the NodeSource repository.

  • Ubuntu systems install Node.js version 14.x.

  • Debian systems install Node.js version 18.x.

  • Angular CLI: Installed globally using npm.

  • Express: Installed globally using the express-generator package.

  • PostgreSQL: Installed as a system service and configured to start automatically on boot.

  • PostgreSQL Client for Node.js: The pg package is installed for database connectivity.

To replicate this setup manually, execute the following commands based on your operating system:

For Ubuntu:

curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y nodejs
sudo apt-get install -y postgresql
sudo npm install -g @angular/cli
sudo npm install -g express-generator
npm install pg

For Debian:

curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
apt-get update
apt-get install -y nodejs
apt-get install -y postgresql
npm install -g @angular/cli
npm install -g express-generator
npm install pg

Databases

The application utilizes PostgreSQL as its relational database management system.

  • Connection Method: The application connects to the database using the pg Node.js client.

  • Storage Location: Database data is stored in the default PostgreSQL data directory, typically located at /var/lib/postgresql/data/.

  • Service Status: The PostgreSQL service is configured to be running and enabled to start automatically upon system boot.

Starting, Stopping, and Updating

The PostgreSQL database service is managed using the standard system service manager. The Node.js applications (Angular and Express) run as user processes and do not have dedicated systemd service definitions in this configuration.

To manage the PostgreSQL service, use the following commands:

sudo systemctl start postgresql
sudo systemctl stop postgresql
sudo systemctl status postgresql

To restart the service after updates:

sudo systemctl restart postgresql

The pg client and other Node.js modules are installed locally or globally and do not have specific service management commands other than standard npm or node execution.

question_mark
Is there anything I can help you with?
question_mark
AI Assistant ×