Solved

Deploy my Shopify App on a Ubuntu VPS - Ubuntu 22.10 (GNU/Linux 5.19.0-23-generic x86_64) / Hosted

ntkhiem
Shopify Partner
9 2 6

Dear @here,

 

I was about to deploy my first Shopify app on a Ubuntu VPS - Ubuntu 22.10 (GNU/Linux 5.19.0-23-generic x86_64) / Hosted.

 

I did follow this link: How to Deploy Node.js Shopify Apps to Digital Ocean 

 

Everything has seemed to be fine until I tried to this step - test to run directly with NodeJs:

 

 

PORT=8080 npm run start

 

I got this error message:

 

npm ERR! Missing script: "start"
npm ERR! 
npm ERR! Did you mean one of these?
npm ERR!     npm star # Mark your favorite packages
npm ERR!     npm stars # View packages marked as favorites
npm ERR! 
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-04-06T02_36_37_317Z-debug-0.log

During the development time, I only knew "yarn dev" or "npm run dev" to test with ngrok.io

 

I am very confused about this. How to start the production version on the real server? Please help me.

 

Other cases:

 

  1. Run "yarn build" on the root account, I got this error message:
    ╭─ success ──────────────────────────────────────────────────────────────────────╮
    │                                                                                │
    │  product-designer built!                                                       │
    │                                                                                │
    ╰────────────────────────────────────────────────────────────────────────────────╯
    /root/product-designer/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
            throw ex;
            ^
    
    ExternalError: Command was killed with SIGKILL (Forced termination): bundle install
    Don't run Bundler as root. Installing your bundle as root will break this
    application for all non-root users on this machine.
    Fetching gem metadata from https://rubygems.org/........
        at makeError (file:///root/product-designer/node_modules/execa/lib/error.js:59:11)
        at handlePromise (file:///root/product-designer/node_modules/execa/index.js:119:26)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        at async Module.exec (file:///root/product-designer/node_modules/@shopify/cli-kit/dist/system.js:32:9)
        at async bundleInstallThemeCheck (file:///root/product-designer/node_modules/@shopify/cli-kit/dist/public/node/ruby.js:196:5)
        at async Task.task (file:///root/product-designer/node_modules/@shopify/cli-kit/dist/public/node/ruby.js:101:17)
        at async Task.run (file:///root/product-designer/node_modules/listr2/dist/index.js:960:11)
        at async /root/product-designer/node_modules/p-map/index.js:57:22 {
      tryMessage: null,
      type: 0,
      command: 'bundle',
      args: [ 'install' ]
    }
    
    Node.js v18.7.0
    error Command failed with exit code 7.
    How can I solve it?
  2. When running "yarn deploy", it tries to launch a web browser to authenticate, which is impossible on an Ubuntu command line (I accessed with SSH).

This is my first time trying to deploy Shopify with the Theme App Extension. Please give me some advice to get through this situation.

 

Thank y'all a thousand times! 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

Accepted Solution (1)
ntkhiem
Shopify Partner
9 2 6

This is an accepted solution.

For those who are having the same problems with me.

 

You know, I've heard that there was a guy who has given up after 3 weeks trying to deploy the app.

And, after spending 3 days of paint, I felt it, too.

 

Now this is is the solution, the best solution, I promise.

 

Back to the time I've been facing with:

 

- At the first time, I try to deploy the app to Digital Ocean as an App. I've chosen NodeJs.... when I follow the link above, because my app is using Theme App Extension, so it need ruby to build. Unfortunately, the default ruby version is 2.x on the Digital Ocean App platform. And through their document, they asked me to create a new Gemfile to config the desired ruby version ==> no luck. Because, the Shopify CLI will generate Gemfile and Gemfile.lock during the building time. That support guy from the Digital Ocean always ask me to put the Gemfile & Gemfile.lock manually. He did not understand this situation. No way to use another ruby version.

 

- Then, I decide to create an Ubuntu VPS manually. I have to re-install the 3.x ruby. And no luck, too. Could not run build, and I was stuck at the ruby issue, too.

 

- Finally, I found render.com. I I've noticed back that the shopify app framework has the Docker file, that thing do the script execution on the server, instead of doing it manually.

 

So, my dream came true. 

 

Here is the solution: Use Docker to deploy the app. It makes your life easier!

 

How:

 

  1. Go to render.com to create a Web Service app. Choose the template is Docker.
    Screen Shot 2023-04-11 at 12.47.17 PM.png

     

  2. Connect to the git source, you can set auto build.
  3. Create 4 environment variables like this: 
    Screen Shot 2023-04-11 at 12.49.03 PM.png

    That's it and everything will be run properly! 

 

 

View solution in original post

Replies 6 (6)

devmomo2016
Shopify Partner
2 0 0

I had same issue, i ran npm install inside the folder after cloning the github repository and then everything worked as usual

 

ntkhiem
Shopify Partner
9 2 6

Screen Shot 2023-04-10 at 12.05.17 PM.png

Still the same, bro 😞

ntkhiem
Shopify Partner
9 2 6

This is an accepted solution.

For those who are having the same problems with me.

 

You know, I've heard that there was a guy who has given up after 3 weeks trying to deploy the app.

And, after spending 3 days of paint, I felt it, too.

 

Now this is is the solution, the best solution, I promise.

 

Back to the time I've been facing with:

 

- At the first time, I try to deploy the app to Digital Ocean as an App. I've chosen NodeJs.... when I follow the link above, because my app is using Theme App Extension, so it need ruby to build. Unfortunately, the default ruby version is 2.x on the Digital Ocean App platform. And through their document, they asked me to create a new Gemfile to config the desired ruby version ==> no luck. Because, the Shopify CLI will generate Gemfile and Gemfile.lock during the building time. That support guy from the Digital Ocean always ask me to put the Gemfile & Gemfile.lock manually. He did not understand this situation. No way to use another ruby version.

 

- Then, I decide to create an Ubuntu VPS manually. I have to re-install the 3.x ruby. And no luck, too. Could not run build, and I was stuck at the ruby issue, too.

 

- Finally, I found render.com. I I've noticed back that the shopify app framework has the Docker file, that thing do the script execution on the server, instead of doing it manually.

 

So, my dream came true. 

 

Here is the solution: Use Docker to deploy the app. It makes your life easier!

 

How:

 

  1. Go to render.com to create a Web Service app. Choose the template is Docker.
    Screen Shot 2023-04-11 at 12.47.17 PM.png

     

  2. Connect to the git source, you can set auto build.
  3. Create 4 environment variables like this: 
    Screen Shot 2023-04-11 at 12.49.03 PM.png

    That's it and everything will be run properly! 

 

 

Deep0617
Shopify Partner
28 0 6

@ntkhiem I created a Shopify app using a php template and deploy it in a digital ocean app platform.

but some routes or APIs of the app does not work still loading, app speed performance is very low, I contact digital ocean support team but that guy not understand my issue and not slow, so can you know what can i do.

Can you provide more information about render.com

ntkhiem
Shopify Partner
9 2 6

 

Firstly, I would like to say: as per the Shopify document: https://shopify.dev/docs/apps/deployment/web - How can I deploy an app using Fly.io? Maybe it is another solution.

Back to your question:

If you are using PHP, I'm not sure if you created your app using the Shopify CLI to generate it, or if you created it manually.

In my case, I have used the Shopify CLI (3.x) to generate the app with the Node.js framework. I have experienced the pain of using Digital Ocean and the frustration with the support staff. He was very basic and straightforward, and unable to help.

He always asked me to create the Gemfile to let the system choose the specific Ruby version, but the Shopify Node framework always creates the Gemfile itself (thus overriding anything I make) using the current version of Ruby on the current system. (I have to open the source code of the Shopify CLI to check ). Render.com is a simple Shopify app that uses Node and Docker. I have no idea about yours, PHP.

I'm very happy that it's free to test for the first time, too! Just create a new account, create your new web app, and connect it to a Git source. It has the feature "auto build" which means that anytime you push new changes to your repository, it will build automatically. And, all you need to do is configure the environment as I mentioned before.You don't have to configure Nginx, SSL, NAT, DNS, etc. – just code and run!

 

sbhshchnd
Visitor
1 0 0

[shopify-app/ERROR] ensureInstalledOnShop did not receive a shop query argument | {shop: undefined}


I am getting these error, can you please help?