- Node.js
-
react
-
react-router
-
formik
-
yup
-
axios
- yarn
- VSCode
-
Run
yarn
to download all dependencies into node_modules directory -
Run
yarn test
to run all unit tests,yarn lint
to static check the code -
Run
yarn mockServer
to start local mock api server with http://localhost:4010 -
Run
yarn start
to start local environment and can be visited with http://localhost:3010
-
Run
yarn version
to change the version that will be built -
Run
yarn build
to build static files forproduction
environment intobuild
directory, can start a server withyarn serve
and then visit http://localhost:5010 -
Run
yarn build:dev
to build static files fordevelopment
environment intobuild
directory, can start a server withyarn serve
and then visit http://localhost:5010
-
Install docker in your local machine, refer to Get Docker.
-
Make sure your private key to login the remote machine is located at
~/.ssh
-
Make sure the remote server is using *nix system
-
Check current version in dev/prod environment with
http://[host:port]/version
-
Pull docker images that support ansible:
docker pull wendll/node_ansible_container:latest
If you don't want to pull image from docker hub, you can build the container by yourself:
docker build -t wendll/node_ansible_container .
-
Run docker locally with:
docker-compose run deploy
In docker container interactive shell console, run
./deploy/to-dev.sh --key [your private key name]
Notice: private key name default is
id_rsa
, can override it with--key
Or you can just run followed command example to do the deployment:
docker-compose run deploy ./deploy/to-[env].sh [version] --key [your private key name] [--copyFromLocal] [--freshBuild] ....
-
Check application version before newly deployment http://dev_host:5000/version
-
After login docker, can run followed commands to do the deployment
./deploy/to-dev.sh 0.1.7 --copyFromLocal --freshBuild
--copyFromLocal
will copy package (build withyarn build:dev
in local development machine) from local to remote server
You can also just run one command to execute the deployment in your local machine:
docker-compose run deploy ./deploy/to-dev.sh 0.1.7 --copyFromLocal --freshBuild
- Check application version after newly deployment http://dev_host:5000/version