Skip to content

Commit

Permalink
Add first version of guide of React.js applications
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjunior committed Dec 3, 2024
1 parent 59f448b commit 1e53db2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 38 additions & 0 deletions src/user_guides/deploy_react_apps.md
Original file line number Diff line number Diff line change
@@ -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 <app-name> 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 <app-name> .
```

0 comments on commit 1e53db2

Please sign in to comment.