//
Meteor.js local windows server deployment using Bitnami's MEAN stack
Search
Notion
Meteor.js local windows server deployment using Bitnami's MEAN stack
Written on
Feb 3, 2021
Updated on
Empty
I'll assume that the stack is installed at the default location of C:\Bitnami\meanstack-4.4.3-0 - if not, change your paths accordingly.
Open a command prompt inside your meteor project, and build your meteor application into the Bitnami stack folder:
npm install --production meteor build C:\Bitnami\meanstack-4.4.3-0\meteor --directory
Bash
This will create a meteor folder in the root of your stack's folder, with a bundle folder inside it containing all of the built application code. Using the --directory options saves us from having to uncompress the bundle.
Start a command prompt in the stack's environment by using the use_meanstack.bat file, then log into mongo with your admin credentials and create a new database for the meteor app to use, plus a new user with administration rights for this database:
mongo admin --username root --password PASSWORD db = db.getSiblingDB('DB_NAME') db.createUser( { user: "DB_USER", pwd: "DB_PASSWORD", roles: [ "readWrite", "dbAdmin" ]} )
Bash
Open the scripts/setenv.bat file and add these lines at the bottom of the file to correctly set the required meteor environment variables alongside the rest of the stack:
set ROOT_URL=http://localhost set PORT=3000 set MONGO_URL=mongodb://DB_USER:DB_PASSWORD@127.0.0.1:27017/DB_NAME
Bash
C:/Bitnami/meanstack-4.4.3-0/scripts/setenv.bat
Where DB_NAME is the name of the database we created in the previous step and DB_USER, BD_PASSWORD are the username and password of the user we created and assigned as admin for the database.
Open the /apache2/conf/httpd.conf file (or start the stack manager tool, and under "Manage Servers" click "Configure" after selecting "Apache Web Server" and then click "Open Conf File"), and uncomment the following line to enable proxy functionality:
LoadModule proxy_module modules/mod_proxy.so
Bash
C:/Bitnami/meanstack-4.4.3-0/apache2/conf/httpd.conf
Afterwards, create a conf folder inside the meteor folder on your stack's root and create a new meteor.conf file inside it with this content:
ProxyPass / http://127.0.0.1:3000/ ProxyPassReverse / http://127.0.0.1:3000/
Plain Text
C:/Bitnami/meanstack-4.4.3-0/meteor/conf/meteor.conf
Open the /apache2/conf/bitnami/bitnami-apps-prefix.conf file and add this line to it:
Include "C:\Bitnami\meanstack-4.4.3-0\meteor\conf\meteor.conf"
Plain Text
C:/Bitnami/meanstack-4.4.3-0/apache2/conf/bitnami/bitnami-apps-prefix.conf
This will add the conf file we created beforehand to the Apache configuration, setting up a reverse proxy for the port 3000, which is where our meteor application is started.
Create a batch script at \meteor\scripts\start.bat which will start the meteor application:
@echo off cd C:\Bitnami\MEANST~1.3-0\meteor\bundle cmd /c cd programs/server && call npm install node main.js
Bash
C:/Bitnami/meanstack-4.4.3-0/meteor/scripts/start.bat
Finally, create a batch file in the root folder of the stack which will set up the stack's environment, and then call the script above (very similar to what use_meanstack.bat does):
@echo off CALL "C:\Bitnami\MEANST~1.3-0\scripts\setenv.bat" START "Meteor on MEAN Stack" "C:\Bitnami\MEANST~1.3-0\meteor\scripts\start.bat"
Bash
C:/Bitnami/meanstack-4.4.3-0/start_meteor_meanstack.bat