Installation
This guide describes how to install the application and server solely to run on an emulator. To run the application on a real device, you need to start your server and specify the hosts of your server in Config file. To start your server, you need to install everything as described in this guide and start the server using the flag production See here.
Installation and running on localhost
Solely for testing purposes on a real device, you can use the hosts of my server, use them in the configuration file
1. Socket Server
Socket server uses Redis for messaging between API and socket server
First we need to install and run Redis. You can use Redis installation guide
Starting Redis
$ redis-serverIn socket-server directory
$ yarn installNext
$ yarn development2. API Server
First install MongoDB. Installation Guide.
Starting MongoDB
$ mkdir messenger
$ mongod --dbpath messengerIn messenger-api directory
$ yarn install
$ yarn development3. Setup AWS S3
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1458840156000",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:GetObjectAcl",
"s3:GetObjectVersion",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:PutObjectVersionAcl"
],
"Resource": [
"arn:aws:s3:::my-bucket/*"
]
}
]
}When my-bucket is your bucket name
Put your AWS S3 data into config file. More here
4. Messenger Application.
In messenger-app directory
$ yarn install
$ expo start Running on Production
To run Socket Server and API server, uses the package PM2.
To start the process PM2, you can use commands: yarn production this will launch a server with configurations for production, yarn staging this will launch a server with configurations for staging. See Config file.
To run you need to change config files
Socket server
$ yarn production
# or
# $ yarn stagingAPI Server
$ yarn build
$ yarn production
# or
# $ yarn stagingMessenger Application
Just set production mode. See here. This will launch Expo with a production configuration.
Note
Also for Socket Server and API Server there is a command yarn start-as-prod. This starts the server with configuration settings for production without build and PM2. It is needed to develop an application on the localhost using the production configuration
To run all the commands you can also use
npm run
Last updated
Was this helpful?