Git Product home page Git Product logo

Comments (14)

githubsaturn avatar githubsaturn commented on May 17, 2024 1

Did you make the change that i mentioned above? The issue is that Captain copies everything into a folder called src when you sent it to the server. Therefore, you will need to change COPY ./dist /usr/src/app/ to COPY ./src/dist /usr/src/app/

I have also mad some changes to READNE to make this more clear for the new users:

IMPORANT NOTE: Captain generates a dockerfile and puts it besides a directory named src where your source code sits. So if in your normal dockerfile, you have COPY ./somefile /usr/app, you will have to change it to COPY ./src/somefile /usr/app otherwise deploy would fail.

from caprover.

githubsaturn avatar githubsaturn commented on May 17, 2024 1

I literally used this captain-definition file (note how I added src to the COPY line) and it worked fine:

{
  "schemaVersion" :1 ,
  "dockerfileLines" :[
      "FROM node:8.9.2-alpine",
      "RUN mkdir -p /usr/src/app",
      "WORKDIR /usr/src/app",
      "COPY ./src/dist /usr/src/app/",
      "ENV NODE_ENV production",
      "ENV PORT 80",
      "RUN npm install http-server -g",
      "EXPOSE 80",
      "CMD [\"http-server\", \"-a\", \"0.0.0.0\", \"-p\", \"80\"]"
  ]
}

So there is no bug. It must be something to do with your project structure. My project structure is:

project-directory
   captain-definition (file)
   .git (directory)
   dist (directory)
        index.html   (a sample html file)

If you cannot get to the bottom of the problem, please send me a tarball file of your project directory. Feel free to remove files that are private. A simple plain html file in your dist directory is enough to debug the issue.

from caprover.

githubsaturn avatar githubsaturn commented on May 17, 2024

Change COPY ./dist /usr/src/app/ to COPY ./src/dist /usr/src/app/

Does it fix it?

from caprover.

jialutu avatar jialutu commented on May 17, 2024

Alright, I think the issue was due to a login problem, which required me to logout and log back in. This was found out when I tried to deploy one of the test apps. However, now I am getting this error:

Something bad happened. Cannot deploy "####"
{
"status": 1109,
"description": "COPY failed: stat /var/lib/docker/tmp/docker-builder275338123/dist: no such file or directory"
}

I can see in docker there are images created and a container that's running with the command "npm start".

from caprover.

jialutu avatar jialutu commented on May 17, 2024

Still doesn't work for me. I've just tried to deploy using the example advanced version definition file (in the same directory as package.json file), and it's still giving me the same status 1109 error. I've also tried this with a new instance using http instead (was on https with the last one).

I am using the DO docker image with node 8.9.2.

Really appreciate the help.

from caprover.

githubsaturn avatar githubsaturn commented on May 17, 2024

The other possible scenario is that your dist folder is in your gitignore file??

from caprover.

jialutu avatar jialutu commented on May 17, 2024

Right I've got it working now, you are right the issue is to do with .gitignore ignoring the dist folder. One thing you could make clearer in the instruction is that when you run 'captainduckduck deploy' with docker, you are taking the code from your git repository and not the directory you are running from.

Thanks for the help. Keep up the good work!

from caprover.

githubsaturn avatar githubsaturn commented on May 17, 2024

Good suggestion. I added this explicitly to the docs and I will also add it to deploy notes when deploying an app.

from caprover.

pedrobracho avatar pedrobracho commented on May 17, 2024

Hi good evening, im trying to convert this docker file:

version: "2"
services:
  mobileappch-api:
    build: .
    command: yarn dev -- -L
    environment:
      - NODE_ENV=development
    volumes:
      - .:/app
    ports:
      - "3000:3000"
    depends_on:
      - mongodb
  mongodb:
    image: mongo
    environment:
      - MONGO_URI=mongodb://mongodb:27017/test
    ports:
      - "27017:27017"

Into a captain-definition file but im lacking experience on this and has been taking me a lot of time and a lot of dead ends.

This is how it goes till now

 {
  "schemaVersion" :1 ,
  "dockerfileLines" :[
                        "RUN yarn dev -- -L",
                        "ENV NODE_ENV dev",
                        "ENV PORT 80",
                        "EXPOSE 80",
                        "CMD [ \"npm\", \"start\" ]"
                    ]
 }

But its incomplete and fails the deployment, any light on this tunnel?

from caprover.

githubsaturn avatar githubsaturn commented on May 17, 2024

@pedrobracho Please don't post duplicated comments. This is answered here: #113 (comment)

from caprover.

mup-devops avatar mup-devops commented on May 17, 2024

Something bad happened: cannot deploy *** at http://captain.***.rz.mup-digital.com.

404 - "<!doctype html>\n\n\n\n \n <meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" name=viewport>\n <title>Powered by CapRover</title>\n <style>\n html,\n body {\n font-family: sans-serif;\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n background-color: #F7F8FB;\n height: 100%;\n -webkit-font-smoothing: antialiased;\n }\n\n body {\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .message {\n text-align: center;\n align-self: center;\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 20px;\n max-width: 550px;\n }\n\n .message__title {\n font-size: 32px;\n font-weight: 100;\n margin-top: 15px;\n color: #47494E;\n margin-bottom: 8px;\n }\n\n .btn {\n text-decoration: none;\n padding: 11px 25px;\n border-radius: 11px;\n margin-top: 110px;\n font-size: 19px;\n color: #7F828B;\n }\n\n body.defaultpagebody {\n background: -webkit-linear-gradient(-45deg, #1d5b85 0%, #3295c7 100%);\n background: linear-gradient(135deg, #1d5b85 0%, #3295c7 100%);\n }\n\n .message__title {\n color: #fff;\n }\n\n .message {\n padding: 25px;\n color: #fff;\n }\n\n body.defaultpagebody p {\n color: rgba(255, 255, 255, 0.6);\n }\n\n body.defaultpagebody .info {\n fill: rgba(255, 255, 255, 0.9);\n }\n\n body.defaultpagebody .btn {\n color: #fff;\n border: 2px solid rgba(255, 255, 255, 0.7);\n }\n </style>\n \n\n\n\n

\n
\n Nothing here yet :/\n
\n
\n \n
\n <a href="[https://caprover.com/](https://caprover.com//)" target="_blank" rel="noopener noreferrer" class="btn">\n Read Docs\n
\n\n\n"

from caprover.

mup-devops avatar mup-devops commented on May 17, 2024

name: Build & Deploy

on:
push:
branches: [ "main" ]

pull_request:
branches: [ "main" ]

jobs:
build-and-deploy:
runs-on: ubuntu-latest

strategy:
  matrix:
    node-version: [18.x]

steps:
  - uses: actions/checkout@v3
  - name: Use Node.js ${{ matrix.node-version }}
    uses: actions/setup-node@v3
    with:
      node-version: ${{ matrix.node-version }}
      cache: "npm"
  - run: npm ci
  - run: npm run build --if-present
  - run: npm run test --if-present

  - uses: a7ul/[email protected]
    with:
      command: c
      cwd: "./"
      files: |
        backend/
        frontend/dist/
        captain-definition
      outPath: deploy.tar

  - name: Deploy App to CapRover
    uses: caprover/[email protected]
    with:
      server: '${{ secrets.CAPROVER_SERVER }}'
      app: '${{ secrets.APP_NAME }}'
      token: '${{ secrets.APP_TOKEN }}' 

from caprover.

mup-devops avatar mup-devops commented on May 17, 2024

Something bad happened: cannot deploy *** at http://captain.***.rz.mup-digital.com.

404 - "<!doctype html>\n\n\n\n \n \n <title>Powered by CapRover</title>\n <style>\n html,\n body {\n font-family: sans-serif;\n -ms-text-size-adjust: 100%;\n -webkit-text-size-adjust: 100%;\n background-color: #F7F8FB;\n height: 100%;\n -webkit-font-smoothing: antialiased;\n }\n\n body {\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n }\n\n .message {\n text-align: center;\n align-self: center;\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 20px;\n max-width: 550px;\n }\n\n .message__title {\n font-size: 32px;\n font-weight: 100;\n margin-top: 15px;\n color: #47494E;\n margin-bottom: 8px;\n }\n\n .btn {\n text-decoration: none;\n padding: 11px 25px;\n border-radius: 11px;\n margin-top: 110px;\n font-size: 19px;\n color: #7F828B;\n }\n\n body.defaultpagebody {\n background: -webkit-linear-gradient(-45deg, #1d5b85 0%, #3295c7 100%);\n background: linear-gradient(135deg, #1d5b85 0%, #3295c7 100%);\n }\n\n .message__title {\n color: #fff;\n }\n\n .message {\n padding: 25px;\n color: #fff;\n }\n\n body.defaultpagebody p {\n color: rgba(255, 255, 255, 0.6);\n }\n\n body.defaultpagebody .info {\n fill: rgba(255, 255, 255, 0.9);\n }\n\n body.defaultpagebody .btn {\n color: #fff;\n border: 2px solid rgba(255, 255, 255, 0.7);\n }\n </style>\n \n\n\n\n

\n
\n Nothing here yet :/\n
\n
\n \n
\n \n Read Docs\n
\n\n\n"

Error i got while following app setting CI CD from caprover

from caprover.

githubsaturn avatar githubsaturn commented on May 17, 2024

You have a typo in your URL: http://captain.***.rz.mup-digital.com

It says Nothing here yet. What's the exact URL that you're using?

from caprover.

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.