Deployment Overview of MEAN on Server¶
Prerequisites and Basic Requirements¶
The MEAN stack deployment requires a Linux server running either Ubuntu or Debian. The installation process assumes the following:
-
Operating System: Ubuntu or Debian
-
Privileges: Root access or a user with
sudoprivileges -
Network: Internet access is required to download packages and dependencies
-
Ports: Standard ports for PostgreSQL (5432) and the Node.js application (default 3000 or 8080, depending on configuration)
File and Directory Structure¶
The application components are installed globally or in standard system directories. Key locations include:
-
Node.js binaries:
/usr/bin/nodeand/usr/bin/npm -
Angular CLI: Installed globally via
npm -
Express Generator: Installed globally via
npm -
PostgreSQL data directory:
/var/lib/postgresql -
PostgreSQL configuration:
/etc/postgresql -
Application source code: Typically located in the user's home directory or a designated project folder (e.g.,
/var/www/mean-app)
Application Installation Process¶
The MEAN stack is installed using package managers and Node.js package manager (npm). The process involves installing the core components: MongoDB is not explicitly installed in the provided scripts; instead, PostgreSQL is used as the database backend.
-
Node.js:
-
On Ubuntu: Version 22.x is installed via the NodeSource repository.
-
On Debian: Version 18.x is installed via the NodeSource repository.
-
Angular CLI: Installed globally using
npm install -g @angular/cli. -
Express: Installed globally using
npm install -g express-generator. -
PostgreSQL Client for Node.js: Installed using
npm install pg.
The installation scripts ensure that all prerequisites, including curl, gnupg, and software-properties-common, are present before proceeding.
Databases¶
PostgreSQL is used as the database management system for this deployment.
-
Installation: Installed via the
aptpackage manager. -
Service Status: The PostgreSQL service is started and enabled to run on system boot.
-
Connection Method: Applications connect to PostgreSQL using the
pgNode.js client library. -
Storage Location: Database files are stored in
/var/lib/postgresql. -
Configuration: Database settings are managed through files in
/etc/postgresql.
Access Rights and Security¶
The installation scripts do not explicitly configure firewall rules, user restrictions, or additional security layers beyond the default OS settings. Administrators should manually configure:
-
Firewall rules to allow traffic on required ports (e.g., 5432 for PostgreSQL, 3000 for the application).
-
User permissions for accessing the application and database.
-
SSL/TLS certificates if external access is required.
Permission Settings¶
File and directory permissions are set by default during the installation of packages via apt and npm. No explicit permission changes are applied in the provided scripts. Administrators should verify:
-
Ownership of application directories (typically the user running the Node.js application).
-
Read/write permissions for the PostgreSQL data directory.
-
Execution permissions for Node.js scripts and binaries.
Starting, Stopping, and Updating¶
Service management for the installed components is handled as follows:
-
PostgreSQL:
-
Start:
systemctl start postgresql -
Stop:
systemctl stop postgresql -
Restart:
systemctl restart postgresql -
Enable on boot:
systemctl enable postgresql -
Node.js Application:
-
The application is not managed as a systemd service in the provided scripts. It must be started manually using
nodeornpm startwithin the application directory. -
To update the application, pull the latest code and reinstall dependencies using
npm install.
Available Ports for Connection¶
The following ports are utilized by the deployed components:
| Component | Default Port | Description |
|---|---|---|
| PostgreSQL | 5432 | Database connection |
| Node.js App | 3000 | Application server (default) |
| Nginx/Traefik | 80/443 | Not configured in provided data |
Note: The provided scripts do not configure a reverse proxy or web server. Port 3000 is the default for Node.js applications unless otherwise specified in the application code.