Closed thomasjonas closed 7 years ago
The default web process for create-react-app-buildpack is from the static-site buildpack. If Dokku requires an explicit Procfile, then it should contain:
web: bin/boot
That seemed to do the trick! Thanks so much :) Maybe it's a bug with Dokku + multiple build packs + no Procfile... I might open an issue over at Dokku later.
and we can consider this closed of course...
@thomasjonas @mars Thanks guys for the tip. It still doesn't work on my end. Do you know the solution on this? I'm just trying to deploy create react app using dokku.
Enumerating objects: 18, done. Counting objects: 100% (18/18), done. Delta compression using up to 12 threads Compressing objects: 100% (10/10), done. Writing objects: 100% (11/11), 958 bytes | 958.00 KiB/s, done. Total 11 (delta 6), reused 0 (delta 0) -----> Cleaning up... -----> Building MYAPP from herokuish... -----> Adding BUILD_ENV to build environment... -----> Fetching custom buildpack To MYIPADDRESS:APPNAME ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'dokku@MYIPADDRESS:APPNAME'
@SeunghunSunmoonLee I'm currently using a Dockerfile based deployment strategy with Dokku, but you might be able to solve the problem by doing a git push YOUR_REMOTE --force
. I noticed that I needed to --force
it sometimes. It might also be worth it to look into using a Dockerfile with Dokku as in my experience it's a bit faster.
Ah nice! @thomasjonas Could you share the tutorial for dokku Dockerfile approach for create react app production deployment?
You can find my current configuration here
I'm sure this is not the best way to do it, but it seems to work for me.
@thomasjonas When you were not using Dockerfile, how did you deploy using this buildpack?
I did //.buildpacks https://github.com/mars/create-react-app-buildpack.git
//Procfile web: bin/boot
//jsconfig.json for absolute import like import Button from 'components/Button' { "compilerOptions": { "baseUrl": "src" }, "include": ["src"] }
// static.json
{
"root": "build/",
"routes": {
"/**": "index.html"
},
"https_only": true
}
//package.json
"scripts": {
"dokku": {
"predeploy": "",
"postdeploy": ""
},
"start": "react-scripts start",
"start-dev": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"start:staging": "REACT_APP_NODE_ENV=staging npm start",
"send:translation_specification": "npm run build:translations && node scripts/sendUpdatedKeys.js",
"build:messages": "NODE_ENV=production babel ./src >/dev/null",
"build:translations": "npm run build:messages && node scripts/mergeMessages.js"
},
"eslintConfig": {
"extends": "react-app"
},
"babel": {
"presets": [
"react-app"
],
"plugins": [
[
"babel-plugin-react-intl",
{
"messagesDir": "./build/messages/",
"enforceDescriptions": false
}
]
]
},
and I get
-----> Build
Running build
> fusion-software@0.1.0 build /tmp/build
> react-scripts build
Creating an optimized production build...
Failed to compile.
./src/components/PricingCards/index.js
Cannot find module: 'assets/img/Enterprise.svg'. Make sure this package is installed.
You can install this package by running: npm install assets/img/Enterprise.svg.
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno 1
seems like you're right with jsconfig.json
/absolute imports causing problems... Without that I can just use the buildpack. I think this buildpack only supports version 2 of CRA so it probably needs updating to be used with the new version.
I understand this build pack is meant for Heroku, not Dokku. But since I found more Dokku issues here I though I might as well add another one.
The first problem I ran into was a missing Procfile (like here: https://github.com/mars/create-react-app-inner-buildpack/issues/5) which I solved by adding a completely empty Procfile. I have no idea if that's the right solution, but I would know what command to run (
npm start
? or should I add serve as a dependency and runserve -s build
?).Then I ran into a new problem:
This problem I fixed by adjusting scaling the process and worker both to 0. The logs show the application is successfully deployed but it's not running. When I run
dokku ls
it outputs the following:Hopefully anybody has an idea of where it's going wrong. I have the feeling it has something to do with the Procfile...
Full deploy/build log for completeness: