@@ -0,0 +1,48 @@
|
||||
name: deploy to danak
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
build_and_deploy:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
DANAK_SERVER: "https://captain.run.danakcorp.com"
|
||||
APP_TOKEN: 119867b248bb31cdc6a97a5eb5f4ef0754f96a898ff38cf8bf25fd0d8479fc0e
|
||||
CAPROVER_APP_NAME: arakrail
|
||||
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"
|
||||
@@ -1,6 +1,6 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### Node template
|
||||
/static/uploads
|
||||
# /static/uploads
|
||||
# Logs
|
||||
/logs
|
||||
*.log
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
FROM node:14-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=6096
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
|
||||
EXPOSE 6096
|
||||
|
||||
# Start the Nuxt 2 app
|
||||
CMD ["npm", "start"]
|
||||
@@ -1,15 +1,18 @@
|
||||
const mongoose = require('mongoose');
|
||||
// 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 db automatically.
|
||||
mongoose.connect(`mongodb://${process.env.MONGO_HOST}:27017/arakrail`, {
|
||||
const mongoose = require("mongoose");
|
||||
|
||||
mongoose.connect(
|
||||
`mongodb://${process.env.MONGO_USER}:${process.env.MONGO_PASS}@${process.env.MONGO_HOST}:27017/arakrail?authSource=admin`,
|
||||
{
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
useFindAndModify: false,
|
||||
useCreateIndex: true
|
||||
});
|
||||
useCreateIndex: true,
|
||||
}
|
||||
);
|
||||
var db = mongoose.connection;
|
||||
db.on('error', console.error.bind(console, 'connection error:'));
|
||||
db.once('open', function callback() {
|
||||
console.log("MongoDB Connected...");
|
||||
db.on("error", console.error.bind(console, "connection error:"));
|
||||
db.once("open", function callback() {
|
||||
console.log("MongoDB Connected...");
|
||||
});
|
||||
|
||||
module.exports = db
|
||||
module.exports = db;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
# app:
|
||||
# image: node:14-alpine
|
||||
# working_dir: /app
|
||||
# command: sh -c "npm i && npm rebuild node-sass && npm run build && npm run start"
|
||||
# volumes:
|
||||
# - .:/app
|
||||
# ports:
|
||||
# - "${PORT}:${PORT}"
|
||||
# depends_on:
|
||||
# - mongo
|
||||
# restart: on-failure
|
||||
|
||||
mongo:
|
||||
image: mongo:4.4.25
|
||||
networks:
|
||||
- default
|
||||
restart: always
|
||||
expose:
|
||||
- 27017
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- arakrail-data:/etc/mongo
|
||||
environment:
|
||||
# MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
|
||||
# MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS}
|
||||
MONGO_INITDB_DATABASE: arakrail
|
||||
|
||||
# mongo-express:
|
||||
# image: mongo-express
|
||||
# networks:
|
||||
# - default
|
||||
# restart: always
|
||||
# expose:
|
||||
# - 8081
|
||||
# ports:
|
||||
# - "8081:8081"
|
||||
# environment:
|
||||
# ME_CONFIG_BASICAUTH_USERNAME: ${MONGO_PANEL_USER}
|
||||
# ME_CONFIG_BASICAUTH_PASSWORD: ${MONGO_PANEL_PASS}
|
||||
# ME_CONFIG_MONGODB_ADMINUSERNAME: ${MONGO_USER}
|
||||
# ME_CONFIG_MONGODB_ADMINPASSWORD: ${MONGO_PASS}
|
||||
# ME_CONFIG_MONGODB_URL: "mongodb://${MONGO_USER}:${MONGO_PASS}@mongo:27017/"
|
||||
# depends_on:
|
||||
# - mongo
|
||||
|
||||
volumes:
|
||||
arakrail-data:
|
||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 210 KiB |
|
After Width: | Height: | Size: 120 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 294 KiB |
|
After Width: | Height: | Size: 249 KiB |
|
After Width: | Height: | Size: 437 KiB |
|
After Width: | Height: | Size: 350 KiB |
|
After Width: | Height: | Size: 55 KiB |
|
After Width: | Height: | Size: 396 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 118 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 171 KiB |
|
After Width: | Height: | Size: 237 KiB |
|
After Width: | Height: | Size: 94 KiB |
|
After Width: | Height: | Size: 262 KiB |
|
After Width: | Height: | Size: 261 KiB |
|
After Width: | Height: | Size: 301 KiB |
|
After Width: | Height: | Size: 404 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 202 KiB |
|
After Width: | Height: | Size: 248 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 235 KiB |
|
After Width: | Height: | Size: 195 KiB |
|
After Width: | Height: | Size: 207 KiB |
|
After Width: | Height: | Size: 259 KiB |
|
After Width: | Height: | Size: 232 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 258 KiB |
|
After Width: | Height: | Size: 271 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 197 KiB |
|
After Width: | Height: | Size: 300 KiB |
|
After Width: | Height: | Size: 162 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 252 KiB |
|
After Width: | Height: | Size: 398 KiB |
|
After Width: | Height: | Size: 258 KiB |
|
After Width: | Height: | Size: 300 KiB |
|
After Width: | Height: | Size: 177 KiB |
|
After Width: | Height: | Size: 311 KiB |
|
After Width: | Height: | Size: 374 KiB |
|
After Width: | Height: | Size: 175 KiB |
|
After Width: | Height: | Size: 253 KiB |
|
After Width: | Height: | Size: 253 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 250 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 267 KiB |
|
After Width: | Height: | Size: 336 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 423 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 423 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 336 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 72 KiB |