React / NodeJS / MySQL

Sample Repo

The repo for a sample nodejs / mysql / react app can be found here:

https://github.com/getreploy/nodejs-mysql-sample

Sample file

setup:
commands:
- cp seed.sql /docker-entrypoint-initdb.d/
services:
frontend:
runtime: reactjs
port: 3000
path: frontend
build:
- yarn install
- yarn build
serve:
- npx serve build/ -l 3000
backend:
runtime: node
port: 5000
path: backend
build:
- npm install
serve:
- node app.js
mysql:
image: mysql
port: 3306
do-not-expose: true

The reploy.yml file for this environment can also be found here:

https://github.com/getreploy/nodejs-mysql-sample/blob/master/reploy.yml

Service Description

In the above file, we have three services, each of which describe a "process" or "container". A little bit about each service:

  • The frontend service is a react app, built with the create-react-app template. It uses our curated reactjs runtime and uses the typical build commands packaged with yarn.

  • The backend service is a nodejs application, which uses our nodejs runtime and uses npm for building the app.

  • Lastly, the mysql service uses the public mysql image and reads in the seed.sql file provided during the setup routine so that the other services have access to staging data.