Giter Club home page Giter Club logo

Comments (10)

edwardkong86 avatar edwardkong86 commented on May 22, 2024 3

Any deployment instructions to Amazon EC2, Google Cloud & Heroku or Docker?

from react-pwa.

mrtysn avatar mrtysn commented on May 22, 2024 1

What I'm suggesting here is not a modification to the codebase. A set of instructions in the deployment section of the docs would help first time users of the project to get going.

from react-pwa.

mrtysn avatar mrtysn commented on May 22, 2024

I was able to get production build working with this setup:

"heroku-prebuild": "yarn build",
"start": "node dist/server.js",
"start-local": "cross-env NODE_ENV=development nodemon --exec babel-node --watch ./src/server.js --watch ./src/client.js --watch ./src/core --watch ./webpack ./src/server.js",
"lint": "eslint --ignore-path .gitignore src webpack",
"build": "cross-env NODE_ENV=production webpack -p --config ./webpack/prod.client.babel.js && cross-env NODE_ENV=production webpack -p --verbose --config ./webpack/prod.server.babel.js",
"test": "npm run lint && cross-env NODE_ENV=test mocha --require babel-core/register "src/**/*.test.js""

You have to rename start to something else, since it is the default script heroku runs, if no Procfile is found.

from react-pwa.

mrtysn avatar mrtysn commented on May 22, 2024

When I add additional packages via yarn (i.e. yarn add semantic-ui-react styled-components), heroku rejects the build:

Module not found: Error: Can't resolve 'semantic-ui-react' in '/tmp/build_36081507992b01d8e7e6d781af163fcf/src/app/components/header'

However, it works locally, both in development and production mode

from react-pwa.

tirthbodawala avatar tirthbodawala commented on May 22, 2024

@mrtysn We create a bundle on local when you add packages please make sure you add it to devDependencies.
yarn add semantic-ui-react --dev
This makes sure that whenever the bundle is created it has the code included in it.

When you just add without "--dev" the bundle will depend on the node_modules folder to run it completely.

What we are trying to do here is build a single server.js file already transpiled to es5 and all other bundles includes their respective dependencies.

I Hope this solves your problem

from react-pwa.

tirthbodawala avatar tirthbodawala commented on May 22, 2024

Also @mrtysn I tried the free version of Heroku but it shows the following in logs:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 2017-10-19T20:01:45.458827+00:00 heroku[web.1]: Stopping process with SIGKILL

I think its due to free version and limited memory. I am new to heroku. I just saw it after the issue was raised.

Is there a way we can build the application locally and then push the dist folder, hence running node server.js ?

from react-pwa.

mrtysn avatar mrtysn commented on May 22, 2024

Unfortunately, heroku is not designed that way. You push your code via version control (e.g. git) and the build scripts are automatically executed, as they are defined in Procfile. If a Procfile is not provided, they execute some default scripts, depending on the detected application type. In case of node.js, the start script is run.

You can define the Procfile as necessary but I don't know what could be done about the limited memory issue since the paid version also do not have much memory.

How about demonstrating an example deployment to Amazon's (AWS) EC2 service? If you were to automate such a deployment via scripts, heroku wouldn't be necessary. Using an EC2 machine also means more control on the system, hence it is more preferable.

from react-pwa.

 avatar commented on May 22, 2024

My two cents is that a boilerplate should remain independent of too much opinion lest it need to find its niche in an overcrowded field—of which this repo already has with its SEO focus IMO.

from react-pwa.

tirthbodawala avatar tirthbodawala commented on May 22, 2024

@mrtysn Dockerizing the application is already in the plan ( I am almost there with my local setup and docker )
I also know most of the good service providers like amazon ec2, google cloud, heroku
are now supporting docker deploy.
I hope anyone with bit of docker knowledge would be able to deploy it easily and scale it with docker-swarm.
I hope that would be a good solution for your deployment problem as well.

from react-pwa.

mrtysn avatar mrtysn commented on May 22, 2024

Dockerizing seems like a more robust plan than tailoring to each of these platforms one by one. However, since the only difference for any such platform would be a single short script, I wouldn't suggest completely discarding simpler deployment solutions.

from react-pwa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.