diff --git a/mkdocs.yml b/mkdocs.yml index fd6bf0c..f59b3e3 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -54,6 +54,7 @@ nav: - GO apps: ./user_guides/deploy_go_apps.md - Python apps: ./user_guides/deploy_python_apps.md - Node.js apps: ./user_guides/deploy_nodejs_apps.md + - React.js apps: ./user_guides/deploy_react_apps.md - Admin guides: - Managing clusters: ./admin_guides/managing_clusters.md diff --git a/src/user_guides/deploy_react_apps.md b/src/user_guides/deploy_react_apps.md new file mode 100644 index 0000000..ab9bd68 --- /dev/null +++ b/src/user_guides/deploy_react_apps.md @@ -0,0 +1,38 @@ +# Deploy React.js Applications + + +## Overview + +The major advantage of React applications is that are just static files to serve to a browser, react.js has its build process that generates .js, .css, and index.html files ready to deploy, cause of this concept we divide the process into three phases: Creating the app, build and deploy + + +## Creating the app + +To create an app, you use the command app create: + +``` bash +$ tsuru app create static +``` + +## Build + +Let's create an app using a well-known guide: https://github.com/facebook/create-react-app + + +After creating, let's generate a build directory using the following: + +``` bash +$ npm run build +``` + + +## Deploy + +Well, now we have the build directory with all static files, the next step is to add two files to the build directory: tsuru.yml and nginx.conf, both are suggestions that work for most react apps: + +``` bash +$ cd build +$ wget https://raw.githubusercontent.com/tsuru/platforms/refs/heads/master/examples/static-reactjs/nginx.conf +$ wget https://github.com/tsuru/platforms/blob/master/examples/static-reactjs/tsuru.yml +$ tsuru app deploy -a . +``` \ No newline at end of file