Running multiple FCF applications on a single Linux server
Building multiple applications on a single server differs only in the choice of unique ports. First, let's create two test applications test1 and test2 An example is presented for Linux systems. All commands must be executed from a user with write access to the / var / www directory and under which NODEJS processes will run $ cd /var/www $ fcfmngr create project test1 $ cd test1 $ fcfmngr create-db test1.js $ cd /var/www $ fcfmngr create project test2 $ cd test2 $ fcfmngr create-db test2.js All two projects have been created, but not initialized. Now you need to configure the ports. Let's configure the first project on port 8080, set the username from which the NODEJS processes will be launched, and also replace the system ports of interaction between fcfserver and NODEJS processes. Open fcfserver server.json in the configuration file editor $ subl /var/www/test1/server.json
  • In the root section, replace the fcfserver control signal port: { ... "serverControlPort": 3740, ... }
  • In the endpoints section, change the value of the port property to 8080. This parameter sets the working port of fcfserver { ... "endpoints": [ { ... "port": 8080, ... } ] ... }
  • In the endpoints.handlers section, change the value of the dataPorts and controlPorts properties. dataPorts - array of data ports. The array is automatically filled up to the size specified in (process + processesLeakProtection) * 2, but must contain at least one element (array). Since we use one NODEJS process each in protected from memory leaks and without, we will use the 4th port. Let's set the value to 3100 controlPorts - an array of control signal ports. The array is automatically filled up to the size specified in (process + processesLeakProtection) * 2, but must contain at least one element (array) Since we use one NODEJS process each in protected from memory leaks and without, we will use the 4th port. ... Let's set the value to 3110 { ... "endpoints": [ { ... "handlers": [{ ... "dataPorts": [3100], ... "controlPorts": [3110], ... }] ... } ] ... }
Now let's edit the launch parameters of the test2 application. Open fcfserver server.json in the configuration file editor $ subl /var/www/test2/server.json
  • In the root section, replace the fcfserver control signal port: { ... "serverControlPort": 3741, ... }
  • In the endpoints section, change the value of the port property to 8081. This parameter sets the working port of fcfserver { ... "endpoints": [ { ... "port": 8081, ... } ] ... }
  • In the endpoints.handlers section, change the value of the dataPorts and controlPorts properties. dataPorts - array of data ports. The array is automatically filled up to the size specified in (process + processesLeakProtection) * 2, but must contain at least one element (array). Since we use one NODEJS process each in protected from memory leaks and without, we will use the 4th port. Let's set the value to 3120 controlPorts - an array of control signal ports. The array is automatically filled up to the size specified in (process + processesLeakProtection) * 2, but must contain at least one element (array) Since we use one NODEJS process each in protected from memory leaks and without, we will use the 4th port. ... Let's set the value to 3130 { ... "endpoints": [ { ... "handlers": [{ ... "dataPorts": [3120], ... "controlPorts": [3130], ... }] ... } ] ... }
Run everything in different terminals of the application test1 and test2 $ cd /var/www/test1 $ sudo fcfserver ./server.json
$ cd /var/www/test2 $ sudo fcfserver ./server.json After initializing both, check for accessibility in the browser at the addresses localhost:8080 and localhost:8081
Yes, while setting up several servers is a dreary thing, but it is planned to fix it.