How to deploy in production
Deploy Api-Server, Admin Web Dashboard, Mobile App in Production
Installation Steps
Download LyonEat app and extract it
Open terminal in extracted folder
Api Server
run
cd food-delivery-apiin terminalSet environment file (.env)
NODE_ENV=production PORT=8000 CONNECTION_STRING={DB Connection string} RESET_PASSWORD_LINK=https://{Domain name}/auth/reset/?reset= SERVER_URL=https://{Domain name}/ NOTIFICATION_ON_CLICK=https://{Domain name}/dashboardCreate an account on mlab, then Create a database on mlab, copy connection string and paste it in
.envagainst the keyCONNECTION_STRING. Read more about how to use mlab hererun
npm installoryarn installto install packagesrun
pm2 start app.jsin terminal to start serverYou can further read about how to make it public or how to map it on your domain here https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04
How To Secure Nginx with Let's Encrypt (SSL): https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
If you have a different environment and previous instructions dont work for your requirement you can let us know we'll be happy to help you.
run this command in terminal on server
chmod -R 777 food-delivery-api/*. This gives permission to read/write files, it is needed to upload food,profile images on server
NOTE: For notifications to work on android you'll have to upload FCM token on expo server. Read more about it here
Admin Web Dashboard
run
cd food-delivery-adminin terminalInstall packages by
npm installoryarn installupdate
server_urlin/config/config.jswith the ip/domain of where you hosted api in last stepreplace "homepage": "https://lyoneat.com/admin/dashboard" in package.json with the url where you are going to deploy your admin.
run
npm run buildit will create a build folder. here we can publish in many ways but we are going to mention one that we use if you want to know others you will find several tutorials on how to deploy react applications for production.copy build folder into your api folder
restart api server by
pm2 restart <App Id>. App id can be found by runningpm2 listyou can now access admin dashbaord on
www.domain.com/dashboard
Mobile App
Go to folder food-delivery-app
Install packages by
npm installoryarn installupdate
GRAPHQL_URLandWS_GRAPHQL_URLin/environment.jsif you are running API/Server on different url/portReplace these keys in
app.jsonwith live keys. You can find more about these by clicking on each key.
stripeImageUrl; logo image url for store
stripeStoreName; store name
Analytics Dashboard
Explore demo version on https://amplitude.com get amplitude key and replace it with amplitudeApiKey in app.json of mobile app.
You can further explore dashboard by following amplitude documentation. https://developers.amplitude.com/
Last updated
Was this helpful?