A
Alokaiβ€’16mo ago
mirza

Vue Storefront DigitalOcean Deployment

https://vuestorefront.io/blog/step-by-step-guide-deploying-vue-storefront-on-digitalocean Following your guide makes the app build and deployment steps successful on DO but actually the app does not work. App is configured to run on 0.0.0.0:8080 (all interface) but the app is listening on a random IP for each deployment. I have attached the screenshots for your reference.
Guide to Deploying Vue Storefront on DigitalOcean | Vue Storefront
This guide is intended for developers who are familiar with both Vue Storefront and DigitalOcean and are looking to set up the eCommerce application on the cloud-based hosting service.
47 Replies
skirianov
skirianovβ€’16mo ago
did you do this step? Change the following variables with the URL of your Live website with the API route. API_BASE_URL - <>/api API_SSR_BASE_URL - <>/api Save your changes. This will trigger redeployment. DO is a bit tricky and it has issues with localhost. reaplce 0.0.0.0:8080 with an actual hostname in your case clownfish-app-.... let me know how it goes
mirza
mirzaOPβ€’16mo ago
Yup I did the following VSF_NUXT_APP_PORT=8080 VSF_NUXT_APP_HOST=0.0.0.0 VSF_STORE_URL=https://0.0.0.0:8080 API_BASE_URL=https://clownfish-app-w67hw.on...../api API_SSR_BASE_URL=https://clownfish-app-w67hw.on..../api @skirianov so shall I change the VSF_NUXT_APP_HOST variable to app live url as well?
skirianov
skirianovβ€’16mo ago
hmm....afaik no. I hope they haven't changed anything again -_- Let me research a bit I know who might help @fabianclemenz - you had something similar right?
mirza
mirzaOPβ€’16mo ago
what should be the health check route? tcp or http route /healthz?
FabianClemenz
FabianClemenzβ€’16mo ago
Iβ€˜m currently on vacation but will come back to you on Monday πŸ™‚ We've set these:
FabianClemenz
FabianClemenzβ€’16mo ago
No description
FabianClemenz
FabianClemenzβ€’16mo ago
and in the nuxt.config.js:
No description
FabianClemenz
FabianClemenzβ€’16mo ago
as well as:
FabianClemenz
FabianClemenzβ€’16mo ago
No description
mirza
mirzaOPβ€’16mo ago
Hello, Thank you for your reply. What value should be set for NODE_ENV ? production? @fabianclemenz API_BASE_URL would be app liveurl/api?
skirianov
skirianovβ€’16mo ago
@mirza5339 yeah, we set 'production' for production sites
FabianClemenz
FabianClemenzβ€’16mo ago
@mirza5339 yes exactly πŸ™‚
mirza
mirzaOPβ€’16mo ago
I have tried the following but did not work VSF_NUXT_APP_PORT=3000 VSF_NUXT_APP_HOST=0.0.0.0 API_BASE_URL=https://clownfish-app-w67hw.on...../api API_SSR_BASE_URL=https://clownfish-app-w67hw.on..../api The app is built and deployed successfully but the app url does not work @fabianclemenz Can I ask you that the setup you did still work?
FabianClemenz
FabianClemenzβ€’16mo ago
you have the server stuff in your nuxt.config.js sure πŸ™‚
mirza
mirzaOPβ€’16mo ago
Yup the nuxt.config.js has the server stuff @fabianclemenz do we have to remove https from server object? where the certs paths are defined for local setup?
FabianClemenz
FabianClemenzβ€’16mo ago
nope we do have it in the API_BASE_URL included certs are provided by digitalocean directly do you have the trailing Slash ?
mirza
mirzaOPβ€’16mo ago
no for health check do you use tcp or http? if its http what route it should be?
FabianClemenz
FabianClemenzβ€’16mo ago
i didn't implement the health check myself i used App Platform, connected to our gitlab repo (so it builds itself) and just did the settings mentioned above
mirza
mirzaOPβ€’16mo ago
Yup I did the same. I think default health check is through TCP. @fabianclemenz @skirianov Removing the https config from the server object made the app work. Thank you for your help.πŸ˜€ πŸ‘
skirianov
skirianovβ€’16mo ago
Huge thanks @fabianclemenz ❀️
FabianClemenz
FabianClemenzβ€’16mo ago
ah ok you had https://0.0.0.0? @skirianov np πŸ™‚
mirza
mirzaOPβ€’16mo ago
no Do you know for the local setup we use local certs and add the https config for the server object in nuxt.config.js. Removing this https config made the app work. I was actually suspecting this as a culprit but did not remove it before.
FabianClemenz
FabianClemenzβ€’16mo ago
i c πŸ™‚ thanks for the clarification - for local setup we just use simple http πŸ™‚
mirza
mirzaOPβ€’16mo ago
The VSF docs suggest to use mkcert to install local certs for the local setup
skirianov
skirianovβ€’16mo ago
mkcert is required only if you really need it. Otherwise it's optional πŸ™‚ If it was confusing, can you please drop a link to that resource and I'll check it
mirza
mirzaOPβ€’16mo ago
Ok will send you the link, I think it does not say about mkcert or using certs as optional. I have another question. I will be developing Paypal payment method for VSF. There is an official paypal SDK available for VUE js, so I think this SDK can be used with VSF because its compaitible with VUE JS?
FabianClemenz
FabianClemenzβ€’16mo ago
I think so - i used nuxt/auth-next to provide jwt authentication with nuxt - without problems πŸ™‚
mirza
mirzaOPβ€’16mo ago
Thank you
re-mxp
re-mxpβ€’14mo ago
When I try to deploy on digital ocean I get many of the following errors:
No description
re-mxp
re-mxpβ€’14mo ago
No description
skirianov
skirianovβ€’14mo ago
@re-mxp is it building on your local machine?
re-mxp
re-mxpβ€’14mo ago
Yep
skirianov
skirianovβ€’14mo ago
@re-mxp can you please also state what is the node version your are using locally
re-mxp
re-mxpβ€’14mo ago
I made following steps: 1. Installed Vue Storefront following this guide: https://docs.vuestorefront.io/v2/getting-started/installation.html. 2. I used the package.json from following thread: https://discordapp.com/channels/770285988244750366/1152020806361170051/1152265560877437118 to make vue storefront node 18 compatible. 3. Adjusted the engines in package.json to node: 18.18.1 which is equal to my node version locally
skirianov
skirianovβ€’14mo ago
Gotcha. I don't have any instructions for that right now (in written format). I will be working on it soon. But in short, due to Node v18. You will need to run your Vue Storefront app in docker and deploy the docker image to DO
skirianov
skirianovβ€’14mo ago
DigitalOcean
How to Deploy from Container Images | DigitalOcean Documentation
Deploy an application using a container image stored in your DigitalOcean Container Registry.
skirianov
skirianovβ€’14mo ago
https://docs.docker.com/get-started/02_our_app/ - this is how to create a container of your app
Docker Documentation
Containerize an application
Follow this step-by-step guide to learn how to create and run a containerized application using Docker
re-mxp
re-mxpβ€’14mo ago
I managed to fix it without docker container and by following the overview step in the migration guide of nuxt https://nuxt.com/docs/bridge/overview
Nuxt
Overview
Reduce the differences with Nuxt 3 and reduce the burden of migration to Nuxt 3.
re-mxp
re-mxpβ€’14mo ago
But I tried to deploy it in docker and got the the same problem, so I could reproduce the problem locally, but only in the docker container. But after using Nuxt Bridge I could build it successfully locally and also in DigitalOcean without an own docker image
FabianClemenz
FabianClemenzβ€’14mo ago
This is the dockerfile we use
FROM node:18.17.1 as builder
WORKDIR /app
ARG VSF_NUXT_APP_PORT=3000
ARG API_BASE_URL
COPY . ./
RUN yarn install
RUN echo "API_BASE_URL=${API_BASE_URL}" >> ./packages/theme/.env
EXPOSE ${VSF_NUXT_APP_PORT}
FROM builder as build
RUN NODE_ENV=production yarn build
CMD yarn start
FROM build as default
FROM node:18.17.1 as builder
WORKDIR /app
ARG VSF_NUXT_APP_PORT=3000
ARG API_BASE_URL
COPY . ./
RUN yarn install
RUN echo "API_BASE_URL=${API_BASE_URL}" >> ./packages/theme/.env
EXPOSE ${VSF_NUXT_APP_PORT}
FROM builder as build
RUN NODE_ENV=production yarn build
CMD yarn start
FROM build as default
Maybe it helps πŸ™‚
re-mxp
re-mxpβ€’14mo ago
Thank you. πŸ™‚ Would you be so kind to also share your package.json?
FabianClemenz
FabianClemenzβ€’14mo ago
The main package json or the one from theme folder? (Weβ€˜re using the old custom-integration-boilerplate)
{
"name": "@vue-storefront/<our-integration>-theme",
"version": "0.0.1",
"private": true,
"engines": {
"node": "=18.17.x"
},
"scripts": {
"build": "nuxt build -m",
"build:analyze": "nuxt build -a -m",
"dev": "nuxt",
"generate": "nuxt generate",
"lint": "eslint . --ext .ts,.vue",
"lint:fix": "eslint . --ext .ts,.vue --fix",
"precommit": "lint-staged",
"start": "nuxt start",
"test": "jest",
"test:e2e": "cypress open --config-file tests/e2e/cypress.json",
"test:e2e:generate:report": "yarn -s mochawesome-merge \"tests/e2e/report/*.json\" > \"tests/e2e/report.json\" && yarn -s marge tests/e2e/report.json -o \"tests/e2e/report\"",
"test:e2e:hl": "cypress run --headless --config-file tests/e2e/cypress.json",
"update:check": "ncu",
"update:update": "ncu -u"
},
"dependencies": {
"@nuxtjs/auth-next": "5.0.0-1667386184.dfbbb54",
"@storefront-ui/vue": "0.11.4",
"@vue-storefront/<our-integration>": "0.0.1",
"@vue-storefront/middleware": "2.8.0",
"@vue-storefront/nuxt": "2.8.0",
"@vue-storefront/nuxt-theme": "2.8.0",
"bootstrap-vue": "^2.23.1",
"cookie-universal-nuxt": "^2.1.5",
"core-js": "^3.19.0",
"nuxt": "2.17.1",
"nuxt-i18n": "6.28.1",
"vuex-persist": "3.1.3",
"vuex": "3.6.2",
"vue": "2.6.14",
"vue-server-renderer": "2.6.14",
"vue-template-compiler": "2.6.14",
"vee-validate": "^3.4.13",
"vue-scrollto": "^2.20.0",
"vue-slick-carousel": "^1.0.6"
},
"devDependencies": {
"@nuxt/types": "2.17.1",
"@vue/test-utils": "^1.2.2",
"babel-jest": "^27.3.1",
"cypress": "^8.7.0",
"cypress-pipe": "^2.0.0",
"cypress-tags": "^0.3.0",
"jest": "^27.5.1",
"mochawesome": "^6.3.1",
"mochawesome-merge": "^4.2.0",
"mochawesome-report-generator": "^5.2.0",
"ts-loader": "^8.1.0",
"vue-jest": "^4.0.0-0"
}
{
"name": "@vue-storefront/<our-integration>-theme",
"version": "0.0.1",
"private": true,
"engines": {
"node": "=18.17.x"
},
"scripts": {
"build": "nuxt build -m",
"build:analyze": "nuxt build -a -m",
"dev": "nuxt",
"generate": "nuxt generate",
"lint": "eslint . --ext .ts,.vue",
"lint:fix": "eslint . --ext .ts,.vue --fix",
"precommit": "lint-staged",
"start": "nuxt start",
"test": "jest",
"test:e2e": "cypress open --config-file tests/e2e/cypress.json",
"test:e2e:generate:report": "yarn -s mochawesome-merge \"tests/e2e/report/*.json\" > \"tests/e2e/report.json\" && yarn -s marge tests/e2e/report.json -o \"tests/e2e/report\"",
"test:e2e:hl": "cypress run --headless --config-file tests/e2e/cypress.json",
"update:check": "ncu",
"update:update": "ncu -u"
},
"dependencies": {
"@nuxtjs/auth-next": "5.0.0-1667386184.dfbbb54",
"@storefront-ui/vue": "0.11.4",
"@vue-storefront/<our-integration>": "0.0.1",
"@vue-storefront/middleware": "2.8.0",
"@vue-storefront/nuxt": "2.8.0",
"@vue-storefront/nuxt-theme": "2.8.0",
"bootstrap-vue": "^2.23.1",
"cookie-universal-nuxt": "^2.1.5",
"core-js": "^3.19.0",
"nuxt": "2.17.1",
"nuxt-i18n": "6.28.1",
"vuex-persist": "3.1.3",
"vuex": "3.6.2",
"vue": "2.6.14",
"vue-server-renderer": "2.6.14",
"vue-template-compiler": "2.6.14",
"vee-validate": "^3.4.13",
"vue-scrollto": "^2.20.0",
"vue-slick-carousel": "^1.0.6"
},
"devDependencies": {
"@nuxt/types": "2.17.1",
"@vue/test-utils": "^1.2.2",
"babel-jest": "^27.3.1",
"cypress": "^8.7.0",
"cypress-pipe": "^2.0.0",
"cypress-tags": "^0.3.0",
"jest": "^27.5.1",
"mochawesome": "^6.3.1",
"mochawesome-merge": "^4.2.0",
"mochawesome-report-generator": "^5.2.0",
"ts-loader": "^8.1.0",
"vue-jest": "^4.0.0-0"
}
and our main package.json
FabianClemenz
FabianClemenzβ€’14mo ago
The build:digitalocean was previously used but not with deploying via docker i hope that helps, if not feel free to ask πŸ™‚
re-mxp
re-mxpβ€’14mo ago
Thank you very much. πŸ™‚
skirianov
skirianovβ€’14mo ago
thank you @FabianClemenz ❀️
FabianClemenz
FabianClemenzβ€’14mo ago
No problem πŸ™‚
Want results from more Discord servers?
Add your server