update: add ci cd files ==> do not edit those files

This commit is contained in:
mahyargdz
2024-10-12 13:27:43 +03:30
parent 5cc22592f5
commit 26e756b8ed
124 changed files with 15639 additions and 9227 deletions
+48
View File
@@ -0,0 +1,48 @@
name: deploy to danak
on:
push:
branches:
- master
jobs:
build_and_deploy:
runs-on: ubuntu-latest
env:
DANAK_SERVER: "https://captain.run.danakcorp.com"
APP_TOKEN: 325d1f595c7bdc85991db0306dfc997833b7351bffd2fd57663cbdf3ead53770
CAPROVER_APP_NAME: barg-restuarant
GITHUB_TOKEN: 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
steps:
- name: Check out repositorys
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: zmihamid
password: ${{ env.GITHUB_TOKEN }}
- name: Preset Image Name
run: echo "IMAGE_URL=$(echo ghcr.io/zmihamid/${{ github.event.repository.name }}:$(echo ${{ github.sha }} | cut -c1-7) | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build and push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ env.IMAGE_URL }}
- name: Install CapRover CLI
run: npm install -g caprover
- name: deploy to server
run: |
caprover deploy -a $CAPROVER_APP_NAME -u $DANAK_SERVER --appToken $APP_TOKEN -i "$IMAGE_URL"
+47
View File
@@ -0,0 +1,47 @@
FROM node:20-alpine AS base
RUN apk add --no-cache tzdata
# Set the timezone to Asia/Tehran
RUN cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && echo "Asia/Tehran" > /etc/timezone
FROM base AS deps
WORKDIR /temp-deps
COPY package*.json ./
RUN npm install
FROM base AS builder
WORKDIR /build
COPY . ./
COPY --from=deps /temp-deps/node_modules ./node_modules
RUN npm run build
RUN npm install --omit=dev
FROM base AS runner
WORKDIR /app
ENV NUXT_TELEMETRY_DISABLED=1
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
RUN chown -R appuser:appgroup /app
# COPY --from=builder --chown=appuser:appgroup /build/.nuxt ./.nuxt
# COPY --from=builder --chown=appuser:appgroup /build/static ./static
# COPY --from=builder --chown=appuser:appgroup /build/package.json ./
# COPY --from=builder --chown=appuser:appgroup /build/node_modules/ ./node_modules/
COPY --from=builder --chown=appuser:appgroup /build ./
USER appuser
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
EXPOSE 3000
# Start the Nuxt 2 app
CMD ["npm", "start"]
+142 -147
View File
@@ -1,90 +1,85 @@
const webpack = require("webpack")
const webpack = require("webpack");
// const serverPort = 9964 || process.env.PORT
const serverPort = 8959 || process.env.PORT
const fs = require('fs')
const serverPort = 8959 || process.env.PORT;
const fs = require("fs");
export default {
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: "کافه و رستوران برگ",
htmlAttrs: {
lang: "fa",
},
meta: [
{ charset: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ hid: "description", name: "description", content: "" },
{ name: "theme-color", content: "#8DC640" },
],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.png" }],
script: [
{ src: "/js/lightBox/simple-lightbox.min.js" },
{ src: "/js/socket.io.js" },
{ src: "/js/chart.min.js" },
{ src: "https://unpkg.com/wavesurfer.js" },
],
},
loading: { color: "#fff" },
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
title: 'کافه و رستوران برگ',
htmlAttrs: {
lang: 'fa'
},
meta: [
{charset: 'utf-8'},
{name: 'viewport', content: 'width=device-width, initial-scale=1'},
{hid: 'description', name: 'description', content: ''},
{name: 'theme-color', content: '#8DC640'}
],
link: [
{rel: 'icon', type: 'image/x-icon', href: '/favicon.png'}
],
script: [
{src: '/js/lightBox/simple-lightbox.min.js'},
{src: '/js/socket.io.js'},
{src: '/js/chart.min.js'},
{src: 'https://unpkg.com/wavesurfer.js'}
]
},
loading: {color: '#fff'},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
"element-ui/lib/theme-chalk/index.css",
"slick-carousel/slick/slick.css",
"slick-carousel/slick/slick-theme.css",
"~/assets/css/bootstrap-grid.css",
"~/assets/css/reset-css.css",
"~/assets/css/fontawesome/css/all.min.css",
"~/static/js/lightBox/simple-lightbox.min.css",
"~/assets/scss/main.scss",
],
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
'element-ui/lib/theme-chalk/index.css',
'slick-carousel/slick/slick.css',
'slick-carousel/slick/slick-theme.css',
'~/assets/css/bootstrap-grid.css',
'~/assets/css/reset-css.css',
'~/assets/css/fontawesome/css/all.min.css',
'~/static/js/lightBox/simple-lightbox.min.css',
'~/assets/scss/main.scss'
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
"@/plugins/element-ui",
"@/plugins/gsap.client",
"@/plugins/core-ui.client",
"@/plugins/datePicker.client",
"@/plugins/scrollMagic.client",
{ src: "@/plugins/mapir.js", ssr: false },
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
'@/plugins/element-ui',
'@/plugins/gsap.client',
'@/plugins/core-ui.client',
'@/plugins/datePicker.client',
'@/plugins/scrollMagic.client',
{src: '@/plugins/mapir.js', ssr: false}
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: ["~/components/", { path: "~/components/admin/", prefix: "" }],
// Auto import components: https://go.nuxtjs.dev/config-components
components: [
'~/components/',
{path: '~/components/admin/', prefix: ''}
],
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [],
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/axios
"@nuxtjs/axios",
"@nuxtjs/auth-next",
"@nuxtjs/firebase",
"~/modules/WebSocketServer.js",
],
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/axios
'@nuxtjs/axios',
'@nuxtjs/auth-next',
'@nuxtjs/firebase',
'~/modules/WebSocketServer.js',
],
firebase: {
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
config: {
apiKey: "AIzaSyB6PlyAxtiuc3Lr8PM5y2W8E_KxWrXDSkI",
authDomain: "barg-336706.firebaseapp.com",
projectId: "barg-336706",
storageBucket: "barg-336706.appspot.com",
messagingSenderId: "889370893165",
appId: "1:889370893165:web:198f891c6c49fc13a09864",
measurementId: "G-C91HQP1H4V"
},
services: {
messaging: {
createServiceWorker: true,
fcmPublicVapidKey: 'BASl8F_cCRHQWCpI_VePGRuv6G3zarylKv0wDdJOUH-IntZl90jznyHGWL6fuCNbm8yHnCFzNrIagvDWoDMaG2M',
inject: `self.addEventListener('push', function (e) {
firebase: {
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
config: {
apiKey: "AIzaSyB6PlyAxtiuc3Lr8PM5y2W8E_KxWrXDSkI",
authDomain: "barg-336706.firebaseapp.com",
projectId: "barg-336706",
storageBucket: "barg-336706.appspot.com",
messagingSenderId: "889370893165",
appId: "1:889370893165:web:198f891c6c49fc13a09864",
measurementId: "G-C91HQP1H4V",
},
services: {
messaging: {
createServiceWorker: true,
fcmPublicVapidKey:
"BASl8F_cCRHQWCpI_VePGRuv6G3zarylKv0wDdJOUH-IntZl90jznyHGWL6fuCNbm8yHnCFzNrIagvDWoDMaG2M",
inject: `self.addEventListener('push', function (e) {
console.log('test*******************************')
data = e.data.json();
var options = {
@@ -101,73 +96,73 @@ export default {
);
});
`,
}
}
},
},
},
},
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {
proxy: true
},
proxy: {
'/api': {target: `http://0.0.0.0:${serverPort}`}
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
extend(config, ctx) {
config.module.rules.push({
test: /\.(ogg|mp3|wav|mpe?g)$/i,
loader: 'file-loader',
options: {
name: '[path][name].[ext]'
}
})
},
babel: {
plugins: [
['@babel/plugin-proposal-private-methods', {loose: true}],
["@babel/plugin-proposal-private-property-in-object", {"loose": true}]
]
},
transpile: [/^element-ui/],
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
],
splitChunks: {
layouts: true
},
},
router: {
linkActiveClass: 'active-link',
middleware: ['redirects']
},
serverMiddleware: ['~/server/index.js'],
server: {
host: '0.0.0.0',
port: serverPort
},
auth: {
strategies: {
local: {
token: {
property: 'token',
required: true,
type: ''
},
user: {
property: 'user',
autoFetch: true
},
endpoints: {
login: {url: '/api/auth/login', method: 'post'},
logout: {url: '/api/auth/logout', method: 'delete'},
user: {url: '/api/auth/user', method: 'get'}
}
}
}
}
}
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {
proxy: true,
},
proxy: {
"/api": { target: `http://0.0.0.0:${serverPort}` },
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
extend(config, ctx) {
config.module.rules.push({
test: /\.(ogg|mp3|wav|mpe?g)$/i,
loader: "file-loader",
options: {
name: "[path][name].[ext]",
},
});
},
babel: {
plugins: [
["@babel/plugin-proposal-private-methods", { loose: true }],
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
],
},
transpile: [/^element-ui/],
plugins: [
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
}),
],
splitChunks: {
layouts: true,
},
},
router: {
linkActiveClass: "active-link",
middleware: ["redirects"],
},
serverMiddleware: ["~/server/index.js"],
server: {
host: "0.0.0.0",
port: 3000,
},
auth: {
strategies: {
local: {
token: {
property: "token",
required: true,
type: "",
},
user: {
property: "user",
autoFetch: true,
},
endpoints: {
login: { url: "/api/auth/login", method: "post" },
logout: { url: "/api/auth/logout", method: "delete" },
user: { url: "/api/auth/user", method: "get" },
},
},
},
},
};
+13145 -7172
View File
File diff suppressed because it is too large Load Diff
+28 -26
View File
@@ -1,26 +1,29 @@
const mongoose = require('mongoose')
const mongoose = require("mongoose");
mongoose.plugin(schema => {
schema.set('toObject', {
getters: true
})
schema.set('toJSON', {
getters: true
})
schema.set('timestamps', {
createdAt: 'created_at',
updatedAt: 'updated_at'
})
})
mongoose.plugin((schema) => {
schema.set("toObject", {
getters: true,
});
schema.set("toJSON", {
getters: true,
});
schema.set("timestamps", {
createdAt: "created_at",
updatedAt: "updated_at",
});
});
// mongodb database connection string. change it as per your needs. here "mydb" is the name of the database. You don't need to create DB from mongodb terminal. mongoose create the database automatically.
// mongoose.connect('mongodb://localhost:27017/bargrest_barg', {
mongoose.connect('mongodb://bargrest_bargtest:barg123456@bargrestaurant.com:27017/bargrest_bargtest', {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true
})
mongoose.connect(
"mongodb://root:asrerb6udsf13sdfb6@srv-captain--danak-mongo-2:27017/bargrest_bargtest?authSource=admin",
{
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true,
}
);
//
// mongoose.connect('mongodb://bargrest_admin:barg1234@localhost:27017/bargrest_barg', {
// useNewUrlParser: true,
@@ -29,7 +32,6 @@ mongoose.connect('mongodb://bargrest_bargtest:barg123456@bargrestaurant.com:2701
// useCreateIndex: true
// })
/*mongoose.connect('mongodb://barg_database:D7pAAqDWxx4ZpgnC@cluster0-shard-00-00.dle1t.mongodb.net:27017,cluster0-shard-00-01.dle1t.mongodb.net:27017,cluster0-shard-00-02.dle1t.mongodb.net:27017/barg?ssl=true&replicaSet=atlas-zj3m2c-shard-0&authSource=admin&retryWrites=true&w=majority', {
useNewUrlParser: true,
useUnifiedTopology: true,
@@ -43,10 +45,10 @@ mongoose.connect('mongodb://bargrest_bargtest:barg123456@bargrestaurant.com:2701
// useCreateIndex: true
// })
const database = mongoose.connection
database.on('error', console.error.bind(console, 'connection error:'))
database.once('open', function callback() {
console.log("MongoDB Connected...")
})
const database = mongoose.connection;
database.on("error", console.error.bind(console, "connection error:"));
database.once("open", function callback() {
console.log("MongoDB Connected...");
});
module.exports = database
module.exports = database;
Binary file not shown.
Binary file not shown.
+4 -3
View File
@@ -1,8 +1,9 @@
importScripts(
'https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js'
'https://www.gstatic.com/firebasejs/8.10.0/firebase-app.js'
)
importScripts(
'https://www.gstatic.com/firebasejs/8.10.1/firebase-messaging.js'
'https://www.gstatic.com/firebasejs/8.10.0/firebase-messaging.js'
)
firebase.initializeApp({"apiKey":"AIzaSyB6PlyAxtiuc3Lr8PM5y2W8E_KxWrXDSkI","authDomain":"barg-336706.firebaseapp.com","projectId":"barg-336706","storageBucket":"barg-336706.appspot.com","messagingSenderId":"889370893165","appId":"1:889370893165:web:198f891c6c49fc13a09864","measurementId":"G-C91HQP1H4V"})
@@ -15,7 +16,7 @@ self.addEventListener('push', function (e) {
data = e.data.json();
var options = {
body: data.notification.body,
icon: '/favicon.png',
icon: data.notification.icon,
vibrate: [100, 50, 100],
data: {
dateOfArrival: Date.now(),
Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Some files were not shown because too many files have changed in this diff Show More