mirror of
https://github.com/fleetbase/fleetbase.git
synced 2025-12-26 17:17:11 +00:00
Compare commits
3 Commits
v0.7.19
...
feature/so
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
435552f332 | ||
|
|
e0615c5a9b | ||
|
|
a830e190fa |
@@ -14,7 +14,6 @@ concourse/
|
||||
infra/*
|
||||
vagrant/*
|
||||
docker/Dockerfile
|
||||
docker/database/
|
||||
deploy/*
|
||||
media/*
|
||||
data/*
|
||||
@@ -24,4 +23,4 @@ docker-compose-prod.yml
|
||||
docker-compose.yml
|
||||
$virtualenv.tar.gz
|
||||
$node_modules.tar.gz
|
||||
docker-compose.override.yml
|
||||
docker-compose.override.yml
|
||||
64
.github/workflows/build-binaries.yml
vendored
64
.github/workflows/build-binaries.yml
vendored
@@ -1,64 +0,0 @@
|
||||
name: Build Fleetbase Binaries
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: ["Create Release"]
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
DIST_DIR: builds/dist
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build-linux:
|
||||
name: Linux Build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Build Linux binary
|
||||
run: |
|
||||
chmod +x ./builds/linux/build-linux.sh
|
||||
./builds/linux/build-linux.sh
|
||||
- name: Upload Linux binary
|
||||
if: github.event_name == 'workflow_run'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.workflow_run.head_branch }}
|
||||
files: |
|
||||
${{ env.DIST_DIR }}/fleetbase-linux-x86_64
|
||||
draft: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
build-macos:
|
||||
name: macOS (ARM64) Build
|
||||
needs: build-linux
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
brew update
|
||||
brew install autoconf automake coreutils asdf php@8.4
|
||||
source "$(brew --prefix asdf)/libexec/asdf.sh"
|
||||
asdf plugin add php https://github.com/asdf-community/asdf-php.git
|
||||
- name: Build macOS binary
|
||||
run: |
|
||||
chmod +x ./builds/osx/build-osx.sh
|
||||
./builds/osx/build-osx.sh
|
||||
- name: Upload Linux binary
|
||||
if: github.event_name == 'workflow_run'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.workflow_run.head_branch }}
|
||||
files: |
|
||||
${{ env.DIST_DIR }}/fleetbase-darwin-arm64
|
||||
draft: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
268
.github/workflows/cd.yml
vendored
268
.github/workflows/cd.yml
vendored
@@ -2,15 +2,14 @@ name: Fleetbase CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["deploy/*"]
|
||||
branches: [ "deploy/*" ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
group: ${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PROJECT: ${{ secrets.PROJECT }}
|
||||
GITHUB_AUTH_KEY: ${{ secrets._GITHUB_AUTH_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build_service:
|
||||
@@ -18,105 +17,63 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write # This is required for requesting the JWT
|
||||
contents: read # This is required for actions/checkout
|
||||
contents: read # This is required for actions/checkout
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Set Dynamic ENV Vars
|
||||
run: |
|
||||
- name: Set Dynamic ENV Vars
|
||||
run: |
|
||||
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
|
||||
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
|
||||
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
|
||||
role-session-name: github
|
||||
aws-region: ${{ secrets.AWS_REGION }}
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
|
||||
role-session-name: github
|
||||
aws-region: ${{ secrets.AWS_REGION }}
|
||||
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
|
||||
- name: Build and Release
|
||||
uses: docker/bake-action@v2
|
||||
env:
|
||||
REGISTRY: ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}-${{ env.STACK }}
|
||||
VERSION: ${{ env.VERSION }}
|
||||
GITHUB_AUTH_KEY: ${{ env.GITHUB_AUTH_KEY }}
|
||||
CACHE: type=gha
|
||||
with:
|
||||
push: true
|
||||
files: |
|
||||
./docker-bake.hcl
|
||||
- name: Prepare Composer Auth Secret
|
||||
run: |
|
||||
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
|
||||
echo '{"github-oauth": {"github.com": "'${{ secrets._GITHUB_AUTH_TOKEN }}'"}}' > composer-auth.json
|
||||
else
|
||||
echo '{}' > composer-auth.json
|
||||
fi
|
||||
|
||||
- name: Resolve ECS Targets
|
||||
run: |
|
||||
set -euo pipefail
|
||||
- name: Build and Release
|
||||
uses: docker/bake-action@v2
|
||||
env:
|
||||
REGISTRY: ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}-${{ env.STACK }}
|
||||
VERSION: ${{ env.VERSION }}
|
||||
CACHE: type=gha
|
||||
with:
|
||||
push: true
|
||||
files: |
|
||||
./docker-bake.hcl
|
||||
|
||||
# Detect naming scheme by checking if new cluster exists
|
||||
NEW_CLUSTER="${PROJECT}-${STACK}-cluster"
|
||||
if aws ecs describe-clusters --region "${AWS_REGION}" --clusters "${NEW_CLUSTER}" \
|
||||
--query "clusters[?status=='ACTIVE'].clusterArn" --output text 2>/dev/null | grep -q .; then
|
||||
# New scheme: use cluster suffix and service prefixes
|
||||
CLUSTER="${NEW_CLUSTER}"
|
||||
SERVICE_PREFIX="${PROJECT}-${STACK}-"
|
||||
SERVICE_BASE="api"
|
||||
else
|
||||
# Legacy scheme: no suffixes/prefixes
|
||||
CLUSTER="${PROJECT}-${STACK}"
|
||||
SERVICE_PREFIX=""
|
||||
SERVICE_BASE="app"
|
||||
fi
|
||||
|
||||
# Build service names
|
||||
API_SERVICE="${SERVICE_PREFIX}${SERVICE_BASE}"
|
||||
SCHEDULER_SERVICE="${SERVICE_PREFIX}scheduler"
|
||||
EVENTS_SERVICE="${SERVICE_PREFIX}events"
|
||||
TASK_DEF="${PROJECT}-${STACK}-${SERVICE_BASE}"
|
||||
|
||||
# Get container name from task definition
|
||||
CONTAINER_NAME="$(aws ecs describe-task-definition --task-definition "$TASK_DEF" \
|
||||
--query 'taskDefinition.containerDefinitions[0].name' --output text 2>/dev/null || echo "$SERVICE_BASE")"
|
||||
|
||||
{
|
||||
echo "CLUSTER=$CLUSTER"
|
||||
echo "API_SERVICE=$API_SERVICE"
|
||||
echo "SCHEDULER_SERVICE=$SCHEDULER_SERVICE"
|
||||
echo "EVENTS_SERVICE=$EVENTS_SERVICE"
|
||||
echo "TASK_DEF=$TASK_DEF"
|
||||
echo "CONTAINER_NAME=$CONTAINER_NAME"
|
||||
} >> "$GITHUB_ENV"
|
||||
- name: Download ecs-tool
|
||||
run: |
|
||||
- name: Download ecs-tool
|
||||
run: |
|
||||
wget -O ecs-tool.tar.gz https://github.com/springload/ecs-tool/releases/download/1.9.6/ecs-tool_1.9.6_linux_amd64.tar.gz && tar -xvf ecs-tool.tar.gz ecs-tool
|
||||
|
||||
- name: Deploy the images 🚀
|
||||
run: |-
|
||||
|
||||
- name: Deploy the images 🚀
|
||||
run: |-
|
||||
set -eu
|
||||
|
||||
# Run deploy.sh script before deployments
|
||||
env "ECS_RUN.SERVICE=${API_SERVICE}" "ECS_RUN.LAUNCH_TYPE=FARGATE" \
|
||||
./ecs-tool run -l "ecs-tool" \
|
||||
--image_tag '{container_name}-${{ env.VERSION }}' \
|
||||
--cluster "${CLUSTER}" \
|
||||
--task_definition "${TASK_DEF}" \
|
||||
--container_name "${CONTAINER_NAME}" \
|
||||
./deploy.sh
|
||||
|
||||
# Deploy services
|
||||
./ecs-tool deploy \
|
||||
--image_tag '{container_name}-${{ env.VERSION }}' \
|
||||
--cluster "${CLUSTER}" \
|
||||
-s "${API_SERVICE}" -s "${SCHEDULER_SERVICE}" -s "${EVENTS_SERVICE}"
|
||||
# run deploy.sh script before deployments
|
||||
env "ECS_RUN.SERVICE=app" "ECS_RUN.LAUNCH_TYPE=FARGATE" ./ecs-tool run -l "ecs-tool" --image_tag '{container_name}-${{ env.VERSION }}' --cluster ${{ env.PROJECT }}-${{ env.STACK }} --task_definition ${{ env.PROJECT }}-${{ env.STACK }}-app --container_name app ./deploy.sh
|
||||
./ecs-tool deploy --image_tag '{container_name}-${{ env.VERSION }}' --cluster ${{ env.PROJECT }}-${{ env.STACK }} -s app -s scheduler -s events
|
||||
|
||||
build_frontend:
|
||||
name: Build and Deploy the Console
|
||||
@@ -124,29 +81,29 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write # This is required for requesting the JWT
|
||||
contents: read # This is required for actions/checkout
|
||||
contents: read # This is required for actions/checkout
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set Dynamic ENV Vars
|
||||
run: |
|
||||
- name: Set Dynamic ENV Vars
|
||||
run: |
|
||||
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
|
||||
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
|
||||
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v2
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
|
||||
role-session-name: github
|
||||
aws-region: ${{ secrets.AWS_REGION }}
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v2
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/${{ env.PROJECT }}-${{ env.STACK }}-deployer
|
||||
role-session-name: github
|
||||
aws-region: ${{ secrets.AWS_REGION }}
|
||||
|
||||
- name: Get infra-provided configuration
|
||||
run: |
|
||||
- name: Get infra-provided configuration
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
wget -O- https://github.com/springload/ssm-parent/releases/download/1.8.0/ssm-parent_1.8.0_linux_amd64.tar.gz | tar xvzf - ssm-parent
|
||||
@@ -155,80 +112,55 @@ jobs:
|
||||
# remove double quotes and pipe into the env
|
||||
cat /tmp/dotenv.file | sed -e 's/"//g' >> $GITHUB_ENV
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
name: Install pnpm
|
||||
id: pnpm-install
|
||||
with:
|
||||
version: 9.5.0
|
||||
run_install: false
|
||||
- uses: pnpm/action-setup@v2
|
||||
name: Install pnpm
|
||||
id: pnpm-install
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm Store Directory
|
||||
id: pnpm-cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
- name: Get pnpm Store Directory
|
||||
id: pnpm-cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm Cache
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm Cache
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Create and Setup .npmrc
|
||||
run: |
|
||||
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" > .npmrc
|
||||
fi
|
||||
if [[ -n "${{ secrets.FLEETBASE_REGISTRY_TOKEN }}" ]]; then
|
||||
echo "//registry.fleetbase.io/:_authToken=${{ secrets.FLEETBASE_REGISTRY_TOKEN }}" >> .npmrc
|
||||
echo "@fleetbase:registry=https://registry.fleetbase.io" >> .npmrc
|
||||
fi
|
||||
working-directory: ./console
|
||||
- name: Check for _GITHUB_AUTH_TOKEN and create .npmrc
|
||||
run: |
|
||||
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" > .npmrc
|
||||
fi
|
||||
working-directory: ./console
|
||||
|
||||
- name: Set Env Variables for QA
|
||||
if: startsWith(github.ref, 'refs/heads/deploy/qa')
|
||||
run: |
|
||||
echo "STRIPE_KEY=${{ secrets.STRIPE_TEST_KEY }}" >> ./environments/.env.production
|
||||
echo "LOGROCKET_APP_ID=${{ secrets.LOGROCKET_APP_ID }}" >> ./environments/.env.production
|
||||
echo "EXTENSIONS=@fleetbase/billing-engine,@fleetbase/internals-engine" >> ./environments/.env.production
|
||||
working-directory: ./console
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
working-directory: ./console
|
||||
|
||||
- name: Set Env Variables for Production
|
||||
if: startsWith(github.ref, 'refs/heads/deploy/production')
|
||||
run: |
|
||||
echo "STRIPE_KEY=${{ secrets.STRIPE_KEY }}" >> ./environments/.env.production
|
||||
echo "LOGROCKET_APP_ID=${{ secrets.LOGROCKET_APP_ID }}" >> ./environments/.env.production
|
||||
echo "EXTENSIONS=@fleetbase/billing-engine,@fleetbase/internals-engine" >> ./environments/.env.production
|
||||
working-directory: ./console
|
||||
- name: Build
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
working-directory: ./console
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
pnpm build --environment production
|
||||
working-directory: ./console
|
||||
|
||||
- name: Deploy Console 🚀
|
||||
run: |
|
||||
pnpm build
|
||||
working-directory: ./console
|
||||
|
||||
- name: Deploy Console 🚀
|
||||
run: |
|
||||
set -u
|
||||
|
||||
DEPLOY_BUCKET=${STATIC_DEPLOY_BUCKET:-${{ env.PROJECT }}-${{ env.STACK }}}
|
||||
NEW_BUCKET="${PROJECT}-${STACK}-console"
|
||||
if aws s3api head-bucket --bucket "$NEW_BUCKET" 2>/dev/null; then
|
||||
DEPLOY_BUCKET="$NEW_BUCKET"
|
||||
fi
|
||||
|
||||
# this value will come from the dotenv above
|
||||
echo "Deploying to $DEPLOY_BUCKET"
|
||||
wget -O- https://github.com/bep/s3deploy/releases/download/v2.11.0/s3deploy_2.11.0_linux-amd64.tar.gz | tar xzv -f - s3deploy
|
||||
|
||||
21
.github/workflows/create-release.yml
vendored
21
.github/workflows/create-release.yml
vendored
@@ -1,21 +0,0 @@
|
||||
name: Create Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
create:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Publish GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: ${{ github.ref_name }}
|
||||
body_path: RELEASE.md
|
||||
draft: false
|
||||
prerelease: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
61
.github/workflows/discord-announcement.yml
vendored
61
.github/workflows/discord-announcement.yml
vendored
@@ -1,61 +0,0 @@
|
||||
name: Discord Announcement
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Create Release"]
|
||||
types: [completed]
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Release tag to announce (e.g. v0.7.1)"
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
discord_announcement:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# 1️⃣ Figure out which tag we’re talking about
|
||||
- id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||
TAG="${{ github.event.inputs.tag }}"
|
||||
else
|
||||
TAG="${{ github.event.workflow_run.head_branch }}"
|
||||
fi
|
||||
echo "TAG=$TAG" >> "$GITHUB_ENV"
|
||||
|
||||
# 2️⃣ Check out the exact commit for that tag
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ env.TAG }}
|
||||
fetch-depth: 1
|
||||
|
||||
# 3️⃣ Stash RELEASE.md in an env var (one atomic write → no EOF error)
|
||||
- id: prep-body
|
||||
shell: bash
|
||||
run: |
|
||||
body=$(<RELEASE.md)
|
||||
max=4000
|
||||
[[ ${#body} -gt $max ]] && body="${body:0:$max}…" # add ellipsis if trimmed
|
||||
{
|
||||
echo "body<<EOF"
|
||||
echo "$body"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
# 4️⃣ Fire the webhook
|
||||
- uses: tsickert/discord-webhook@v5.3.0
|
||||
with:
|
||||
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
username: Fleetbase
|
||||
content: |
|
||||
@everyone
|
||||
📦 **Fleetbase ${{ env.TAG }} released!**
|
||||
<https://github.com/${{ github.repository }}/releases/tag/${{ env.TAG }}>
|
||||
embed-title: "Fleetbase ${{ env.TAG }} — release notes"
|
||||
embed-url: "https://github.com/fleetbase/fleetbase/releases/tag/${{ env.TAG }}"
|
||||
embed-description: ${{ steps.prep-body.outputs.body }}
|
||||
embed-color: 4362730 # 0x4291EA (Fleetbase Blue)
|
||||
48
.github/workflows/discord_announcement.yml
vendored
Normal file
48
.github/workflows/discord_announcement.yml
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Discord Announcement
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
discord_announcement:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get tag message
|
||||
id: tag
|
||||
run: |
|
||||
echo "::set-output name=version::$(git describe --tags --abbrev=0)"
|
||||
if [[ "${ACT}" == "true" ]]; then
|
||||
# If running with act, use an environment variable for the tag message
|
||||
echo "::set-output name=message::$(echo -e "${TAG_MESSAGE}" | base64)"
|
||||
else
|
||||
# If running on GitHub, use git to get the tag message
|
||||
echo "::set-output name=message::$(git tag -l --format='%(contents)' $(git describe --tags --abbrev=0) | base64)"
|
||||
fi
|
||||
|
||||
- name: Print tag message
|
||||
run: echo "${{ steps.tag.outputs.message }}"
|
||||
|
||||
- name: Get tag name
|
||||
id: get_tag
|
||||
run: echo "::set-output name=tag::${GITHUB_REF/refs\/tags\//}"
|
||||
|
||||
- name: Decode message
|
||||
id: decode
|
||||
run: |
|
||||
echo "Decoding message..."
|
||||
echo "::set-output name=message::$(echo '${{ steps.tag.outputs.message }}' | base64 --decode)"
|
||||
|
||||
- name: Send message to Discord
|
||||
uses: tsickert/discord-webhook@v5.3.0
|
||||
with:
|
||||
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
content: "@everyone \n📦 New Fleetbase Version ${{ steps.get_tag.outputs.tag }} Released!\n${{ steps.decode.outputs.message }} \nVersion: ${{ steps.get_tag.outputs.tag }} \n[Release Notes for ${{ steps.get_tag.outputs.tag }}](https://github.com/fleetbase/fleetbase/releases/tag/${{ steps.get_tag.outputs.tag }})"
|
||||
username: Fleetbase
|
||||
170
.github/workflows/eks-cd.yml
vendored
170
.github/workflows/eks-cd.yml
vendored
@@ -1,170 +0,0 @@
|
||||
name: Fleetbase EKS CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["eksdeploy/*"]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PROJECT: ${{ secrets.PROJECT }}
|
||||
GITHUB_AUTH_KEY: ${{ secrets._GITHUB_AUTH_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build_service:
|
||||
name: Build and Deploy the Service
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write # This is required for requesting the JWT
|
||||
contents: read # This is required for actions/checkout
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Set Dynamic ENV Vars
|
||||
run: |
|
||||
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
|
||||
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
|
||||
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v4
|
||||
with:
|
||||
role-to-assume: ${{ secrets.EKS_DEPLOYER_ROLE }}
|
||||
role-session-name: github
|
||||
aws-region: ${{ secrets.AWS_REGION }}
|
||||
|
||||
- name: Login to Amazon ECR
|
||||
id: login-ecr
|
||||
uses: aws-actions/amazon-ecr-login@v1
|
||||
|
||||
- name: Build and Release
|
||||
uses: docker/bake-action@v2
|
||||
env:
|
||||
REGISTRY: ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}-${{ env.STACK }}
|
||||
VERSION: ${{ env.VERSION }}
|
||||
GITHUB_AUTH_KEY: ${{ env.GITHUB_AUTH_KEY }}
|
||||
CACHE: type=gha
|
||||
with:
|
||||
push: true
|
||||
files: |
|
||||
./docker-bake.hcl
|
||||
|
||||
- name: Update kube config
|
||||
run: aws eks update-kubeconfig --name ${{ secrets.EKS_CLUSTER_NAME }} --region ${{ secrets.AWS_REGION }}
|
||||
|
||||
- name: Deploy the images 🚀
|
||||
env:
|
||||
REGISTRY: ${{ steps.login-ecr.outputs.registry }}/${{ env.PROJECT }}-${{ env.STACK }}
|
||||
run: |-
|
||||
set -eu
|
||||
# run deploy.sh script before deployments
|
||||
helm upgrade -i ${{ env.PROJECT }} infra/helm -n ${{ env.PROJECT}}-${{ env.STACK }} --set image.repository=${{ env.REGISTRY }} \
|
||||
--set image.tag=${{ env.VERSION }} --set 'api_host=${{ secrets.API_HOST }}' --set 'socketcluster_host=${{ secrets.SOCKETCLUSTER_HOST }}' \
|
||||
--set gcp=false --set 'ingress.annotations.kubernetes\.io/ingress\.class=null' --set 'ingress.annotations.alb\.ingress\.kubernetes\.io/scheme=internet-facing' \
|
||||
--set serviceAccount.name=default --set serviceAccount.create=false --set ingress.className=alb \
|
||||
--set 'ingress.annotations.alb\.ingress\.kubernetes\.io/listen-ports=[{"HTTPS":443}]' \
|
||||
--set service.type=NodePort
|
||||
|
||||
build_frontend:
|
||||
name: Build and Deploy the Console
|
||||
needs: [build_service]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write # This is required for requesting the JWT
|
||||
contents: read # This is required for actions/checkout
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set Dynamic ENV Vars
|
||||
run: |
|
||||
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
|
||||
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
|
||||
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v2
|
||||
with:
|
||||
role-to-assume: ${{ secrets.EKS_DEPLOYER_ROLE }}
|
||||
role-session-name: github
|
||||
aws-region: ${{ secrets.AWS_REGION }}
|
||||
|
||||
- name: Get infra-provided configuration
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
wget -O- https://github.com/springload/ssm-parent/releases/download/1.8.0/ssm-parent_1.8.0_linux_amd64.tar.gz | tar xvzf - ssm-parent
|
||||
|
||||
./ssm-parent -n /actions/${{ env.PROJECT }}/${{ env.STACK }}/configuration dotenv /tmp/dotenv.file
|
||||
# remove double quotes and pipe into the env
|
||||
cat /tmp/dotenv.file | sed -e 's/"//g' >> $GITHUB_ENV
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
name: Install pnpm
|
||||
id: pnpm-install
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm Store Directory
|
||||
id: pnpm-cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm Cache
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Check for _GITHUB_AUTH_TOKEN and create .npmrc
|
||||
run: |
|
||||
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" > .npmrc
|
||||
fi
|
||||
working-directory: ./console
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
working-directory: ./console
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
API_HOST: ${{ secrets.API_HOST }}
|
||||
SOCKETCLUSTER_HOST: ${{ secrets.SOCKETCLUSTER_HOST }}
|
||||
SOCKETCLUSTER_PORT: "443" # it uses common ingress so port 443
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
pnpm build --environment production
|
||||
working-directory: ./console
|
||||
|
||||
- name: Deploy Console 🚀
|
||||
run: |
|
||||
set -u
|
||||
|
||||
DEPLOY_BUCKET=${STATIC_DEPLOY_BUCKET:-${{ env.PROJECT }}-${{ env.STACK }}}
|
||||
# this value will come from the dotenv above
|
||||
echo "Deploying to $DEPLOY_BUCKET"
|
||||
wget -O- https://github.com/bep/s3deploy/releases/download/v2.11.0/s3deploy_2.11.0_linux-amd64.tar.gz | tar xzv -f - s3deploy
|
||||
./s3deploy -region ${AWS_REGION} -source console/dist -bucket ${DEPLOY_BUCKET}
|
||||
185
.github/workflows/gcp-cd.yml
vendored
185
.github/workflows/gcp-cd.yml
vendored
@@ -1,185 +0,0 @@
|
||||
name: Fleetbase GCP CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "gcpdeploy/*" ]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
PROJECT: ${{ vars.PROJECT }}
|
||||
REGISTRY: ${{ vars.REGISTRY }}
|
||||
SOCKETCLUSTER_HOST: ${{ vars.SOCKETCLUSTER_HOST }}
|
||||
API_HOST: ${{ vars.API_HOST }}
|
||||
K8S_CLUSTER_NAME: ${{ vars.K8S_CLUSTER_NAME }}
|
||||
K8S_CLUSTER_LOCATION: ${{ vars.K8S_CLUSTER_LOCATION }}
|
||||
GCP_WORKLOAD_IDENTITY_PROVIDER: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
|
||||
GCP_SERVICE_ACCOUNT: ${{ vars.GCP_SERVICE_ACCOUNT }}
|
||||
GCP: "True" # switches docker builds to GCP-style registry
|
||||
|
||||
jobs:
|
||||
build_service:
|
||||
name: Build and Deploy the Service
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write # This is required for requesting the JWT
|
||||
contents: read # This is required for actions/checkout
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Set Dynamic ENV Vars
|
||||
run: |
|
||||
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
|
||||
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
|
||||
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
|
||||
echo "REGISTRY_HOST=$(dirname $(dirname $REGISTRY))" >> $GITHUB_ENV
|
||||
|
||||
- id: 'auth'
|
||||
name: 'Authenticate to Google Cloud'
|
||||
uses: 'google-github-actions/auth@v1'
|
||||
with:
|
||||
token_format: "access_token"
|
||||
create_credentials_file: true
|
||||
workload_identity_provider: ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}
|
||||
service_account: ${{ env.GCP_SERVICE_ACCOUNT }}
|
||||
|
||||
- name: 'Set up Cloud SDK'
|
||||
uses: 'google-github-actions/setup-gcloud@v1'
|
||||
|
||||
- id: 'get-credentials'
|
||||
uses: 'google-github-actions/get-gke-credentials@v1'
|
||||
with:
|
||||
cluster_name: ${{ env.K8S_CLUSTER_NAME }}
|
||||
location: ${{ env.K8S_CLUSTER_LOCATION }}
|
||||
|
||||
- uses: 'docker/login-action@v3'
|
||||
with:
|
||||
registry: ${{ env.REGISTRY_HOST }}
|
||||
username: 'oauth2accesstoken'
|
||||
password: '${{ steps.auth.outputs.access_token }}'
|
||||
|
||||
- name: Prepare Composer Auth Secret
|
||||
run: |
|
||||
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
|
||||
echo '{"github-oauth": {"github.com": "'${{ secrets._GITHUB_AUTH_TOKEN }}'"}}' > composer-auth.json
|
||||
else
|
||||
echo '{}' > composer-auth.json
|
||||
fi
|
||||
|
||||
- name: nullify ssm-parent config
|
||||
run: |
|
||||
# this is needed to disable ssm-parent, which is used on AWS
|
||||
echo > api/.ssm-parent.yaml
|
||||
|
||||
- name: Build and Release
|
||||
uses: docker/bake-action@v2
|
||||
env:
|
||||
REGISTRY: ${{ env.REGISTRY }}
|
||||
VERSION: ${{ env.VERSION }}
|
||||
CACHE: type=gha
|
||||
with:
|
||||
push: true
|
||||
files: |
|
||||
./docker-bake.hcl
|
||||
|
||||
- name: deploy with helm
|
||||
run: |
|
||||
helm upgrade -i fleetbase infra/helm -n ${{ env.PROJECT }}-${{ env.STACK }} --set image.repository=${{ env.REGISTRY }} --set image.tag=${{ env.VERSION }} --set 'api_host=${{ env.API_HOST }}' --set 'socketcluster_host=${{ env.SOCKETCLUSTER_HOST }}' --set 'ingress.annotations.kubernetes\.io/ingress\.global-static-ip-name=${{ env.PROJECT }}-${{ env.STACK }}'
|
||||
|
||||
build_frontend:
|
||||
name: Build and Deploy the Console
|
||||
needs: [build_service]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write # This is required for requesting the JWT
|
||||
contents: read # This is required for actions/checkout
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Set Dynamic ENV Vars
|
||||
run: |
|
||||
SHORT_COMMIT=$(echo $GITHUB_SHA | cut -c -8)
|
||||
echo "VERSION=${SHORT_COMMIT}" >> $GITHUB_ENV
|
||||
echo "STACK=$(basename $GITHUB_REF)" >> $GITHUB_ENV
|
||||
|
||||
- id: 'auth'
|
||||
name: 'Authenticate to Google Cloud'
|
||||
uses: 'google-github-actions/auth@v1'
|
||||
with:
|
||||
token_format: "access_token"
|
||||
create_credentials_file: true
|
||||
workload_identity_provider: ${{ env.GCP_WORKLOAD_IDENTITY_PROVIDER }}
|
||||
service_account: ${{ env.GCP_SERVICE_ACCOUNT }}
|
||||
|
||||
- name: 'Set up Cloud SDK'
|
||||
uses: 'google-github-actions/setup-gcloud@v1'
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
|
||||
- uses: pnpm/action-setup@v2
|
||||
name: Install pnpm
|
||||
id: pnpm-install
|
||||
with:
|
||||
version: 8
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm Store Directory
|
||||
id: pnpm-cache
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||
|
||||
- uses: actions/cache@v3
|
||||
name: Setup pnpm Cache
|
||||
with:
|
||||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Check for _GITHUB_AUTH_TOKEN and create .npmrc
|
||||
run: |
|
||||
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" > .npmrc
|
||||
fi
|
||||
working-directory: ./console
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
working-directory: ./console
|
||||
|
||||
- name: Build
|
||||
env:
|
||||
SOCKETCLUSTER_HOST: ${{ env.SOCKETCLUSTER_HOST }}
|
||||
SOCKETCLUSTER_SECURE: "true"
|
||||
SOCKETCLUSTER_PORT: "443"
|
||||
API_HOST: ${{ env.API_HOST }}
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
pnpm build --environment production
|
||||
working-directory: ./console
|
||||
|
||||
- name: Deploy Console 🚀
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
gcloud app deploy --appyaml console/app.yaml console/dist
|
||||
# leave 2 versions
|
||||
gcloud app versions list --filter="traffic_split=0" --sort-by '~version' --format 'value(version.id)' | sed '1d' | xargs -r gcloud app versions delete
|
||||
50
.github/workflows/publish-docker-images.yml
vendored
50
.github/workflows/publish-docker-images.yml
vendored
@@ -1,50 +0,0 @@
|
||||
name: Fleetbase Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
branch:
|
||||
description: 'Branch to build from'
|
||||
required: false
|
||||
default: 'main'
|
||||
version:
|
||||
description: 'Image version tag (e.g., v0.7.1-beta)'
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
docker-release:
|
||||
name: Build and Push Docker Images
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
REGISTRY: fleetbase
|
||||
VERSION: ${{ github.event.inputs.version || (github.ref_type == 'tag' && startsWith(github.ref_name, 'v') && github.ref_name) || 'manual' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.branch || github.ref_name }}
|
||||
submodules: recursive
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||
|
||||
- name: Build and Push Console & API Images
|
||||
uses: docker/bake-action@v2
|
||||
with:
|
||||
push: true
|
||||
targets: |
|
||||
fleetbase-console
|
||||
fleetbase-api
|
||||
files: |
|
||||
./docker-bake.hcl
|
||||
43
.gitignore
vendored
43
.gitignore
vendored
@@ -3,7 +3,6 @@
|
||||
.env.backup
|
||||
.phpunit.result.cache
|
||||
.pnpm-store
|
||||
.tool-versions
|
||||
docker-compose.override.yml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
@@ -16,42 +15,12 @@ api/vendor
|
||||
api/composer.dev.json
|
||||
api/composer-install-dev.sh
|
||||
api/auth.json
|
||||
api/crontab
|
||||
api/go-crond
|
||||
api/.fleetbase-id
|
||||
act.sh
|
||||
composer-auth.json
|
||||
docker/database/*
|
||||
docker/database/mysql/*
|
||||
.talismanrc
|
||||
verdaccio/minio
|
||||
verdaccio/config/htpasswd
|
||||
verdaccio/storage
|
||||
# private packages
|
||||
packages/billing
|
||||
packages/flespi
|
||||
packages/loconav
|
||||
packages/internals
|
||||
packages/billing-api
|
||||
packages/billing-engine
|
||||
packages/flespi-engine
|
||||
packages/flespi-integration
|
||||
packages/projectargus-engine
|
||||
packages/customer-portal
|
||||
packages/solid
|
||||
packages/aws-marketplace
|
||||
packages/countries
|
||||
packages/fliit
|
||||
packages/samsara
|
||||
packages/solid*
|
||||
packages/valhalla
|
||||
packages/vroom
|
||||
solid
|
||||
verdaccio
|
||||
# asdf
|
||||
.tools-versions
|
||||
# binary build resources
|
||||
builds/osx/frankenphp
|
||||
# build artifacts
|
||||
/builds/dist/
|
||||
/builds/linux/spc/downloads/*
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
docker/database/*
|
||||
docker/database/mysql/*
|
||||
18
.gitmodules
vendored
18
.gitmodules
vendored
@@ -33,12 +33,12 @@
|
||||
path = packages/fleetops-data
|
||||
url = git@github.com:fleetbase/fleetops-data.git
|
||||
branch = main
|
||||
[submodule "docs"]
|
||||
path = docs
|
||||
url = git@github.com:fleetbase/docs.git
|
||||
[submodule "packages/registry-bridge"]
|
||||
path = packages/registry-bridge
|
||||
url = git@github.com:fleetbase/registry-bridge.git
|
||||
[submodule "packages/ledger"]
|
||||
path = packages/ledger
|
||||
url = git@github.com:fleetbase/ledger.git
|
||||
[submodule "docs/guides"]
|
||||
path = docs/guides
|
||||
url = git@github.com:fleetbase/guides.git
|
||||
[submodule "docs/api-reference"]
|
||||
path = docs/api-reference
|
||||
url = git@github.com:fleetbase/api-reference.git
|
||||
[submodule "packages/solid"]
|
||||
path = packages/solid
|
||||
url = git@github.com:fleetbase/solid.git
|
||||
|
||||
@@ -7,11 +7,7 @@ routes:
|
||||
headers:
|
||||
Cache-Control: "max-age=600, no-transform, public"
|
||||
gzip: false
|
||||
- route: "^.+\\.(xml|json)$"
|
||||
headers:
|
||||
Cache-Control: "max-age=600, no-transform, public"
|
||||
gzip: true
|
||||
- route: "^.+\\.(html)$"
|
||||
- route: "^.+\\.(html|xml|json)$"
|
||||
headers:
|
||||
Cache-Control: "public, max-age=0, must-revalidate"
|
||||
gzip: true
|
||||
|
||||
@@ -13,15 +13,15 @@ We use github to host code, to track issues and feature requests, as well as acc
|
||||
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
|
||||
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
|
||||
|
||||
1. Fork the repo and create your branch from `main`.
|
||||
1. Fork the repo and create your branch from `master`.
|
||||
2. If you've added code that should be tested, add tests.
|
||||
3. If you've changed APIs, update the documentation.
|
||||
4. Ensure the test suite passes.
|
||||
5. Make sure your code lints.
|
||||
6. Issue that pull request!
|
||||
|
||||
## Any contributions you make will be under the AGPL v3 Software License
|
||||
In short, when you submit code changes, your submissions are understood to be under the same [AGPL v3](https://choosealicense.com/licenses/agpl-3.0/) that covers the project. Feel free to contact the maintainers if that's a concern.
|
||||
## Any contributions you make will be under the MIT Software License
|
||||
In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
|
||||
|
||||
## Report bugs using Github's [issues](https://github.com/fleetbase/fleetbase/issues)
|
||||
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/fleetbase/fleetbase/issues), it's that easy!
|
||||
@@ -41,7 +41,7 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]
|
||||
People *love* thorough bug reports. I'm not even kidding.
|
||||
|
||||
## License
|
||||
By contributing, you agree that your contributions will be licensed under its AGPL v3 Software License.
|
||||
By contributing, you agree that your contributions will be licensed under its MIT License.
|
||||
|
||||
## References
|
||||
This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md)
|
||||
|
||||
14
Caddyfile
14
Caddyfile
@@ -1,14 +0,0 @@
|
||||
{
|
||||
frankenphp {
|
||||
num_threads 24
|
||||
}
|
||||
order php_server before file_server
|
||||
}
|
||||
|
||||
http://:8000 {
|
||||
root * /fleetbase/api/public
|
||||
encode zstd br gzip
|
||||
php_server {
|
||||
resolve_root_symlink
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
frankenphp
|
||||
order php_server before file_server
|
||||
}
|
||||
|
||||
http://:8000 {
|
||||
root * /fleetbase/api/public
|
||||
encode zstd gzip
|
||||
php_server {
|
||||
resolve_root_symlink
|
||||
}
|
||||
}
|
||||
|
||||
http://:4200 {
|
||||
root * /fleetbase/console/dist
|
||||
try_files {path} /
|
||||
encode zstd gzip
|
||||
file_server
|
||||
}
|
||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Fleetbase Pte Ltd
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
651
LICENSE.md
651
LICENSE.md
@@ -1,651 +0,0 @@
|
||||
GNU Affero General Public License
|
||||
=================================
|
||||
|
||||
_Version 3, 19 November 2007_
|
||||
_Copyright © 2007 Free Software Foundation, Inc. <<http://fsf.org/>>_
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
## Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: **(1)** assert copyright on the software, and **(2)** offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
## TERMS AND CONDITIONS
|
||||
|
||||
### 0. Definitions
|
||||
|
||||
“This License” refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
“Copyright” also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
“The Program” refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as “you”. “Licensees” and
|
||||
“recipients” may be individuals or organizations.
|
||||
|
||||
To “modify” a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a “modified version” of the
|
||||
earlier work or a work “based on” the earlier work.
|
||||
|
||||
A “covered work” means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To “propagate” a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To “convey” a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays “Appropriate Legal Notices”
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that **(1)** displays an appropriate copyright notice, and **(2)**
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
### 1. Source Code
|
||||
|
||||
The “source code” for a work means the preferred form of the work
|
||||
for making modifications to it. “Object code” means any non-source
|
||||
form of a work.
|
||||
|
||||
A “Standard Interface” means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The “System Libraries” of an executable work include anything, other
|
||||
than the work as a whole, that **(a)** is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and **(b)** serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
“Major Component”, in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The “Corresponding Source” for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
### 2. Basic Permissions
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
### 3. Protecting Users' Legal Rights From Anti-Circumvention Law
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
### 4. Conveying Verbatim Copies
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
### 5. Conveying Modified Source Versions
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
* **a)** The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
* **b)** The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section 7.
|
||||
This requirement modifies the requirement in section 4 to
|
||||
“keep intact all notices”.
|
||||
* **c)** You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
* **d)** If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
“aggregate” if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
### 6. Conveying Non-Source Forms
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
* **a)** Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
* **b)** Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either **(1)** a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or **(2)** access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
* **c)** Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
* **d)** Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
* **e)** Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A “User Product” is either **(1)** a “consumer product”, which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or **(2)** anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, “normally used” refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
“Installation Information” for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
### 7. Additional Terms
|
||||
|
||||
“Additional permissions” are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
* **a)** Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
* **b)** Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
* **c)** Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
* **d)** Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
* **e)** Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
* **f)** Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered “further
|
||||
restrictions” within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
### 8. Termination
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated **(a)**
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and **(b)** permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
### 9. Acceptance Not Required for Having Copies
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
### 10. Automatic Licensing of Downstream Recipients
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An “entity transaction” is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
### 11. Patents
|
||||
|
||||
A “contributor” is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's “contributor version”.
|
||||
|
||||
A contributor's “essential patent claims” are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, “control” includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a “patent license” is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To “grant” such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either **(1)** cause the Corresponding Source to be so
|
||||
available, or **(2)** arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or **(3)** arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. “Knowingly relying” means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is “discriminatory” if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license **(a)** in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or **(b)** primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
### 12. No Surrender of Others' Freedom
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
### 13. Remote Network Interaction; Use with the GNU General Public License
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
### 14. Revised Versions of this License
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License “or any later version” applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
### 15. Disclaimer of Warranty
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
### 16. Limitation of Liability
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
### 17. Interpretation of Sections 15 and 16
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
_END OF TERMS AND CONDITIONS_
|
||||
|
||||
## How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the “copyright” line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a “Source” link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a “copyright disclaimer” for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<<http://www.gnu.org/licenses/>>.
|
||||
382
README.md
382
README.md
@@ -1,72 +1,58 @@
|
||||
<div id="hero">
|
||||
<p align="center" dir="auto">
|
||||
<a href="https://fleetbase.io" rel="nofollow">
|
||||
<img src="https://user-images.githubusercontent.com/58805033/191936702-fed04b0f-7966-4041-96d0-95e27bf98248.png" alt="Fleetbase logo" width="500" height="120" style="max-width: 100%;">
|
||||
<img src="https://user-images.githubusercontent.com/58805033/191936702-fed04b0f-7966-4041-96d0-95e27bf98248.png" alt="Fleetbase logo" width="600" height="140" style="max-width: 100%;">
|
||||
</a>
|
||||
</p>
|
||||
<p align="center" dir="auto">
|
||||
Modular logistics and supply chain operating system
|
||||
Open Source Modular Logistics Platform
|
||||
<br>
|
||||
<a href="https://docs.fleetbase.io/" rel="nofollow" target="_fleetbase_docs">Documentation</a>
|
||||
<a href="https://fleetbase.github.io/guides" rel="nofollow">Fleetbase Documentation →</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://meetings.hubspot.com/shiv-thakker" rel="nofollow">Book a Demo</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://github.com/fleetbase/fleetbase/issues">Report an Issue</a>
|
||||
·
|
||||
<a href="https://console.fleetbase.io" rel="nofollow" target="_fleetbase_console">Cloud Version</a>
|
||||
<a href="https://fleetbase.github.io/api-reference">API Reference</a>
|
||||
·
|
||||
<a href="https://console.fleetbase.io/aws-marketplace" rel="nofollow" target="_aws_marketplace">Deploy on AWS</a>
|
||||
<a href="https://fleetbase.github.io/guides">Guides</a>
|
||||
·
|
||||
<a href="https://tally.so/r/3NBpAW" rel="nofollow">Book a Demo</a>
|
||||
<a href="https://github.com/fleetbase/fleetbase/issues">Request a Feature</a>
|
||||
·
|
||||
<a href="https://www.fleetbase.io/blog-2" rel="nofollow">Blog</a>
|
||||
·
|
||||
<a href="https://fleetbase.apichecker.com" target="_api_status" rel="nofollow">API Status</a>
|
||||
·
|
||||
<a href="https://discord.gg/V7RVWRQ2Wm" target="discord" rel="nofollow">Discord</a>
|
||||
</p>
|
||||
<hr />
|
||||
</div>
|
||||
|
||||
## What is Fleetbase?
|
||||
# ⭐️ Overview
|
||||
|
||||
Fleetbase is a modular logistics and supply chain operating system designed to streamline management, planning, optimization, and operational control across various sectors of the supply chain industry.
|
||||
Fleetbase is an open-source modular platform designed for the efficient management and orchestration of logistics operations. It serves as both a powerful operational tool for businesses and a flexible foundation for developers. The platform's core is built around a collection of "extensions," which create a customizable framework capable of meeting a wide range of supply chain and logistics requirements.
|
||||
|
||||
Each extension in Fleetbase is purposefully engineered to fulfill specific roles within the logistics ecosystem. Users have the freedom to create their own extensions, expanding the platform's ecosystem and ensuring its adaptability to various use cases. This extensible nature keeps Fleetbase at the forefront of addressing diverse logistical and supply chain needs now and in the future.
|
||||
|
||||
<p align="center" dir="auto">
|
||||
<img src="https://flb-assets.s3.ap-southeast-1.amazonaws.com/static/fleetbase_overview.png" alt="Fleetbase Console" width="1200" style="max-width: 100%;" />
|
||||
<img src="https://github.com/fleetbase/fleetbase/assets/816371/deef79fa-e30c-4ce9-8a04-0dee990ffd9d" alt="Fleetbase Console" width="600" style="max-width: 100%;" />
|
||||
</p>
|
||||
|
||||
## Visual Feature Showcase
|
||||
<div align="center">
|
||||
<a href="https://www.producthunt.com/posts/fleetbase-alpha" target="_producthunt">🚀 We've just announced our Alpha release on Product Hunt! 🚀</a>
|
||||
<p>Check Fleetbase out on ProductHunt, and support with a Upvote!</p>
|
||||
<a href="https://www.producthunt.com/posts/fleetbase-alpha?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-fleetbase-alpha" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=399731&theme=light" alt="Fleetbase (Alpha) - The open source OnFleet alternative | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
||||
</div>
|
||||
|
||||
|
||||
<p align="center" dir="auto">
|
||||
<img src="https://flb-assets.s3.ap-southeast-1.amazonaws.com/static/order-board-kanban.png" alt="Fleetbase Order Board" width="1200" style="max-width: 100%;" />
|
||||
<em>Visualize and manage your orders with a dynamic Kanban board.</em>
|
||||
</p>
|
||||
# 📖 Table of contents
|
||||
|
||||
<p align="center" dir="auto">
|
||||
<img src="https://flb-assets.s3.ap-southeast-1.amazonaws.com/static/order-workflow-config.png" alt="Fleetbase Order Workflow Configuration" width="1200" style="max-width: 100%;" />
|
||||
<em>Create custom order flows and automation with the intuitive workflow builder.</em>
|
||||
</p>
|
||||
|
||||
<p align="center" dir="auto">
|
||||
<img src="https://flb-assets.s3.ap-southeast-1.amazonaws.com/static/order-map-view.png" alt="Fleetbase Order Map View" width="1200" style="max-width: 100%;" />
|
||||
<em>Track individual orders in real-time on an interactive map.</em>
|
||||
</p>
|
||||
|
||||
<p align="center" dir="auto">
|
||||
<img src="https://flb-assets.s3.ap-southeast-1.amazonaws.com/static/live-map-tracking.png" alt="Fleetbase Live Map Tracking" width="1200" style="max-width: 100%;" />
|
||||
<em>Get a complete overview of your fleet and active orders on a live map.</em>
|
||||
</p>
|
||||
|
||||
<p align="center" dir="auto">
|
||||
<img src="https://flb-assets.s3.ap-southeast-1.amazonaws.com/static/fleet-map-zones.png" alt="Fleetbase Fleet Map with Zones" width="1200" style="max-width: 100%;" />
|
||||
<em>Define and manage service areas and zones for your fleet.</em>
|
||||
</p>
|
||||
|
||||
**Quickstart**
|
||||
|
||||
```bash
|
||||
git clone git@github.com:fleetbase/fleetbase.git
|
||||
cd fleetbase && ./scripts/docker-install.sh
|
||||
```
|
||||
|
||||
## 📖 Table of contents
|
||||
|
||||
- [Features](#-features)
|
||||
- [Install](#-install)
|
||||
- [Deploy on AWS](#-deploy-on-aws-in-one-click)
|
||||
- [What's Included](#-whats-included)
|
||||
- [Getting Started](#-getting-started)
|
||||
- [Use Cases](#-use-cases)
|
||||
- [Installation](#-installation)
|
||||
- [Extensions](#-extensions)
|
||||
- [Apps](#-apps)
|
||||
- [Roadmap](#-roadmap)
|
||||
@@ -77,123 +63,211 @@ cd fleetbase && ./scripts/docker-install.sh
|
||||
- [Creators](#-creators)
|
||||
- [License & Copyright](#-license-and-copyright)
|
||||
|
||||
## 📦 Features
|
||||
- **Extensible:** Build installable extensions and additional functionality directly into the OS via modular architecture.
|
||||
- **Developer Friendly:** RESTful API, socket, and webhooks to seamlessly integrate with external systems or develop custom applications.
|
||||
- **Native Apps:** Collection of open-source and native apps designed for operations and customer facing.
|
||||
- **Collaboration:** Dedicated chat and comments system for collaboration across your organization.
|
||||
- **Security:** Secure data encryption, adherence to industry-standard security practices, and a comprehensive dynamic Identity and Access Management (IAM) system.
|
||||
- **Telematics:** Integrate and connect to hardware devices and sensors to provide more feedback and visibility into operations.
|
||||
- **Internationalized:** Translate into multiple languages to accommodate diverse user bases and global operations.
|
||||
- **Framework:** PHP core built around logistics and supply chain abstractions to streamline extension development.
|
||||
- **Dynamic:** Configurable rules, flows and logic to enable automation and customization.
|
||||
- **UI/UX:** Clean, responsive user-friendly interface for efficient management and operations from desktop or mobile.
|
||||
- **Dashboards:** Create custom dashboards and widgets to get full visibility into operations.
|
||||
- **Scalability:** Uninterrupted growth with scalable infrastructure and design, capable of handling increasing data volume and user demand as your business expands.
|
||||
- **Continuous Improvements:** Commitment to continuous improvement, providing regular updates that seamlessly introduce optimizations, new features, and overall enhancements to the OS.
|
||||
- **Open Source:** Deploy it either on-premise or in the cloud according to your organization's needs and preferences.
|
||||
# 📦 What's Included
|
||||
|
||||
## 💾 Install
|
||||
Getting up and running with Fleetbase via Docker is the quickest and most straightforward way. If you’d like to use Fleetbase without docker read the [full install guide in the Fleetbase documentation](https://docs.fleetbase.io/getting-started/install).
|
||||
Fleetbase is more than just a platform; it's a versatile ecosystem carefully architected to empower developers and businesses alike. Fleetbase comes pre-installed with a few extensions that provide base functionality to get users and businesses started:
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Console</strong>: Fleetbase's frontend console is built with Ember.js and Ember Engines, offering a modular and extensible design. This design allows the system to easily adapt and scale according to your evolving needs while simplifying the integration of new extensions. By leveraging the console's design, extensions can be seamlessly installed using their respective package managers, reducing complexity and integration time.
|
||||
</li>
|
||||
<li>
|
||||
<strong>Fleetbase API</strong>: Fleetbase's backend API and framework are built with Laravel, providing a robust and flexible infrastructure for extension development and integration. The system efficiently manages complex data structures and transactions while seamlessly incorporating new extensions through package managers. We offer additional packages for developers to create custom extensions, enhancing the flexibility and extensibility of the Fleetbase ecosystem.
|
||||
</li>
|
||||
<li>
|
||||
<strong>Extensions</strong>: Fleetbase is designed to provide immediate utility out-of-the-box. It comes pre-installed with several key extensions
|
||||
<ul>
|
||||
<li><strong>FleetOps</strong>: FleetOps, our comprehensive fleet management extension, caters to all aspects of last-mile operations. Some of it's features include:
|
||||
<ul>
|
||||
<li>
|
||||
Real-time tracking for vehicles and assets, ensuring optimal operational efficiency.
|
||||
</li>
|
||||
<li>
|
||||
Order creation and management, facilitating seamless transaction processing.
|
||||
Service rates management, helping maintain financial transparency and profitability.
|
||||
</li>
|
||||
<li>
|
||||
Fleet management, providing a holistic view and control of your fleet.
|
||||
</li>
|
||||
<li>
|
||||
Third-party vendor integrations, allowing you to consolidate your resources.
|
||||
</li>
|
||||
<li>
|
||||
API & Webhooks that not only offer increased interconnectivity but also serve to facilitate integrations with other services and applications, making FleetOps a truly versatile solution.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Storefront</strong>: Storefront is an extension that delivers headless commerce functionality, ideal for businesses aspiring to develop on-demand stores or marketplaces. It aims to facilitate seamless transactions while focusing on providing an excellent user experience.
|
||||
</li>
|
||||
<li><strong>Dev Console</strong>: The Dev Console extension is a developer's toolbox, providing resources such as:
|
||||
<ul>
|
||||
<li>
|
||||
API keys management, ensuring secure interactions with the application programming interface.
|
||||
</li>
|
||||
<li>
|
||||
Webhooks management, enabling real-time data exchanges.
|
||||
</li>
|
||||
<li>
|
||||
Sockets management, facilitating bi-directional client-server communication.
|
||||
</li>
|
||||
<li>
|
||||
Logs management, crucial for system monitoring and troubleshooting.
|
||||
</li>
|
||||
<li>
|
||||
API events management, keeping a pulse on system communications.
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
# 🏁 Getting Started
|
||||
|
||||
Before you can get started with Fleetbase, you'll need to make sure you have the following prerequisites:
|
||||
|
||||
<ol>
|
||||
<li>
|
||||
A computer running either Linux, Mac OS, or Windows
|
||||
</li>
|
||||
<li>Docker installed</li>
|
||||
<li>Git installed</li>
|
||||
<li>If you want to try now, the <a href="https://console.fleetbase.io/" target="_fleetbase" alt="Fleetbase">cloud hosted version of Fleetbase available here.</a></li>
|
||||
</ol>
|
||||
|
||||
# 🚦 Use Cases
|
||||
|
||||
Fleetbase's comprehensive suite of features and the modular design make it highly versatile, catering to a broad array of applications across different industries. Here are a few use cases:
|
||||
<ul>
|
||||
<li><strong>Logistics and Supply Chain Management</strong>: Fleetbase could be employed by a logistics company to streamline its operations. Real-time tracking provided by FleetOps would help maintain visibility of fleet vehicles and assets at all times. This would ensure timely delivery, reduce operational inefficiencies, and enable proactive management of any logistical issues. Additionally, the order creation and management feature could be used to manage deliveries, pickups, and routing.</li>
|
||||
|
||||
Make sure you have both the latest versions of docker and docker-compose installed on your system.
|
||||
|
||||
```bash
|
||||
git clone git@github.com:fleetbase/fleetbase.git
|
||||
cd fleetbase && ./scripts/docker-install.sh
|
||||
```
|
||||
|
||||
### Accessing Fleetbase
|
||||
Once successfully installed and running you can then access the Fleetbase console on port 4200 and the API will be accessible from port 8000.
|
||||
<li><strong>On-demand Delivery Services</strong>: On-demand services like food delivery or courier companies could utilize Fleetbase to manage their fleet of delivery agents. The real-time tracking functionality would help to optimize routes and ensure prompt deliveries, while the order creation and management system would efficiently handle incoming orders.</li>
|
||||
|
||||
Fleetbase Console: http://localhost:4200
|
||||
Fleetbase API: http://localhost:8000
|
||||
|
||||
### Additional Configurations
|
||||
|
||||
**CORS:** If you’re installing directly on a server you will need to configure the environment variables to the application container:
|
||||
```
|
||||
CONSOLE_HOST=http://{yourhost}:4200
|
||||
```
|
||||
If you have additional applications or frontends you can use the environment variable `FRONTEND_HOSTS` to add a comma delimited list of additioal frontend hosts.
|
||||
|
||||
**Application Key** If you get an issue about a missing application key just run:
|
||||
```bash
|
||||
docker compose exec application bash -c "php artisan key:generate --show"
|
||||
```
|
||||
Next copy this value to the `APP_KEY` environment variable in the application container and restart.
|
||||
<li><strong>E-Commerce Platforms</strong>: E-commerce businesses could leverage Fleetbase to manage their backend logistics. The Storefront extension would enable seamless online transactions, while FleetOps could manage all aspects of the delivery process, ensuring a smooth shopping experience for the customers.</li>
|
||||
|
||||
**Routing:** Fleetbase ships with a default OSRM server hosted by `[router.project-osrm.org](https://router.project-osrm.org)` but you’re able to use your own or any other OSRM compatible server. You can modify this in the `console/environments` directory by modifying the .env file of the environment you’re deploying and setting the `OSRM_HOST` to the OSRM server for Fleetbase to use.
|
||||
<li><strong>Ride-Hailing Services</strong>: Fleetbase could be a perfect fit for ride-hailing or car rental services. FleetOps would manage real-time tracking of vehicles, maintaining optimal vehicle utilization, while the API and Webhooks would facilitate integration with mobile apps to provide real-time updates to customers.</li>
|
||||
|
||||
**Services:** There are a few environment variables which need to be set for Fleetbase to function with full features. If you’re deploying with docker then it’s easiest to just create a `docker-compose.override.yml` and supply the environment variables in this file.
|
||||
<li><strong>Third-party Logistics (3PL) Provider</strong>: A 3PL provider could use Fleetbase for comprehensive management of its services. From real-time tracking of cargo to managing service rates and integration with other vendors in the supply chain, Fleetbase could provide an all-in-one solution.</li>
|
||||
|
||||
<li><strong>Developer Resource Management</strong>: Developers building complex, resource-intensive applications could benefit from Fleetbase's Dev Console. API keys and webhook management could streamline the secure interaction between different software components. At the same time, sockets, logs, and API events management tools would assist in maintaining, troubleshooting, and improving the system.</li>
|
||||
|
||||
```yaml
|
||||
version: “3.8”
|
||||
services:
|
||||
application:
|
||||
environment:
|
||||
CONSOLE_HOST: http://localhost:4200
|
||||
MAIL_MAILER: (ses, smtp, mailgun, postmark, sendgrid)
|
||||
OSRM_HOST: https://router.project-osrm.org
|
||||
IPINFO_API_KEY:
|
||||
GOOGLE_MAPS_API_KEY:
|
||||
GOOGLE_MAPS_LOCALE: us
|
||||
TWILIO_SID:
|
||||
TWILIO_TOKEN:
|
||||
TWILIO_FROM:
|
||||
```
|
||||
<li><strong>Public Transportation Systems</strong>: City transportation services could use Fleetbase to optimize their bus or subway operations. With FleetOps, they could have real-time tracking of their vehicles, ensuring that schedules are met promptly and delays are handled effectively. Moreover, service rates management could assist in setting and adjusting fares, while the API and Webhooks functionality could integrate with public apps to provide real-time updates to commuters about arrivals, delays, and route changes.</li>
|
||||
|
||||
You can learn more about full installation, and configuration in the [official documentation](https://docs.fleetbase.io/getting-started/install).
|
||||
<li><strong>Fleet Leasing Companies</strong>: Fleet leasing companies could employ Fleetbase to manage their vehicle assets and track their status in real time. From managing service rates to ensuring the best utilization of assets, FleetOps could provide a holistic solution. Moreover, the Storefront extension could be used to list available vehicles and manage online reservations seamlessly.</li>
|
||||
|
||||
## 🚀 Deploy on AWS in One Click
|
||||
<li><strong>Emergency Services</strong>: Emergency services like ambulance or firefighting departments could use Fleetbase to manage their operations. FleetOps would provide real-time tracking, ensuring that emergency vehicles are dispatched quickly and the fastest routes are chosen. In addition, the API and Webhooks functionality could allow integration with emergency call centers, ensuring a seamless flow of information and a swift response to emergencies.</li>
|
||||
</ul>
|
||||
|
||||
Deploy your complete Fleetbase logistics platform on AWS with enterprise-grade security, scalability, and reliability. No DevOps expertise required!
|
||||
Remember, these are just a few examples. Given the modular and extensible nature of Fleetbase, it can be customized and scaled to fit many other use cases across different industries.
|
||||
|
||||
[](https://console.fleetbase.io/aws-marketplace)
|
||||
# 💾 Installation
|
||||
|
||||
### ✨ What You Get
|
||||
Getting Fleetbase up and running on your system using Docker and Docker-compose is straightforward. Please follow the steps below:
|
||||
|
||||
- **Complete AWS Infrastructure**: ECS Fargate, RDS MySQL, ElastiCache Redis, S3, CloudFront, and more
|
||||
- **25-Minute Setup**: From zero to production-ready logistics platform
|
||||
- **Enterprise Security**: VPC isolation, encrypted storage, secrets management
|
||||
- **Auto-Scaling**: Handle traffic spikes with ECS Fargate auto-scaling
|
||||
- **High Availability**: Multi-AZ deployment with 99.9% uptime SLA
|
||||
- **Cost Optimized**: Pay-as-you-use with optimized resource allocation
|
||||
### Prerequisites
|
||||
|
||||
### 🏗️ Infrastructure Included
|
||||
<ul>
|
||||
<li>Ensure that you have Docker and Docker-compose installed on your system. If not, you can download and install them from their respective official websites:
|
||||
<ul>
|
||||
<li><a href="https://docs.docker.com/get-docker/" target="_docker">Docker</a></li>
|
||||
<li><a href="https://docs.docker.com/compose/install/" target="_docker_compose">Docker Compose</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
Clone the Fleetbase repository to your local machine:
|
||||
<pre>git clone git@github.com:fleetbase/fleetbase.git</pre>
|
||||
</li>
|
||||
<li>
|
||||
Navigate to the cloned repository:
|
||||
<pre>cd fleetbase</pre>
|
||||
</li>
|
||||
<li>
|
||||
Initialize and pull submodules:
|
||||
<pre>git submodule update --init --recursive</pre>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
Your AWS deployment includes a complete, production-ready infrastructure stack:
|
||||
### Build and Run Fleetbase
|
||||
|
||||
- **Compute**: ECS Fargate cluster with auto-scaling services
|
||||
- **Database**: RDS MySQL 8.0 with automated backups and Multi-AZ support
|
||||
- **Cache**: ElastiCache Redis for high-performance caching
|
||||
- **Storage**: S3 object storage with CloudFront CDN for global distribution
|
||||
- **Networking**: VPC with private subnets, NAT gateways, and security groups
|
||||
- **Load Balancing**: Application Load Balancer with SSL certificates
|
||||
- **Monitoring**: CloudWatch logs, container insights, and health monitoring
|
||||
- **Messaging**: SQS message queues for background job processing
|
||||
<ol>
|
||||
<li>
|
||||
<strong>Start the Docker daemon:</strong>
|
||||
Ensure the Docker daemon is running on your machine. You can either start Docker Desktop or either executed by running:
|
||||
<pre>service docker start</pre>
|
||||
</li>
|
||||
<li>
|
||||
<strong>Build the Docker containers:</strong>
|
||||
Use Docker Compose to build and run the necessary containers. In the root directory of the Fleetbase repository, run:
|
||||
<pre>docker-compose up -d</pre>
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
[**🚀 Deploy Now**](https://console.fleetbase.io/aws-marketplace) | [**📖 Learn More**](https://docs.fleetbase.io/category/deploying/aws)
|
||||
### Additional Steps
|
||||
|
||||
# 🧩 Extensions
|
||||
<ol>
|
||||
<li>Fleetbase will try to find the current hostname or public IP address to whitelist in for CORS, but if this fails you will need to manually add your hostname or instance URL to <code>api/config/cors.php</code> in the <code>allowed_origins</code> array. This will whitelist the console for CORS access to your instance backend.
|
||||
</li>
|
||||
<li>🛣 Routing! By default Fleetbase currently will use it's own routing engine which is hosted at <a href="https://routing.fleetbase.io" target="_fleetbase_routing_machine">https://routing.fleetbase.io</a>, this routing engine only works for a few enabled countries which include USA, Canada, Belgium, Spain, Serbia, Taiwan, Malaysia, Singapore, Brunei, Mongolia, India, Ghana. We can enable more regions and countries upon request. There is a Roadmap item to allow users to easily change to any routing engine provider such as Mapbox, Google Maps, and other 3rd Party Routing services. Optionally, you can switch out Fleetase Routing engine with any OSRM compatible service such as OpenStreetMap by changing the console environment variable <code>OSRM_HOST</code> which can be found in <code>console/environments/*.env</code>.
|
||||
</li>
|
||||
<li>If you find any bugs or unexpected issues please <a href="https://github.com/fleetbase/fleetbase/issues/new/choose">post an issue</a> to the repo or join our <a href="https://discord.gg/V7RVWRQ2Wm" target="_discord" alt="Fleetbase Discord">Discord</a>.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
Extensions are modular components that enhance the functionality of your Fleetbase instance. They allow you to add new features, customize existing behavior, or integrate with external systems.
|
||||
### Troubleshoot
|
||||
|
||||
You can find extensions available from the official [Fleetbase Console](https://console.fleetbase.io), here you will also be able get your registry token to install extensions to a self-hosted Fleetbase instance.
|
||||
Have an issue with the installation, try a few of these workarounds.
|
||||
|
||||
Additionally you're able to develop and publish your own extensions as well which you can read more about developing extensions via the [extension building guide](https://docs.fleetbase.io/developers/building-an-extension).
|
||||
<ul>
|
||||
<li><strong>Installer not working?</strong> <br>If you encounter issues with the web based installer use this workaround to get going.
|
||||
<ol>
|
||||
<li>Login to the application container.
|
||||
<pre class="bash">docker exec -ti fleetbase-application-1 bash</pre>
|
||||
</li>
|
||||
<li>Manually run the database setup and migrations.
|
||||
<pre class="bash">php artisan mysql:createdb
|
||||
php artisan migrate:refresh --seed</pre>
|
||||
</li>
|
||||
<li>After completing these steps you should be able to proceed with account creation.</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
## ⌨️ Fleetbase CLI
|
||||
### Access Fleetbase
|
||||
|
||||
The Fleetbase CLI is a powerful tool designed to simplify the management of extensions for your Fleetbase instance. With the CLI, you can effortlessly handle authentication, install and uninstall extensions, and scaffold new extensions if you are developing your own.
|
||||
Now that Fleetbase is up and running via Docker you can find the console and the API accessible:
|
||||
|
||||
Get started with the CLI with npm:
|
||||
<ul>
|
||||
<li>Fleetbase Console: <code>http://localhost:4200</code></li>
|
||||
<li>Fleetbase API: <code>http://localhost:8000</code></li>
|
||||
</ul>
|
||||
|
||||
```bash
|
||||
npm i -g @fleetbase/cli
|
||||
```
|
||||
# 🧩 Extensions
|
||||
|
||||
Once installed, you can access a variety of commands to manage your Fleetbase extensions.
|
||||
Fleetbase extensions provide a powerful way to enhance and customize the functionality of Fleetbase to suit your specific needs. They are standalone modules that seamlessly integrate with Fleetbase's frontend and backend, allowing you to extend its capabilities.
|
||||
|
||||
### What are Fleetbase Extensions?
|
||||
Fleetbase Extensions are built using both a backend PHP package and a frontend Ember Engine Addon. They are designed to blend seamlessly into the Fleetbase ecosystem, utilizing shared services, utilities, stylesheets, components, and template helpers.
|
||||
|
||||
### How do Extensions Work?
|
||||
<ul>
|
||||
<li><strong>Backend</strong>: The backend of an extension is developed as a PHP package. This package should utilize the composer package <code>fleetbase/core-api</code>, which provides core API functionalities, making it easier to integrate your extension with Fleetbase's backend.</li>
|
||||
|
||||
<li><strong>Engine</strong>: The frontend of an extension is built as an Ember Engine Addon. The Addon must require the packages <code>@fleetbase/ember-core</code> and <code>@fleetbase/ember-ui</code>. The <code>@fleetbase/ember-core</code> package provides core services and utilities that help to align your extension with Fleetbase's frontend. The <code>@fleetbase/ember-ui</code> package, on the other hand, supplies all the stylesheets, components, and template helpers needed to design a Fleetbase extension that seamlessly matches the look and feel of the Fleetbase UI.</li>
|
||||
</ul>
|
||||
|
||||
### Building a Fleetbase Extension
|
||||
To create a Fleetbase extension, follow these steps:
|
||||
|
||||
<ul>
|
||||
<li><strong>Backend PHP Package Creation</strong>: Begin by creating a backend PHP package. Make sure to use the composer package <code>fleetbase/core-api</code> to ensure smooth integration with Fleetbase's backend.</li>
|
||||
|
||||
<li><strong>Frontend Ember Engine Addon</strong>: Next, you need to create the frontend of the extension using Ember Engine. Be sure to include the <code>@fleetbase/ember-core</code> and <code>@fleetbase/ember-ui</code> packages. These packages provide necessary services, utilities, and design components for aligning your extension with Fleetbase's UI.</li>
|
||||
|
||||
<li><strong>Integrate Your Extension</strong>: Once you have the backend and frontend ready, you can integrate your extension into Fleetbase by installing it via the respective package managers. In the future you will be able to publish your extension to the Fleetbase extensions repository making it available to all instances of Fleetbase with the ability to even sell your extension.</li>
|
||||
</ul>
|
||||
|
||||
With Fleetbase's modular architecture, you can develop your extensions to solve unique problems, enhance existing functionality, or add entirely new capabilities to your Fleetbase instance. This extensibility allows Fleetbase to adapt and evolve with your growing business needs.
|
||||
|
||||
# 📱 Apps
|
||||
|
||||
@@ -204,33 +278,42 @@ Fleetbase offers a few open sourced apps which are built on Fleetbase which can
|
||||
<li><a href="https://github.com/fleetbase/navigator-app">Navigator App</a>: Fleetbase based driver app which can be used for drivers to manage and update order, additionally provides real time driver location which can be viewed in the Fleetbase Console.</li>
|
||||
</ul>
|
||||
|
||||
## 🛣️ Roadmap
|
||||
1. **Inventory and Warehouse Management** ~ Pallet will be Fleetbase’s first official extension for WMS & Inventory.
|
||||
2. **Accounting and Invoicing** ~ Ledger will be Fleetbase’s first official extension accounting and invoicing.
|
||||
3. **AI** ~ AI Agent intrgation for system and workflows.
|
||||
4. **Dynamic Rules System** ~ Trigger events, tasks jobs from a rule builder on resources.
|
||||
# 🛣 Roadmap
|
||||
|
||||
## 🪲 Bugs and 💡 Feature Requests
|
||||
<ol>
|
||||
<li>Open Source Extension Repository</li>
|
||||
<li>🌎 Internationalize</li>
|
||||
<li>Multiple and Custom Routing Engine's in FleetOps</li>
|
||||
<li>Identity & Access Management (IAM) Extension</li>
|
||||
<li>Inventory and Warehouse Management Extension</li>
|
||||
<li>Freight Forwarder Quote Parser/ System Extension</li>
|
||||
</ol>
|
||||
|
||||
# 🪲 Bugs and 💡 Feature Requests
|
||||
|
||||
Have a bug or a feature request? Please check the <a href="https://github.com/fleetbase/fleetbase/issues">issue tracker</a> and search for existing and closed issues. If your problem or idea is not addressed yet, please <a href="https://github.com/fleetbase/fleetbase/issues/new">open a new issue</a>.
|
||||
|
||||
## 👨💻 Contributing
|
||||
# 📚 Documentation
|
||||
|
||||
View and contribute to our <a href="https://github.com/fleetbase/guides">Fleetbase Guide's</a> and <a href="https://github.com/fleetbase/api-reference">API Reference</a>
|
||||
|
||||
# 👨💻 Contributing
|
||||
|
||||
Please read through our <a href="https://github.com/fleetbase/fleetbase/blob/main/CONTRIBUTING.md">contributing guidelines</a>. Included are directions for opening issues, coding standards, and notes on development.
|
||||
|
||||
## 👥 Community
|
||||
# 👥 Community
|
||||
|
||||
Get updates on Fleetbase's development and chat with the project maintainers and community members by joining our <a href="https://discord.gg/V7RVWRQ2Wm">Discord</a>.
|
||||
|
||||
<ul>
|
||||
<li>Follow <a href="https://x.com/fleetbase_io">@fleetbase_io on X</a>.</li>
|
||||
<li>Follow <a href="https://twitter.com/fleetbase_io">@fleetbase_io on Twitter</a>.</li>
|
||||
<li>Read and subscribe to <a href="https://www.fleetbase.io/blog-2">The Official Fleetbase Blog</a>.</li>
|
||||
<li>Ask and explore <a href="https://github.com/orgs/fleetbase/discussions">our GitHub Discussions</a>.</li>
|
||||
</ul>
|
||||
<p dir="auto">See the <a href="https://github.com/fleetbase/fleetbase/releases">Releases</a> section of our GitHub project for changelogs for each release version of Fleetbase.</p>
|
||||
<p>Release announcement posts on <a href="https://www.fleetbase.io/blog-2" rel="nofollow">the official Fleetbase blog</a> contain summaries of the most noteworthy changes made in each release.</p>
|
||||
|
||||
## Creators
|
||||
# Creators
|
||||
|
||||
<p dir="auto"><strong>Ronald A. Richardson</strong>- Co-founder & CTO</p>
|
||||
<img src="https://user-images.githubusercontent.com/58805033/230263021-212f2553-1269-473d-be94-313cb3eecfa5.png" alt="Ron Image" width="75" height="75" style="max-width: 100%;">
|
||||
@@ -243,5 +326,4 @@ Get updates on Fleetbase's development and chat with the project maintainers and
|
||||
|
||||
# License & Copyright
|
||||
|
||||
Fleetbase is made available under the terms of the <a href="https://www.gnu.org/licenses/agpl-3.0.html" target="_blank">GNU Affero General Public License 3.0 (AGPL 3.0)</a>. For other licenses <a href="mailto:hello@fleetbase.io" target="_blank">contact us</a>.
|
||||
|
||||
Code and documentation copyright 2018–2023 the <a href="https://github.com/fleetbase/fleetbase/graphs/contributors">Fleetbase Authors</a>. Code released under the <a href="https://github.com/fleetbase/storefront-app/blob/main/LICENSE.md">MIT License</a>.
|
||||
|
||||
37
RELEASE.md
37
RELEASE.md
@@ -1,37 +0,0 @@
|
||||
# 🚀 Fleetbase v0.7.19 — 2025-11-17
|
||||
|
||||
> "A major leap forward in scheduling, reporting, and user interface capabilities."
|
||||
|
||||
---
|
||||
|
||||
## ✨ Highlights
|
||||
- **Core Scheduling Module**: A comprehensive, polymorphic, and reusable scheduling system has been integrated into the core API, providing the foundation for a wide range of scheduling applications.
|
||||
- **Driver Scheduling with HOS Compliance**: FleetOps now includes built-in compliance for FMCSA Hours of Service regulations.
|
||||
- **Computed Columns in Query Builder**: The query builder now supports computed columns, allowing for more complex and powerful data queries with secure expression validation.
|
||||
- **Advanced Table Functionality**: The Ember UI table component now supports multi-column sorting, horizontal scrolling, and sticky columns.
|
||||
- **New Filter Components**: New filter components for multi-input and range selection have been added to the Ember UI.
|
||||
- **Dispatched Flag Control**: The order creation process in FleetOps now allows for explicit control over the dispatch behavior.
|
||||
- **Vehicle Attributes Enhancement**: The vehicle model and API resources in FleetOps have been enhanced with additional attributes.
|
||||
|
||||
---
|
||||
|
||||
## ⚠️ Breaking Changes
|
||||
- None
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Upgrade Steps
|
||||
```bash
|
||||
# Pull latest version
|
||||
git pull origin main --no-rebase
|
||||
|
||||
# Update docker
|
||||
docker compose pull
|
||||
docker compose down && docker compose up -d
|
||||
|
||||
# Run deploy script
|
||||
docker compose exec application bash -c "./deploy.sh"
|
||||
```
|
||||
|
||||
## Need help?
|
||||
Join the discussion on [GitHub Discussions](https://github.com/fleetbase/fleetbase/discussions) or drop by [#fleetbase on Discord](https://discord.com/invite/HnTqQ6zAVn)
|
||||
5
api/.gitignore
vendored
5
api/.gitignore
vendored
@@ -13,7 +13,4 @@ npm-debug.log
|
||||
yarn-error.log
|
||||
/.idea
|
||||
/.vscode
|
||||
.composer.dev.json
|
||||
/caddy
|
||||
frankenphp
|
||||
frankenphp-worker.php
|
||||
.composer.dev.json
|
||||
@@ -16,7 +16,7 @@ class Kernel extends HttpKernel
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
@@ -40,6 +40,7 @@ class Kernel extends HttpKernel
|
||||
],
|
||||
|
||||
'api' => [
|
||||
// \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
@@ -15,15 +17,17 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(
|
||||
function () {
|
||||
Route::get(
|
||||
'/health',
|
||||
function (Request $request) {
|
||||
'/status',
|
||||
function () {
|
||||
return response()->json(
|
||||
[
|
||||
'status' => 'ok',
|
||||
'time' => microtime(true) - $request->attributes->get('request_start_time')
|
||||
'time' => microtime(true) - LARAVEL_START
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -31,4 +35,19 @@ class RouteServiceProvider extends ServiceProvider
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for(
|
||||
'api',
|
||||
function (Request $request) {
|
||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +1,42 @@
|
||||
{
|
||||
"name": "fleetbase/fleetbase",
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "Modular logistics and supply chain operating system (LSOS)",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fleetbase Pte Ltd.",
|
||||
"email": "hello@fleetbase.io"
|
||||
},
|
||||
{
|
||||
"name": "Ronald A. Richardson",
|
||||
"email": "ron@fleetbase.io"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.0",
|
||||
"appstract/laravel-opcache": "^4.0",
|
||||
"fleetbase/core-api": "^1.6.25",
|
||||
"fleetbase/fleetops-api": "^0.6.26",
|
||||
"fleetbase/registry-bridge": "^0.1.0",
|
||||
"fleetbase/storefront-api": "^0.4.7",
|
||||
"php": "^7.3|^8.0",
|
||||
"fleetbase/core-api": "^1.3.2",
|
||||
"fleetbase/fleetops-api": "^0.3.5",
|
||||
"fleetbase/storefront-api": "^0.2.4",
|
||||
"fleetbase/solid-api": "^0.0.1",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/octane": "^2.3",
|
||||
"laravel/tinker": "^2.9",
|
||||
"league/flysystem-aws-s3-v3": "^3.0",
|
||||
"laravel/framework": "^8.75",
|
||||
"laravel/sanctum": "^2.11",
|
||||
"laravel/tinker": "^2.5",
|
||||
"league/flysystem-aws-s3-v3": "^1.0",
|
||||
"maatwebsite/excel": "^3.1",
|
||||
"maennchen/zipstream-php": "3.1.2",
|
||||
"phpoffice/phpspreadsheet": "^1.28",
|
||||
"predis/predis": "^2.1",
|
||||
"psr/http-factory-implementation": "*",
|
||||
"resend/resend-php": "^0.14.0",
|
||||
"s-ichikawa/laravel-sendgrid-driver": "^4.0",
|
||||
"stripe/stripe-php": "13.13.0",
|
||||
"symfony/mailgun-mailer": "^7.1",
|
||||
"symfony/postmark-mailer": "^7.1"
|
||||
"psr/http-factory-implementation": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"spatie/laravel-ignition": "^2.0",
|
||||
"facade/ignition": "^2.5",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"kitloong/laravel-migrations-generator": "^6.10",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
"phpunit/phpunit": "^10.0"
|
||||
"nunomaduro/collision": "^5.10",
|
||||
"phpunit/phpunit": "^9.5.10"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "https://registry.fleetbase.io"
|
||||
"type": "path",
|
||||
"url": "../packages/solid"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
@@ -89,6 +74,15 @@
|
||||
],
|
||||
"clean-logs": [
|
||||
"composer run-script clear-logs"
|
||||
],
|
||||
"dock": [
|
||||
"docker exec -it fleetbase_os_application_1 /usr/bin/tmux -u new"
|
||||
],
|
||||
"dock-server": [
|
||||
"docker exec -it fleetbase_os_httpd_1 /bin/sh"
|
||||
],
|
||||
"tunnel": [
|
||||
"ngrok http --region=ap --hostname=fleetbase.ap.ngrok.io 8000"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
@@ -97,7 +91,6 @@
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"secure-http": false,
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
|
||||
11840
api/composer.lock
generated
11840
api/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Fleetbase'),
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -26,7 +26,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', env('ENVIRONMENT', 'production')),
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -52,7 +52,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost:8000'),
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
'asset_url' => env('ASSET_URL', null),
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Fleetbase\Support\Utils;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
@@ -17,17 +15,17 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['*', 'sanctum/csrf-cookie'],
|
||||
'paths' => ['/*', 'sanctum/csrf-cookie'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => array_filter(['http://localhost:4200', env('CONSOLE_HOST'), Utils::addWwwToUrl(env('CONSOLE_HOST')), ...Utils::arrayFrom(env('FRONTEND_HOSTS', ''))]),
|
||||
'allowed_origins' => ['http://localhost:4200', env('CONSOLE_HOST')],
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
|
||||
'allowed_headers' => ['*'],
|
||||
|
||||
'exposed_headers' => ['x-compressed-json', 'access-console-sandbox', 'access-console-sandbox-key'],
|
||||
'exposed_headers' => [],
|
||||
|
||||
'max_age' => 0,
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DRIVER', 'public'),
|
||||
'default' => env('FILESYSTEM_DRIVER', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -32,13 +32,13 @@ return [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app')
|
||||
'root' => storage_path('app'),
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL') . '/storage',
|
||||
'url' => env('APP_URL').'/storage',
|
||||
],
|
||||
|
||||
's3' => [
|
||||
@@ -51,15 +51,6 @@ return [
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
],
|
||||
|
||||
'gcs' => [
|
||||
'driver' => 'gcs',
|
||||
'project_id' => env('GOOGLE_CLOUD_PROJECT_ID', 'your-project-id'),
|
||||
'key_file' => env('GOOGLE_CLOUD_KEY_FILE', null),
|
||||
'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', env('AWS_BUCKET')),
|
||||
'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', null),
|
||||
'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', env('AWS_URL')),
|
||||
'visibility_handler' => \League\Flysystem\GoogleCloudStorage\UniformBucketLevelAccessVisibility::class,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
@@ -74,7 +65,8 @@ return [
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public')
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
public_path('uploads') => storage_path('app/uploads'),
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -60,24 +60,6 @@ return [
|
||||
'transport' => 'postmark',
|
||||
],
|
||||
|
||||
'sendgrid' => [
|
||||
'transport' => 'sendgrid',
|
||||
],
|
||||
|
||||
'resend' => [],
|
||||
|
||||
'microsoft-graph' => [
|
||||
'transport' => 'microsoft-graph',
|
||||
'client_id' => env('MICROSOFT_GRAPH_CLIENT_ID'),
|
||||
'client_secret' => env('MICROSOFT_GRAPH_CLIENT_SECRET'),
|
||||
'tenant_id' => env('MICROSOFT_GRAPH_TENANT_ID'),
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@fleetbase.io'),
|
||||
'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Fleetbase')),
|
||||
],
|
||||
'save_to_sent_items' => env('MAIL_SAVE_TO_SENT_ITEMS', false),
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -i'),
|
||||
@@ -114,7 +96,7 @@ return [
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@fleetbase.io'),
|
||||
'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Fleetbase')),
|
||||
'name' => env('MAIL_FROM_NAME', 'Fleetbase'),
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,225 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Fleetbase\Support\Utils;
|
||||
use Laravel\Octane\Contracts\OperationTerminated;
|
||||
use Laravel\Octane\Events\RequestHandled;
|
||||
use Laravel\Octane\Events\RequestReceived;
|
||||
use Laravel\Octane\Events\RequestTerminated;
|
||||
use Laravel\Octane\Events\TaskReceived;
|
||||
use Laravel\Octane\Events\TaskTerminated;
|
||||
use Laravel\Octane\Events\TickReceived;
|
||||
use Laravel\Octane\Events\TickTerminated;
|
||||
use Laravel\Octane\Events\WorkerErrorOccurred;
|
||||
use Laravel\Octane\Events\WorkerStarting;
|
||||
use Laravel\Octane\Events\WorkerStopping;
|
||||
use Laravel\Octane\Listeners\CollectGarbage;
|
||||
use Laravel\Octane\Listeners\DisconnectFromDatabases;
|
||||
use Laravel\Octane\Listeners\EnsureUploadedFilesAreValid;
|
||||
use Laravel\Octane\Listeners\EnsureUploadedFilesCanBeMoved;
|
||||
use Laravel\Octane\Listeners\FlushOnce;
|
||||
use Laravel\Octane\Listeners\FlushTemporaryContainerInstances;
|
||||
use Laravel\Octane\Listeners\FlushUploadedFiles;
|
||||
use Laravel\Octane\Listeners\ReportException;
|
||||
use Laravel\Octane\Listeners\StopWorkerIfNecessary;
|
||||
use Laravel\Octane\Octane;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Server
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the default "server" that will be used by Octane
|
||||
| when starting, restarting, or stopping your server via the CLI. You
|
||||
| are free to change this to the supported server of your choosing.
|
||||
|
|
||||
| Supported: "roadrunner", "swoole", "frankenphp"
|
||||
|
|
||||
*/
|
||||
|
||||
'server' => env('OCTANE_SERVER', 'frankenphp'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Force HTTPS
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When this configuration value is set to "true", Octane will inform the
|
||||
| framework that all absolute links must be generated using the HTTPS
|
||||
| protocol. Otherwise your links may be generated using plain HTTP.
|
||||
|
|
||||
*/
|
||||
|
||||
'https' => env('OCTANE_HTTPS', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Listeners
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All of the event listeners for Octane's events are defined below. These
|
||||
| listeners are responsible for resetting your application's state for
|
||||
| the next request. You may even add your own listeners to the list.
|
||||
|
|
||||
*/
|
||||
|
||||
'listeners' => [
|
||||
WorkerStarting::class => [
|
||||
EnsureUploadedFilesAreValid::class,
|
||||
EnsureUploadedFilesCanBeMoved::class,
|
||||
],
|
||||
|
||||
RequestReceived::class => [
|
||||
...Octane::prepareApplicationForNextOperation(),
|
||||
...Octane::prepareApplicationForNextRequest(),
|
||||
//
|
||||
],
|
||||
|
||||
RequestHandled::class => [
|
||||
//
|
||||
],
|
||||
|
||||
RequestTerminated::class => [
|
||||
// FlushUploadedFiles::class,
|
||||
],
|
||||
|
||||
TaskReceived::class => [
|
||||
...Octane::prepareApplicationForNextOperation(),
|
||||
//
|
||||
],
|
||||
|
||||
TaskTerminated::class => [
|
||||
//
|
||||
],
|
||||
|
||||
TickReceived::class => [
|
||||
...Octane::prepareApplicationForNextOperation(),
|
||||
//
|
||||
],
|
||||
|
||||
TickTerminated::class => [
|
||||
//
|
||||
],
|
||||
|
||||
OperationTerminated::class => [
|
||||
FlushOnce::class,
|
||||
FlushTemporaryContainerInstances::class,
|
||||
// DisconnectFromDatabases::class,
|
||||
// CollectGarbage::class,
|
||||
],
|
||||
|
||||
WorkerErrorOccurred::class => [
|
||||
ReportException::class,
|
||||
StopWorkerIfNecessary::class,
|
||||
],
|
||||
|
||||
WorkerStopping::class => [
|
||||
//
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Warm / Flush Bindings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The bindings listed below will either be pre-warmed when a worker boots
|
||||
| or they will be flushed before every new request. Flushing a binding
|
||||
| will force the container to resolve that binding again when asked.
|
||||
|
|
||||
*/
|
||||
|
||||
'warm' => [
|
||||
...Octane::defaultServicesToWarm(),
|
||||
],
|
||||
|
||||
'flush' => [
|
||||
//
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Swoole Tables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using Swoole, you may define additional tables as required by the
|
||||
| application. These tables can be used to store data that needs to be
|
||||
| quickly accessed by other workers on the particular Swoole server.
|
||||
|
|
||||
*/
|
||||
|
||||
'tables' => [
|
||||
'example:1000' => [
|
||||
'name' => 'string:1000',
|
||||
'votes' => 'int',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Swoole Cache Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using Swoole, you may leverage the Octane cache, which is powered
|
||||
| by a Swoole table. You may set the maximum number of rows as well as
|
||||
| the number of bytes per row using the configuration options below.
|
||||
|
|
||||
*/
|
||||
|
||||
'cache' => [
|
||||
'rows' => 1000,
|
||||
'bytes' => 10000,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File Watching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following list of files and directories will be watched when using
|
||||
| the --watch option offered by Octane. If any of the directories and
|
||||
| files are changed, Octane will automatically reload your workers.
|
||||
|
|
||||
*/
|
||||
|
||||
'watch' => [
|
||||
'app',
|
||||
'bootstrap',
|
||||
'config',
|
||||
'database',
|
||||
'public/**/*.php',
|
||||
'resources/**/*.php',
|
||||
'routes',
|
||||
'composer.lock',
|
||||
'.env',
|
||||
...Utils::arrayFrom(env('OCTANE_WATCH_DIRS'))
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Garbage Collection Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When executing long-lived PHP scripts such as Octane, memory can build
|
||||
| up before being cleared by PHP. You can force Octane to run garbage
|
||||
| collection if your application consumes this amount of megabytes.
|
||||
|
|
||||
*/
|
||||
|
||||
'garbage' => 50,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maximum Execution Time
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following setting configures the maximum execution time for requests
|
||||
| being handled by Octane. You may set this value to 0 to indicate that
|
||||
| there isn't a specific time limit on Octane request execution time.
|
||||
|
|
||||
*/
|
||||
|
||||
'max_execution_time' => 30,
|
||||
|
||||
];
|
||||
@@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'url' => env('OPCACHE_URL', config('app.url')),
|
||||
'prefix' => 'opcache-api',
|
||||
'verify' => true,
|
||||
'headers' => [],
|
||||
'directories' => [
|
||||
base_path('app'),
|
||||
base_path('bootstrap'),
|
||||
base_path('public'),
|
||||
base_path('resources'),
|
||||
base_path('routes'),
|
||||
base_path('storage'),
|
||||
base_path('vendor'),
|
||||
],
|
||||
'exclude' => [
|
||||
'test',
|
||||
'Test',
|
||||
'tests',
|
||||
'Tests',
|
||||
'stub',
|
||||
'Stub',
|
||||
'stubs',
|
||||
'Stubs',
|
||||
'dumper',
|
||||
'Dumper',
|
||||
'Autoload',
|
||||
],
|
||||
];
|
||||
@@ -30,17 +30,4 @@ return [
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'sendgrid' => [
|
||||
'api_key' => env('SENDGRID_API_KEY'),
|
||||
],
|
||||
|
||||
'resend' => [
|
||||
'key' => env('RESEND_KEY'),
|
||||
],
|
||||
|
||||
'stripe' => [
|
||||
'key' => env('STRIPE_KEY', env('STRIPE_API_KEY')),
|
||||
'secret' => env('STRIPE_SECRET', env('STRIPE_API_SECRET')),
|
||||
'webhook_secret' => env('STRIPE_WEBHOOK_SECRET'),
|
||||
],
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# Exit the script as soon as a command fails
|
||||
set -e
|
||||
@@ -13,27 +13,4 @@ php artisan migrate --force
|
||||
php artisan sandbox:migrate --force
|
||||
|
||||
# Seed database
|
||||
php artisan fleetbase:seed
|
||||
|
||||
# Create permissions, policies, and roles
|
||||
php artisan fleetbase:create-permissions
|
||||
|
||||
# Restart queue
|
||||
php artisan queue:restart
|
||||
|
||||
# Sync scheduler
|
||||
php artisan schedule-monitor:sync
|
||||
|
||||
# Clear cache
|
||||
php artisan cache:clear
|
||||
php artisan route:clear
|
||||
|
||||
# Optimize
|
||||
php artisan config:cache
|
||||
php artisan route:cache
|
||||
|
||||
# Initialize registry
|
||||
php artisan registry:init
|
||||
|
||||
# Restart octane
|
||||
# php artisan octane:reload
|
||||
php artisan fleetbase:seed
|
||||
5622
api/pnpm-lock.yaml
generated
5622
api/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
1
api/public/uploads
Symbolic link
1
api/public/uploads
Symbolic link
@@ -0,0 +1 @@
|
||||
/var/www/html/api/storage/app/uploads
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| أسطر لغة المصادقة
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| تحتوي الأسطر التالية على رسائل المصادقة التي نعرضها للمستخدم أثناء
|
||||
| عمليات تسجيل الدخول أو غيرها. يمكنك تعديل هذه الرسائل حسب متطلباتك.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => 'بيانات الاعتماد هذه غير متطابقة مع سجلاتنا.',
|
||||
'password' => 'كلمة المرور التي تم إدخالها غير صحيحة.',
|
||||
'throttle' => 'عدد كبير جداً من محاولات الدخول. يرجى المحاولة مرة أخرى خلال :seconds ثانية.',
|
||||
|
||||
];
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| أسطر لغة الترقيم الصفحي
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| تُستخدم الأسطر التالية من قبل مكتبة الترقيم الصفحي لبناء روابط
|
||||
| الترقيم البسيطة. يمكنك تعديلها كما تشاء لتخصيص العرض بما يناسب
|
||||
| تطبيقك بشكل أفضل.
|
||||
|
|
||||
*/
|
||||
|
||||
'previous' => '« السابق',
|
||||
'next' => 'التالي »',
|
||||
|
||||
];
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| أسطر لغة إعادة تعيين كلمة المرور
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| الأسطر التالية هي الرسائل الافتراضية التي يقدمها نظام إعادة تعيين
|
||||
| كلمة المرور عند فشل المحاولة، مثل رمز التحقق غير صالح أو كلمة مرور جديدة غير صحيحة.
|
||||
|
|
||||
*/
|
||||
|
||||
'reset' => 'تم إعادة تعيين كلمة المرور الخاصة بك!',
|
||||
'sent' => 'لقد أرسلنا رابط إعادة تعيين كلمة المرور إلى بريدك الإلكتروني!',
|
||||
'throttled' => 'يرجى الانتظار قبل المحاولة مرة أخرى.',
|
||||
'token' => 'رمز إعادة تعيين كلمة المرور هذا غير صالح.',
|
||||
'user' => 'لا يمكننا العثور على مستخدم بهذا العنوان الإلكتروني.',
|
||||
|
||||
];
|
||||
@@ -1,168 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines contain the default error messages used by
|
||||
| the validator class. Some of these rules have multiple versions such
|
||||
| as the size rules. Feel free to tweak each of these messages here.
|
||||
|
|
||||
*/
|
||||
|
||||
'accepted' => 'يجب قبول :attribute.',
|
||||
'accepted_if' => 'يجب قبول :attribute عندما يكون :other يساوي :value.',
|
||||
'active_url' => ':attribute ليس عنوان URL صالحًا.',
|
||||
'after' => 'يجب أن يكون :attribute تاريخًا بعد :date.',
|
||||
'after_or_equal' => 'يجب أن يكون :attribute تاريخًا بعد أو يساوي :date.',
|
||||
'alpha' => 'يجب أن يحتوي :attribute على أحرف فقط.',
|
||||
'alpha_dash' => 'يجب أن يحتوي :attribute على أحرف وأرقام وشرطات فقط.',
|
||||
'alpha_num' => 'يجب أن يحتوي :attribute على أحرف وأرقام فقط.',
|
||||
'array' => 'يجب أن يكون :attribute مصفوفة.',
|
||||
'before' => 'يجب أن يكون :attribute تاريخًا قبل :date.',
|
||||
'before_or_equal' => 'يجب أن يكون :attribute تاريخًا قبل أو يساوي :date.',
|
||||
'between' => [
|
||||
'numeric' => 'يجب أن يكون :attribute بين :min و :max.',
|
||||
'file' => 'يجب أن يكون :attribute بين :min و :max كيلوبايت.',
|
||||
'string' => 'يجب أن يكون :attribute بين :min و :max حرفًا.',
|
||||
'array' => 'يجب أن يحتوي :attribute على عدد عناصر بين :min و :max.',
|
||||
],
|
||||
'boolean' => 'يجب أن يكون حقل :attribute صحيحًا أو خاطئًا.',
|
||||
'confirmed' => 'تأكيد :attribute غير متطابق.',
|
||||
'current_password' => 'كلمة المرور غير صحيحة.',
|
||||
'date' => ':attribute ليس تاريخًا صالحًا.',
|
||||
'date_equals' => 'يجب أن يكون :attribute تاريخًا يساوي :date.',
|
||||
'date_format' => 'لا يتطابق :attribute مع الصيغة :format.',
|
||||
'declined' => 'يجب رفض :attribute.',
|
||||
'declined_if' => 'يجب رفض :attribute عندما يكون :other يساوي :value.',
|
||||
'different' => 'يجب أن يكون :attribute و :other مختلفين.',
|
||||
'digits' => 'يجب أن يتكون :attribute من :digits أرقام.',
|
||||
'digits_between' => 'يجب أن يتكون :attribute من :min إلى :max أرقام.',
|
||||
'dimensions' => ':attribute يحتوي على أبعاد صورة غير صالحة.',
|
||||
'distinct' => 'حقل :attribute يحتوي على قيمة مكررة.',
|
||||
'email' => 'يجب أن يكون :attribute عنوان بريد إلكتروني صالحًا.',
|
||||
'ends_with' => 'يجب أن ينتهي :attribute بأحد القيم التالية: :values.',
|
||||
'enum' => ':attribute المحدد غير صالح.',
|
||||
'exists' => ':attribute المحدد غير صالح.',
|
||||
'file' => 'يجب أن يكون :attribute ملفًا.',
|
||||
'filled' => 'يجب أن يحتوي حقل :attribute على قيمة.',
|
||||
'gt' => [
|
||||
'numeric' => 'يجب أن يكون :attribute أكبر من :value.',
|
||||
'file' => 'يجب أن يكون :attribute أكبر من :value كيلوبايت.',
|
||||
'string' => 'يجب أن يكون :attribute أكبر من :value حرفًا.',
|
||||
'array' => 'يجب أن يحتوي :attribute على أكثر من :value عنصر.',
|
||||
],
|
||||
'gte' => [
|
||||
'numeric' => 'يجب أن يكون :attribute أكبر من أو يساوي :value.',
|
||||
'file' => 'يجب أن يكون :attribute أكبر من أو يساوي :value كيلوبايت.',
|
||||
'string' => 'يجب أن يكون :attribute أكبر من أو يساوي :value حرفًا.',
|
||||
'array' => 'يجب أن يحتوي :attribute على :value عنصر أو أكثر.',
|
||||
],
|
||||
'image' => 'يجب أن يكون :attribute صورة.',
|
||||
'in' => ':attribute المحدد غير صالح.',
|
||||
'in_array' => 'حقل :attribute غير موجود في :other.',
|
||||
'integer' => 'يجب أن يكون :attribute عددًا صحيحًا.',
|
||||
'ip' => 'يجب أن يكون :attribute عنوان IP صالحًا.',
|
||||
'ipv4' => 'يجب أن يكون :attribute عنوان IPv4 صالحًا.',
|
||||
'ipv6' => 'يجب أن يكون :attribute عنوان IPv6 صالحًا.',
|
||||
'json' => 'يجب أن يكون :attribute نصًا بصيغة JSON صالحة.',
|
||||
'lt' => [
|
||||
'numeric' => 'يجب أن يكون :attribute أقل من :value.',
|
||||
'file' => 'يجب أن يكون :attribute أقل من :value كيلوبايت.',
|
||||
'string' => 'يجب أن يكون :attribute أقل من :value حرفًا.',
|
||||
'array' => 'يجب أن يحتوي :attribute على أقل من :value عنصر.',
|
||||
],
|
||||
'lte' => [
|
||||
'numeric' => 'يجب أن يكون :attribute أقل من أو يساوي :value.',
|
||||
'file' => 'يجب أن يكون :attribute أقل من أو يساوي :value كيلوبايت.',
|
||||
'string' => 'يجب أن يكون :attribute أقل من أو يساوي :value حرفًا.',
|
||||
'array' => 'يجب ألا يحتوي :attribute على أكثر من :value عنصر.',
|
||||
],
|
||||
'mac_address' => 'يجب أن يكون :attribute عنوان MAC صالحًا.',
|
||||
'max' => [
|
||||
'numeric' => 'يجب ألا يتجاوز :attribute :max.',
|
||||
'file' => 'يجب ألا يتجاوز :attribute :max كيلوبايت.',
|
||||
'string' => 'يجب ألا يتجاوز :attribute :max حرفًا.',
|
||||
'array' => 'يجب ألا يحتوي :attribute على أكثر من :max عنصر.',
|
||||
],
|
||||
'mimes' => 'يجب أن يكون :attribute ملفًا من النوع: :values.',
|
||||
'mimetypes' => 'يجب أن يكون :attribute ملفًا من النوع: :values.',
|
||||
'min' => [
|
||||
'numeric' => 'يجب أن يكون :attribute على الأقل :min.',
|
||||
'file' => 'يجب أن يكون :attribute على الأقل :min كيلوبايت.',
|
||||
'string' => 'يجب أن يكون :attribute على الأقل :min حرفًا.',
|
||||
'array' => 'يجب أن يحتوي :attribute على الأقل على :min عنصر.',
|
||||
],
|
||||
'multiple_of' => 'يجب أن يكون :attribute مضاعفًا لـ :value.',
|
||||
'not_in' => ':attribute المحدد غير صالح.',
|
||||
'not_regex' => 'صيغة :attribute غير صالحة.',
|
||||
'numeric' => 'يجب أن يكون :attribute رقمًا.',
|
||||
'password' => 'كلمة المرور غير صحيحة.',
|
||||
'present' => 'يجب أن يكون حقل :attribute موجودًا.',
|
||||
'prohibited' => 'حقل :attribute محظور.',
|
||||
'prohibited_if' => 'حقل :attribute محظور عندما يكون :other يساوي :value.',
|
||||
'prohibited_unless' => 'حقل :attribute محظور إلا إذا كان :other ضمن :values.',
|
||||
'prohibits' => 'حقل :attribute يحظر وجود :other.',
|
||||
'regex' => 'صيغة :attribute غير صالحة.',
|
||||
'required' => 'حقل :attribute مطلوب.',
|
||||
'required_array_keys' => 'يجب أن يحتوي حقل :attribute على إدخالات لـ: :values.',
|
||||
'required_if' => 'حقل :attribute مطلوب عندما يكون :other يساوي :value.',
|
||||
'required_unless' => 'حقل :attribute مطلوب إلا إذا كان :other ضمن :values.',
|
||||
'required_with' => 'حقل :attribute مطلوب عند وجود :values.',
|
||||
'required_with_all' => 'حقل :attribute مطلوب عند وجود جميع القيم :values.',
|
||||
'required_without' => 'حقل :attribute مطلوب عند عدم وجود :values.',
|
||||
'required_without_all' => 'حقل :attribute مطلوب عند عدم وجود أي من القيم :values.',
|
||||
'same' => 'يجب أن يتطابق :attribute مع :other.',
|
||||
'size' => [
|
||||
'numeric' => 'يجب أن يكون :attribute مساويًا لـ :size.',
|
||||
'file' => 'يجب أن يكون :attribute مساويًا لـ :size كيلوبايت.',
|
||||
'string' => 'يجب أن يكون :attribute مساويًا لـ :size حرفًا.',
|
||||
'array' => 'يجب أن يحتوي :attribute على :size عنصر.',
|
||||
],
|
||||
'starts_with' => 'يجب أن يبدأ :attribute بأحد القيم التالية: :values.',
|
||||
'string' => 'يجب أن يكون :attribute نصًا.',
|
||||
'timezone' => 'يجب أن يكون :attribute منطقة زمنية صالحة.',
|
||||
'unique' => 'تم استخدام :attribute مسبقًا.',
|
||||
'uploaded' => 'فشل تحميل :attribute.',
|
||||
'url' => 'يجب أن يكون :attribute عنوان URL صالحًا.',
|
||||
'uuid' => 'يجب أن يكون :attribute UUID صالحًا.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify custom validation messages for attributes using the
|
||||
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||
| specify a specific custom language line for a given attribute rule.
|
||||
|
|
||||
*/
|
||||
|
||||
'custom' => [
|
||||
'attribute-name' => [
|
||||
'rule-name' => 'رسالة مخصصة',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Attributes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used to swap our attribute placeholder
|
||||
| with something more reader friendly such as "E-Mail Address" instead
|
||||
| of "email". This simply helps us make our message more expressive.
|
||||
|
|
||||
*/
|
||||
|
||||
'attributes' => [],
|
||||
|
||||
];
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Resolve the directory the script is located in
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
|
||||
APP_NAME="Fleetbase"
|
||||
IMAGE_NAME="fleetbase-linux-static"
|
||||
CONTAINER_NAME="fleetbase-linux-build"
|
||||
DIST_DIR="$ROOT_DIR/builds/dist"
|
||||
BINARY_NAME="fleetbase-linux-x86_64"
|
||||
DOCKERFILE="$ROOT_DIR/builds/linux/static-build.Dockerfile"
|
||||
|
||||
# Ensure pkg-config archive is available
|
||||
SPC_DOWNLOADS_DIR="$SCRIPT_DIR/spc/downloads"
|
||||
PKG_TAR="pkg-config-0.29.2.tar.gz"
|
||||
PKG_URL="https://static-php-cli.fra1.digitaloceanspaces.com/static-php-cli/deps/pkg-config/${PKG_TAR}"
|
||||
|
||||
if [[ ! -f "${SPC_DOWNLOADS_DIR}/${PKG_TAR}" ]]; then
|
||||
echo "📥 pkg-config archive missing – downloading..."
|
||||
mkdir -p "${SPC_DOWNLOADS_DIR}"
|
||||
curl -L --retry 3 -o "${SPC_DOWNLOADS_DIR}/${PKG_TAR}" "${PKG_URL}"
|
||||
else
|
||||
echo "✅ pkg-config archive already present."
|
||||
fi
|
||||
|
||||
# Build the image
|
||||
echo "📦 Building static Linux binary for ${APP_NAME}..."
|
||||
docker build -f "$DOCKERFILE" -t "$IMAGE_NAME" .
|
||||
|
||||
# Create a container from the built image
|
||||
echo "📦 Creating container to extract binary..."
|
||||
docker create --name "$CONTAINER_NAME" "$IMAGE_NAME"
|
||||
|
||||
# Make sure dist folder exist
|
||||
mkdir -p "$DIST_DIR"
|
||||
|
||||
# Copy binary from container to local dist folder
|
||||
echo "📂 Extracting binary..."
|
||||
docker cp "$CONTAINER_NAME:/go/src/app/dist/frankenphp-linux-x86_64" "$DIST_DIR/$BINARY_NAME"
|
||||
|
||||
# Cleanup the temp container
|
||||
docker rm "$CONTAINER_NAME"
|
||||
|
||||
echo "✅ Build complete! Binary is located at: $DIST_DIR/$BINARY_NAME"
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class libgeos extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libgeos;
|
||||
|
||||
public const NAME = 'libgeos';
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
trait libgeos
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
FileSystem::resetDir($this->source_dir . '/build');
|
||||
|
||||
shell()->cd($this->source_dir . '/build')
|
||||
->setEnv([
|
||||
'CFLAGS' => $this->getLibExtraCFlags(),
|
||||
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
||||
'LIBS' => $this->getLibExtraLibs(),
|
||||
])
|
||||
->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF ..")
|
||||
->execWithEnv("make -j{$this->builder->concurrency}")
|
||||
->execWithEnv('make install');
|
||||
|
||||
$this->patchPkgconfPrefix(['geos.pc']);
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
# FROM --platform=linux/amd64 dunglas/frankenphp:static-builder
|
||||
FROM --platform=linux/amd64 docker.io/dunglas/frankenphp:static-builder@sha256:821526b776a26502735d83890cc0a0d579348c510ba6c777df0762cb1c50d967
|
||||
|
||||
WORKDIR /go/src/app
|
||||
|
||||
# Copy Fleetbase app
|
||||
COPY ../../api ./dist/app
|
||||
|
||||
# Set working directory to the embedded Fleetbase app
|
||||
WORKDIR /go/src/app/dist/app
|
||||
|
||||
# Setup for production environment
|
||||
ENV APP_ENV=production
|
||||
ENV APP_DEBUG=false
|
||||
ENV BROADCAST_DRIVER=socketcluster
|
||||
ENV OSRM_HOST="https://router.project-osrm.org"
|
||||
ENV REGISTRY_PREINSTALLED_EXTENSIONS=true
|
||||
|
||||
# Optional: Ensure writable storage
|
||||
RUN chmod -R 775 bootstrap/cache storage
|
||||
|
||||
# Set permissions for deploy script
|
||||
RUN chmod +x ./deploy.sh
|
||||
|
||||
# Move back to main app directory before running build-static.sh
|
||||
WORKDIR /go/src/app
|
||||
|
||||
# Install geos lib
|
||||
RUN apk add --no-cache geos geos-dev
|
||||
|
||||
# Inject the libgeos library handlers
|
||||
COPY ./builds/linux/spc/libgeos-linux.php ./dist/static-php-cli/src/SPC/builder/linux/library/libgeos.php
|
||||
COPY ./builds/linux/spc/libgeos-unix.php ./dist/static-php-cli/src/SPC/builder/unix/library/libgeos.php
|
||||
|
||||
# Patch source.json to add geos extension source
|
||||
RUN jq '. + {"php-geos": {"type": "url", "url": "https://github.com/libgeos/php-geos/archive/dfe1ab17b0f155cc315bc13c75689371676e02e1.zip", "license": [{"type": "file", "path": "php-geos-dfe1ab17b0f155cc315bc13c75689371676e02e1/MIT-LICENSE"}, {"type": "file", "path": "php-geos-dfe1ab17b0f155cc315bc13c75689371676e02e1/LGPL-2"}]}}' \
|
||||
./dist/static-php-cli/config/source.json > ./dist/static-php-cli/config/source.tmp.json && \
|
||||
mv ./dist/static-php-cli/config/source.tmp.json ./dist/static-php-cli/config/source.json
|
||||
|
||||
# Pathc source.json to add libgeos library
|
||||
RUN jq '. + {"libgeos": {"type": "url", "url": "https://download.osgeo.org/geos/geos-3.12.1.tar.bz2", "filename": "geos-3.12.1.tar.bz2", "extract": "geos-3.12.1", "build-dir": "build", "license": [{"type": "file", "path": "COPYING"}]}}' \
|
||||
./dist/static-php-cli/config/source.json > ./dist/static-php-cli/config/source.tmp.json && \
|
||||
mv ./dist/static-php-cli/config/source.tmp.json ./dist/static-php-cli/config/source.json
|
||||
|
||||
# Patch ext.json to add geos extension dynamically
|
||||
RUN jq '. + {"geos": {"type": "external", "arg-type": "enable", "source": "php-geos", "lib-depends": ["libgeos"]}}' \
|
||||
./dist/static-php-cli/config/ext.json > ./dist/static-php-cli/config/ext.tmp.json && \
|
||||
mv ./dist/static-php-cli/config/ext.tmp.json ./dist/static-php-cli/config/ext.json
|
||||
|
||||
# Patch lib.json to add libgeos
|
||||
RUN jq '. + {"libgeos": {"source": "libgeos", "static-libs-unix": ["libgeos.a", "libgeos_c.a"]}}' \
|
||||
./dist/static-php-cli/config/lib.json > ./dist/static-php-cli/config/lib.tmp.json && \
|
||||
mv ./dist/static-php-cli/config/lib.tmp.json ./dist/static-php-cli/config/lib.json
|
||||
|
||||
# Install dependencies for SPC CLI
|
||||
WORKDIR /go/src/app/dist/static-php-cli
|
||||
RUN composer install --no-dev -a
|
||||
|
||||
# Set PHP extensions to be built (including geos!)
|
||||
ENV PHP_EXTENSIONS="pdo_mysql,gd,bcmath,redis,intl,zip,gmp,apcu,opcache,imagick,sockets,pcntl,geos,iconv,mbstring,fileinfo,ctype,tokenizer,simplexml,dom,filter,session"
|
||||
ENV PHP_EXTENSION_LIBS="libgeos,libzip,bzip2,libxml2,openssl,zlib"
|
||||
|
||||
# Force SPC to use the local source version (not download binary)
|
||||
ENV SPC_REL_TYPE=source
|
||||
|
||||
# Debug build
|
||||
ENV SPC_LOG_LEVEL=debug
|
||||
|
||||
# Skip compression
|
||||
ENV NO_COMPRESS=1
|
||||
|
||||
# set PHP version
|
||||
ENV PHP_VERSION=8.2
|
||||
|
||||
# Move to the app directory
|
||||
WORKDIR /go/src/app
|
||||
|
||||
# Make sure pkg-config is available within the static build container
|
||||
COPY ./builds/linux/spc/downloads/pkg-config-0.29.2.tar.gz ./dist/static-php-cli/downloads/pkg-config-0.29.2.tar.gz
|
||||
|
||||
# Pre-build pkg-config using the existing tarball
|
||||
RUN apk add --no-cache build-base && \
|
||||
tar -xzf ./dist/static-php-cli/downloads/pkg-config-0.29.2.tar.gz -C /tmp && \
|
||||
cd /tmp/pkg-config-0.29.2 && \
|
||||
./configure --with-internal-glib --prefix=/go/src/app/dist/static-php-cli/build/bin && \
|
||||
make && make install && \
|
||||
rm -rf /tmp/pkg-config-0.29.2
|
||||
|
||||
# Do not run git pull
|
||||
RUN sed -i 's/^[ \t]*git pull/# git pull/' ./build-static.sh
|
||||
|
||||
# Build the FrankenPHP static binary
|
||||
RUN EMBED=dist/app ./build-static.sh
|
||||
@@ -1,188 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
log() {
|
||||
echo -e "\033[1;34m[🔧 $1]\033[0m"
|
||||
}
|
||||
|
||||
log_success() {
|
||||
echo -e "\033[1;32m[✅ $1]\033[0m"
|
||||
}
|
||||
|
||||
log_warn() {
|
||||
echo -e "\033[1;33m[⚠️ $1]\033[0m"
|
||||
}
|
||||
|
||||
log_error() {
|
||||
echo -e "\033[1;31m[❌ $1]\033[0m"
|
||||
}
|
||||
|
||||
# Define base paths
|
||||
log "Resolving directories..."
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
OSX_DIR="$ROOT_DIR/builds/osx"
|
||||
DIST_DIR="$ROOT_DIR/builds/dist"
|
||||
APP_DIR="$ROOT_DIR/api"
|
||||
BREW_PREFIX="/opt/homebrew"
|
||||
|
||||
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
|
||||
ARCH="$(uname -m)"
|
||||
BINARY_NAME="fleetbase-$OS-$ARCH"
|
||||
|
||||
log "Binary will be: $BINARY_NAME"
|
||||
|
||||
# Setup PHP 8.4
|
||||
log "Detecting current PHP version..."
|
||||
ORIGINAL_PHP_PATH="$(which php)"
|
||||
ORIGINAL_PHP_VERSION="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION.".".PHP_RELEASE_VERSION;' 2>/dev/null)"
|
||||
IS_ASDF_MANAGED=false
|
||||
|
||||
if [[ "$ORIGINAL_PHP_PATH" == *".asdf"* ]]; then
|
||||
IS_ASDF_MANAGED=true
|
||||
fi
|
||||
|
||||
# 🔁 Trap to restore PHP when script exits
|
||||
trap 'if [ "$IS_ASDF_MANAGED" = true ]; then
|
||||
log "Restoring asdf-managed PHP version: $ORIGINAL_PHP_VERSION"
|
||||
asdf set php "$ORIGINAL_PHP_VERSION" || true
|
||||
log "Reverted to PHP $(php -v | head -n 1)"
|
||||
else
|
||||
log "Unsetting asdf set to restore system PHP"
|
||||
asdf set php system || true
|
||||
log "Reverted to PHP $(php -v | head -n 1)"
|
||||
fi' EXIT
|
||||
|
||||
log "Detected PHP version: $ORIGINAL_PHP_VERSION"
|
||||
log "Detected PHP binary: $ORIGINAL_PHP_PATH"
|
||||
|
||||
# ───────────────────────────────────────────────────────────────────────────────
|
||||
# If the *current* php is already 8.4.x, we skip the entire asdf install step
|
||||
# ───────────────────────────────────────────────────────────────────────────────
|
||||
if [[ "$ORIGINAL_PHP_PATH" == "$BREW_PREFIX/bin/php" && "$ORIGINAL_PHP_VERSION" =~ ^8\.4\. ]]; then
|
||||
log "Homebrew PHP $ORIGINAL_PHP_VERSION detected at $ORIGINAL_PHP_PATH — skipping asdf build/install."
|
||||
else
|
||||
# Only install under asdf if we don’t already have 8.4.0 installed
|
||||
log "No Homebrew PHP 8.4 detected (found $ORIGINAL_PHP_PATH $ORIGINAL_PHP_VERSION), using asdf to build/install."
|
||||
if ! asdf list php | grep -q "8.4.0"; then
|
||||
# Use brew to install required dependencies for asdf php management
|
||||
log "Checking and installing Homebrew packages required for PHP 8.4 build..."
|
||||
|
||||
for pkg in autoconf automake bison freetype gd gettext icu4c krb5 libedit libiconv libjpeg libpng libxml2 libzip pkg-config re2c zlib sqlite3 libsodium oniguruma openssl@3 nasm; do
|
||||
if ! brew list "$pkg" &>/dev/null; then
|
||||
log_warn "$pkg not found. Installing..."
|
||||
arch -arm64 brew install "$pkg"
|
||||
else
|
||||
log "$pkg already installed. Skipping."
|
||||
fi
|
||||
done
|
||||
|
||||
# Set necessary env flags/paths for PHP build on OSX ARM64
|
||||
export CPPFLAGS="-I$BREW_PREFIX/opt/oniguruma/include -I$BREW_PREFIX/opt/libsodium/include -I$BREW_PREFIX/opt/bzip2/include -I$BREW_PREFIX/opt/zlib/include -I$BREW_PREFIX/opt/openssl@3/include -I$BREW_PREFIX/opt/libxml2/include -I$BREW_PREFIX/opt/libedit/include -I$BREW_PREFIX/opt/curl/include -I$BREW_PREFIX/opt/sqlite3/include -I$BREW_PREFIX/opt/freetype/include -I$BREW_PREFIX/opt/jpeg/include -I$BREW_PREFIX/opt/libpng/include -I$BREW_PREFIX/opt/libzip/include"
|
||||
export LDFLAGS="-L$BREW_PREFIX/opt/openssl@3/lib -lssl -lcrypto -lz -L$BREW_PREFIX/opt/oniguruma/lib -lonig -L$BREW_PREFIX/opt/libsodium/lib -lsodium -L$BREW_PREFIX/opt/bzip2/lib -Wl,-rpath,$BREW_PREFIX/opt/bzip2/lib -lbz2 -L$BREW_PREFIX/opt/zlib/lib -L$BREW_PREFIX/opt/openssl@3/lib -L$BREW_PREFIX/opt/libxml2/lib -L$BREW_PREFIX/opt/libedit/lib -L$BREW_PREFIX/opt/sqlite3/lib -lsqlite3 -L$BREW_PREFIX/opt/curl/lib -lcurl -L$BREW_PREFIX/opt/freetype/lib -L$BREW_PREFIX/opt/jpeg/lib -L$BREW_PREFIX/opt/libpng/lib -L$BREW_PREFIX/opt/libzip/lib -lzip -lz"
|
||||
export PKG_CONFIG_PATH="$BREW_PREFIX/opt/openssl/lib/pkgconfig:$BREW_PREFIX/opt/oniguruma/lib/pkgconfig:$BREW_PREFIX/opt/libsodium/lib/pkgconfig:$BREW_PREFIX/opt/libzip/lib/pkgconfig:$BREW_PREFIX/opt/gd/lib/pkgconfig:$BREW_PREFIX/opt/zlib/lib/pkgconfig:$BREW_PREFIX/opt/openssl@3/lib/pkgconfig:$BREW_PREFIX/opt/libxml2/lib/pkgconfig:$BREW_PREFIX/opt/curl/lib/pkgconfig:$BREW_PREFIX/opt/sqlite3/lib/pkgconfig:$BREW_PREFIX/opt/freetype/lib/pkgconfig:$BREW_PREFIX/opt/jpeg/lib/pkgconfig:$BREW_PREFIX/opt/libpng/lib/pkgconfig"
|
||||
export PHP_CONFIGURE_OPTIONS="--with-openssl=$(brew --prefix openssl) --with-iconv=$(brew --prefix libiconv)"
|
||||
|
||||
log "Installing PHP 8.4.0 with asdf..."
|
||||
asdf install php 8.4.0 --verbose
|
||||
else
|
||||
log "asdf already has PHP 8.4.0 installed, skipping"
|
||||
fi
|
||||
|
||||
log "Switching to PHP 8.4.0 with asdf set..."
|
||||
asdf set php 8.4.0 --home
|
||||
fi
|
||||
|
||||
# Clone FrankenPHP
|
||||
if [ ! -d "$OSX_DIR/frankenphp" ]; then
|
||||
log "Cloning FrankenPHP..."
|
||||
git clone https://github.com/dunglas/frankenphp "$OSX_DIR/frankenphp"
|
||||
else
|
||||
log_warn "FrankenPHP already cloned. Skipping."
|
||||
fi
|
||||
|
||||
cd "$OSX_DIR/frankenphp"
|
||||
|
||||
# Patch build script
|
||||
log "Patching build-static.sh to skip git pull..."
|
||||
sed -i '' 's/^[ \t]*git pull/# git pull/' ./build-static.sh
|
||||
|
||||
# Set environment variables
|
||||
log "Exporting build environment variables..."
|
||||
export PHP_VERSION=8.2
|
||||
export PHP_EXTENSIONS="pdo_mysql,gd,bcmath,redis,intl,zip,gmp,apcu,opcache,imagick,sockets,pcntl,geos,iconv,mbstring,fileinfo,ctype,tokenizer,simplexml,dom,filter,session"
|
||||
export PHP_EXTENSION_LIBS="libgeos,libzip,bzip2,libxml2,openssl,zlib"
|
||||
export SPC_REL_TYPE=source
|
||||
export NO_COMPRESS=1
|
||||
export SPC_OPT_BUILD_ARGS="--debug"
|
||||
export CMAKE_OSX_ARCHITECTURES=arm64
|
||||
|
||||
# Clone and prepare static-php-cli in dist/
|
||||
STATIC_PHP_CLI_DIR="$OSX_DIR/frankenphp/dist/static-php-cli"
|
||||
if [ ! -d "$STATIC_PHP_CLI_DIR" ]; then
|
||||
log "Cloning static-php-cli into dist/..."
|
||||
git clone --depth 1 --branch 2.5.2 https://github.com/crazywhalecc/static-php-cli.git "$STATIC_PHP_CLI_DIR"
|
||||
else
|
||||
log_warn "static-php-cli already exists in dist/. Skipping clone."
|
||||
fi
|
||||
|
||||
# Inject libgeos support
|
||||
log "Injecting libgeos patch files..."
|
||||
cp "$ROOT_DIR/builds/osx/spc/libgeos-unix.php" "$STATIC_PHP_CLI_DIR/src/SPC/builder/unix/library/libgeos.php"
|
||||
cp "$ROOT_DIR/builds/osx/spc/libgeos-macos.php" "$STATIC_PHP_CLI_DIR/src/SPC/builder/macos/library/libgeos.php"
|
||||
cp "$ROOT_DIR/builds/osx/spc/UnixBuilderBase-macos.php" "$STATIC_PHP_CLI_DIR/src/SPC/builder/unix/UnixBuilderBase.php"
|
||||
|
||||
# Patch SPC config
|
||||
log "Patching SPC config files (source.json, ext.json, lib.json)..."
|
||||
jq '. + {"php-geos": {"type": "url", "url": "https://github.com/libgeos/php-geos/archive/dfe1ab17b0f155cc315bc13c75689371676e02e1.zip", "license": [{"type": "file", "path": "php-geos-dfe1ab17b0f155cc315bc13c75689371676e02e1/MIT-LICENSE"}, {"type": "file", "path": "php-geos-dfe1ab17b0f155cc315bc13c75689371676e02e1/LGPL-2"}]}}' \
|
||||
"$STATIC_PHP_CLI_DIR/config/source.json" > "$STATIC_PHP_CLI_DIR/config/source.tmp.json" && \
|
||||
mv "$STATIC_PHP_CLI_DIR/config/source.tmp.json" "$STATIC_PHP_CLI_DIR/config/source.json"
|
||||
|
||||
jq '. + {"libgeos": {"type": "url", "url": "https://download.osgeo.org/geos/geos-3.12.1.tar.bz2", "filename": "geos-3.12.1.tar.bz2", "extract": "geos-3.12.1", "build-dir": "build", "license": [{"type": "file", "path": "COPYING"}]}}' \
|
||||
"$STATIC_PHP_CLI_DIR/config/source.json" > "$STATIC_PHP_CLI_DIR/config/source.tmp.json" && \
|
||||
mv "$STATIC_PHP_CLI_DIR/config/source.tmp.json" "$STATIC_PHP_CLI_DIR/config/source.json"
|
||||
|
||||
jq '. + {"libgeos": {"source": "libgeos", "static-libs-unix": ["libgeos.a", "libgeos_c.a"]}}' \
|
||||
"$STATIC_PHP_CLI_DIR/config/lib.json" > "$STATIC_PHP_CLI_DIR/config/lib.tmp.json" && \
|
||||
mv "$STATIC_PHP_CLI_DIR/config/lib.tmp.json" "$STATIC_PHP_CLI_DIR/config/lib.json"
|
||||
|
||||
jq '. + {"geos": {"type": "external", "arg-type": "enable", "source": "php-geos", "lib-depends": ["libgeos"]}}' \
|
||||
"$STATIC_PHP_CLI_DIR/config/ext.json" > "$STATIC_PHP_CLI_DIR/config/ext.tmp.json" && \
|
||||
mv "$STATIC_PHP_CLI_DIR/config/ext.tmp.json" "$STATIC_PHP_CLI_DIR/config/ext.json"
|
||||
|
||||
# Prepare app embed folder
|
||||
log "📦 Preparing embedded app directory..."
|
||||
rm -rf ./dist/app
|
||||
mkdir -p ./dist/app
|
||||
cp -R "$APP_DIR"/* ./dist/app/
|
||||
|
||||
log "Patching build-static.sh to skip git pull and composer install..."
|
||||
|
||||
# Skip `git pull`
|
||||
sed -i '' 's/^[[:space:]]*git pull/# git pull/' "$OSX_DIR/frankenphp/build-static.sh"
|
||||
|
||||
# Patch add CoreServices framework for Caddy build on OSX
|
||||
sed -i '' 's/-framework CoreFoundation -framework SystemConfiguration/& -framework CoreServices/' "$OSX_DIR/frankenphp/build-static.sh"
|
||||
|
||||
# ── work around 403 on GH macOS runners ────────────────────────────────────────
|
||||
log "Patching curl to use a browser-like User-Agent (to avoid 403s)…"
|
||||
curl() {
|
||||
command curl -sSL -A "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15" "$@"
|
||||
}
|
||||
export -f curl
|
||||
|
||||
# Build the binary
|
||||
log "⚙️ Running FrankenPHP build-static.sh..."
|
||||
EMBED=dist/app ./build-static.sh
|
||||
|
||||
# Move built binary to dist
|
||||
log "Moving built binary to output folder..."
|
||||
mkdir -p "$DIST_DIR"
|
||||
mv dist/frankenphp-mac-$ARCH "$DIST_DIR/$BINARY_NAME"
|
||||
|
||||
log_success "✅ macOS binary built at: $DIST_DIR/$BINARY_NAME"
|
||||
|
||||
# Clean up frankenphp build and app embed folder
|
||||
log "🧹 Cleaning temporary app directory..."
|
||||
rm -rf "$OSX_DIR/frankenphp"
|
||||
@@ -1,271 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix;
|
||||
|
||||
use SPC\builder\BuilderBase;
|
||||
use SPC\builder\linux\LinuxBuilder;
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\exception\WrongUsageException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\DependencyUtil;
|
||||
use SPC\util\SPCConfigUtil;
|
||||
|
||||
abstract class UnixBuilderBase extends BuilderBase
|
||||
{
|
||||
/** @var string cflags */
|
||||
public string $arch_c_flags;
|
||||
|
||||
/** @var string C++ flags */
|
||||
public string $arch_cxx_flags;
|
||||
|
||||
/** @var string cmake toolchain file */
|
||||
public string $cmake_toolchain_file;
|
||||
|
||||
/**
|
||||
* @throws WrongUsageException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
public function getAllStaticLibFiles(): array
|
||||
{
|
||||
$libs = [];
|
||||
|
||||
// reorder libs
|
||||
foreach ($this->libs as $lib) {
|
||||
foreach ($lib->getDependencies() as $dep) {
|
||||
$libs[] = $dep;
|
||||
}
|
||||
$libs[] = $lib;
|
||||
}
|
||||
|
||||
$libFiles = [];
|
||||
$libNames = [];
|
||||
// merge libs
|
||||
foreach ($libs as $lib) {
|
||||
if (!in_array($lib::NAME, $libNames, true)) {
|
||||
$libNames[] = $lib::NAME;
|
||||
array_unshift($libFiles, ...$lib->getStaticLibs());
|
||||
}
|
||||
}
|
||||
return array_map(fn ($x) => realpath(BUILD_LIB_PATH . "/{$x}"), $libFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return generic cmake options when configuring cmake projects
|
||||
*/
|
||||
public function makeCmakeArgs(): string
|
||||
{
|
||||
$extra = $this instanceof LinuxBuilder ? '-DCMAKE_C_COMPILER=' . getenv('CC') . ' ' : '';
|
||||
|
||||
// NEW: allow env-variable override
|
||||
$arch = getenv('CMAKE_OSX_ARCHITECTURES') ?: 'arm64';
|
||||
|
||||
return $extra .
|
||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
||||
'-DCMAKE_INSTALL_BINDIR=bin ' .
|
||||
'-DCMAKE_INSTALL_LIBDIR=lib ' .
|
||||
'-DCMAKE_INSTALL_INCLUDEDIR=include ' .
|
||||
"-DCMAKE_OSX_ARCHITECTURES={$arch} " .
|
||||
"-DCMAKE_TOOLCHAIN_FILE={$this->cmake_toolchain_file}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate configure flags
|
||||
*/
|
||||
public function makeAutoconfFlags(int $flag = AUTOCONF_ALL): string
|
||||
{
|
||||
$extra = '';
|
||||
// TODO: add auto pkg-config support
|
||||
if (($flag & AUTOCONF_LIBS) === AUTOCONF_LIBS) {
|
||||
$extra .= 'LIBS="' . BUILD_LIB_PATH . '" ';
|
||||
}
|
||||
if (($flag & AUTOCONF_CFLAGS) === AUTOCONF_CFLAGS) {
|
||||
$extra .= 'CFLAGS="-I' . BUILD_INCLUDE_PATH . '" ';
|
||||
}
|
||||
if (($flag & AUTOCONF_CPPFLAGS) === AUTOCONF_CPPFLAGS) {
|
||||
$extra .= 'CPPFLAGS="-I' . BUILD_INCLUDE_PATH . '" ';
|
||||
}
|
||||
if (($flag & AUTOCONF_LDFLAGS) === AUTOCONF_LDFLAGS) {
|
||||
$extra .= 'LDFLAGS="-L' . BUILD_LIB_PATH . '" ';
|
||||
}
|
||||
return $extra;
|
||||
}
|
||||
|
||||
public function proveLibs(array $sorted_libraries): void
|
||||
{
|
||||
// search all supported libs
|
||||
$support_lib_list = [];
|
||||
$classes = FileSystem::getClassesPsr4(
|
||||
ROOT_DIR . '/src/SPC/builder/' . osfamily2dir() . '/library',
|
||||
'SPC\builder\\' . osfamily2dir() . '\library'
|
||||
);
|
||||
foreach ($classes as $class) {
|
||||
if (defined($class . '::NAME') && $class::NAME !== 'unknown' && Config::getLib($class::NAME) !== null) {
|
||||
$support_lib_list[$class::NAME] = $class;
|
||||
}
|
||||
}
|
||||
|
||||
// if no libs specified, compile all supported libs
|
||||
if ($sorted_libraries === [] && $this->isLibsOnly()) {
|
||||
$libraries = array_keys($support_lib_list);
|
||||
$sorted_libraries = DependencyUtil::getLibs($libraries);
|
||||
}
|
||||
|
||||
// add lib object for builder
|
||||
foreach ($sorted_libraries as $library) {
|
||||
if (!in_array(Config::getLib($library, 'type', 'lib'), ['lib', 'package'])) {
|
||||
continue;
|
||||
}
|
||||
// if some libs are not supported (but in config "lib.json", throw exception)
|
||||
if (!isset($support_lib_list[$library])) {
|
||||
throw new WrongUsageException('library [' . $library . '] is in the lib.json list but not supported to compile, but in the future I will support it!');
|
||||
}
|
||||
$lib = new ($support_lib_list[$library])($this);
|
||||
$this->addLib($lib);
|
||||
}
|
||||
|
||||
// calculate and check dependencies
|
||||
foreach ($this->libs as $lib) {
|
||||
$lib->calcDependency();
|
||||
}
|
||||
$this->lib_list = $sorted_libraries;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanity check after build complete
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function sanityCheck(int $build_target): void
|
||||
{
|
||||
// sanity check for php-cli
|
||||
if (($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI) {
|
||||
logger()->info('running cli sanity check');
|
||||
[$ret, $output] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php -n -r "echo \"hello\";"');
|
||||
$raw_output = implode('', $output);
|
||||
if ($ret !== 0 || trim($raw_output) !== 'hello') {
|
||||
throw new RuntimeException("cli failed sanity check: ret[{$ret}]. out[{$raw_output}]");
|
||||
}
|
||||
|
||||
foreach ($this->getExts(false) as $ext) {
|
||||
logger()->debug('testing ext: ' . $ext->getName());
|
||||
$ext->runCliCheckUnix();
|
||||
}
|
||||
}
|
||||
|
||||
// sanity check for phpmicro
|
||||
if (($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO) {
|
||||
$test_task = $this->getMicroTestTasks();
|
||||
foreach ($test_task as $task_name => $task) {
|
||||
$test_file = SOURCE_PATH . '/' . $task_name . '.exe';
|
||||
if (file_exists($test_file)) {
|
||||
@unlink($test_file);
|
||||
}
|
||||
file_put_contents($test_file, file_get_contents(SOURCE_PATH . '/php-src/sapi/micro/micro.sfx') . $task['content']);
|
||||
chmod($test_file, 0755);
|
||||
[$ret, $out] = shell()->execWithResult($test_file);
|
||||
foreach ($task['conditions'] as $condition => $closure) {
|
||||
if (!$closure($ret, $out)) {
|
||||
$raw_out = trim(implode('', $out));
|
||||
throw new RuntimeException("micro failed sanity check: {$task_name}, condition [{$condition}], ret[{$ret}], out[{$raw_out}]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sanity check for embed
|
||||
if (($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED) {
|
||||
logger()->info('running embed sanity check');
|
||||
$sample_file_path = SOURCE_PATH . '/embed-test';
|
||||
if (!is_dir($sample_file_path)) {
|
||||
@mkdir($sample_file_path);
|
||||
}
|
||||
// copy embed test files
|
||||
copy(ROOT_DIR . '/src/globals/common-tests/embed.c', $sample_file_path . '/embed.c');
|
||||
copy(ROOT_DIR . '/src/globals/common-tests/embed.php', $sample_file_path . '/embed.php');
|
||||
$util = new SPCConfigUtil($this);
|
||||
$config = $util->config($this->ext_list, $this->lib_list, $this->getOption('with-suggested-exts'), $this->getOption('with-suggested-libs'));
|
||||
$lens = "{$config['cflags']} {$config['ldflags']} {$config['libs']}";
|
||||
if (PHP_OS_FAMILY === 'Linux' && getenv('SPC_LIBC') === 'musl') {
|
||||
$lens .= ' -static';
|
||||
}
|
||||
[$ret, $out] = shell()->cd($sample_file_path)->execWithResult(getenv('CC') . ' -o embed embed.c ' . $lens);
|
||||
if ($ret !== 0) {
|
||||
throw new RuntimeException('embed failed sanity check: build failed. Error message: ' . implode("\n", $out));
|
||||
}
|
||||
// if someone changed to --enable-embed=shared, we need to add LD_LIBRARY_PATH
|
||||
if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'shared') {
|
||||
$ext_path = 'LD_LIBRARY_PATH=' . BUILD_ROOT_PATH . '/lib:$LD_LIBRARY_PATH ';
|
||||
FileSystem::removeFileIfExists(BUILD_ROOT_PATH . '/lib/libphp.a');
|
||||
} else {
|
||||
$ext_path = '';
|
||||
FileSystem::removeFileIfExists(BUILD_ROOT_PATH . '/lib/libphp.so');
|
||||
}
|
||||
[$ret, $output] = shell()->cd($sample_file_path)->execWithResult($ext_path . './embed');
|
||||
if ($ret !== 0 || trim(implode('', $output)) !== 'hello') {
|
||||
throw new RuntimeException('embed failed sanity check: run failed. Error message: ' . implode("\n", $output));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将编译好的二进制文件发布到 buildroot
|
||||
*
|
||||
* @param int $type 发布类型
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
protected function deployBinary(int $type): bool
|
||||
{
|
||||
$src = match ($type) {
|
||||
BUILD_TARGET_CLI => SOURCE_PATH . '/php-src/sapi/cli/php',
|
||||
BUILD_TARGET_MICRO => SOURCE_PATH . '/php-src/sapi/micro/micro.sfx',
|
||||
BUILD_TARGET_FPM => SOURCE_PATH . '/php-src/sapi/fpm/php-fpm',
|
||||
default => throw new RuntimeException('Deployment does not accept type ' . $type),
|
||||
};
|
||||
logger()->info('Deploying ' . $this->getBuildTypeName($type) . ' file');
|
||||
FileSystem::createDir(BUILD_ROOT_PATH . '/bin');
|
||||
shell()->exec('cp ' . escapeshellarg($src) . ' ' . escapeshellarg(BUILD_ROOT_PATH . '/bin/'));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run php clean
|
||||
*
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function cleanMake(): void
|
||||
{
|
||||
logger()->info('cleaning up');
|
||||
shell()->cd(SOURCE_PATH . '/php-src')->exec('make clean');
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch phpize and php-config if needed
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
protected function patchPhpScripts(): void
|
||||
{
|
||||
// patch phpize
|
||||
if (file_exists(BUILD_BIN_PATH . '/phpize')) {
|
||||
logger()->debug('Patching phpize prefix');
|
||||
FileSystem::replaceFileStr(BUILD_BIN_PATH . '/phpize', "prefix=''", "prefix='" . BUILD_ROOT_PATH . "'");
|
||||
FileSystem::replaceFileStr(BUILD_BIN_PATH . '/phpize', 's##', 's#/usr/local#');
|
||||
}
|
||||
// patch php-config
|
||||
if (file_exists(BUILD_BIN_PATH . '/php-config')) {
|
||||
logger()->debug('Patching php-config prefix and libs order');
|
||||
$php_config_str = FileSystem::readFile(BUILD_BIN_PATH . '/php-config');
|
||||
$php_config_str = str_replace('prefix=""', 'prefix="' . BUILD_ROOT_PATH . '"', $php_config_str);
|
||||
// move mimalloc to the beginning of libs
|
||||
$php_config_str = preg_replace('/(libs=")(.*?)\s*(' . preg_quote(BUILD_LIB_PATH, '/') . '\/mimalloc\.o)\s*(.*?)"/', '$1$3 $2 $4"', $php_config_str);
|
||||
// move lstdc++ to the end of libs
|
||||
$php_config_str = preg_replace('/(libs=")(.*?)\s*(-lstdc\+\+)\s*(.*?)"/', '$1$2 $4 $3"', $php_config_str);
|
||||
FileSystem::writeFile(BUILD_BIN_PATH . '/php-config', $php_config_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class libgeos extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\libgeos;
|
||||
|
||||
public const NAME = 'libgeos';
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
trait libgeos
|
||||
{
|
||||
/**
|
||||
* @throws FileSystemException
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
FileSystem::resetDir($this->source_dir . '/build');
|
||||
|
||||
shell()->cd($this->source_dir . '/build')
|
||||
->setEnv([
|
||||
'CFLAGS' => $this->getLibExtraCFlags(),
|
||||
'LDFLAGS' => $this->getLibExtraLdFlags(),
|
||||
'LIBS' => $this->getLibExtraLibs(),
|
||||
])
|
||||
->execWithEnv("cmake {$this->builder->makeCmakeArgs()} -DBUILD_SHARED_LIBS=OFF ..")
|
||||
->execWithEnv("make -j{$this->builder->concurrency}")
|
||||
->execWithEnv('make install');
|
||||
|
||||
$this->patchPkgconfPrefix(['geos.pc']);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,15 @@
|
||||
{
|
||||
/**
|
||||
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
|
||||
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
|
||||
Ember CLI sends analytics information by default. The data is completely
|
||||
anonymous, but there are times when you might want to disable this behavior.
|
||||
|
||||
Setting `disableAnalytics` to true will prevent any data from being sent.
|
||||
*/
|
||||
"disableAnalytics": false,
|
||||
|
||||
/**
|
||||
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
|
||||
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
|
||||
*/
|
||||
"isTypeScriptProject": false
|
||||
}
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
# unconventional js
|
||||
/blueprints/*/files/
|
||||
/vendor/
|
||||
|
||||
# compiled output
|
||||
/dist/
|
||||
/tmp/
|
||||
|
||||
# dependencies
|
||||
/bower_components/
|
||||
/node_modules/
|
||||
|
||||
# misc
|
||||
/coverage/
|
||||
!.*
|
||||
.*/
|
||||
.eslintcache
|
||||
|
||||
# ember-try
|
||||
/.node_modules.ember-try/
|
||||
/bower.json.ember-try
|
||||
/npm-shrinkwrap.json.ember-try
|
||||
/package.json.ember-try
|
||||
/package-lock.json.ember-try
|
||||
/yarn.lock.ember-try
|
||||
|
||||
@@ -2,13 +2,12 @@
|
||||
|
||||
module.exports = {
|
||||
root: true,
|
||||
parser: '@babel/eslint-parser',
|
||||
parser: 'babel-eslint',
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
ecmaVersion: 2018,
|
||||
sourceType: 'module',
|
||||
requireConfigFile: false,
|
||||
babelOptions: {
|
||||
plugins: [['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }]],
|
||||
ecmaFeatures: {
|
||||
legacyDecorators: true,
|
||||
},
|
||||
},
|
||||
plugins: ['ember'],
|
||||
@@ -30,7 +29,7 @@ module.exports = {
|
||||
'ember/no-empty-glimmer-component-classes': 'off',
|
||||
'ember/no-get': 'off',
|
||||
'ember/classic-decorator-no-classic-methods': 'off',
|
||||
'n/no-unpublished-require': [
|
||||
'node/no-unpublished-require': [
|
||||
'error',
|
||||
{
|
||||
allowModules: [
|
||||
@@ -51,18 +50,18 @@ module.exports = {
|
||||
'no-prototype-builtins': 'off',
|
||||
},
|
||||
overrides: [
|
||||
// node files
|
||||
{
|
||||
files: [
|
||||
'./.eslintrc.js',
|
||||
'./.prettierrc.js',
|
||||
'./.stylelintrc.js',
|
||||
'./.template-lintrc.js',
|
||||
'./ember-cli-build.js',
|
||||
'./index.js',
|
||||
'./testem.js',
|
||||
'./blueprints/*/index.js',
|
||||
'./config/**/*.js',
|
||||
'./lib/*/index.js',
|
||||
'./server/**/*.js',
|
||||
'./tests/dummy/config/**/*.js',
|
||||
],
|
||||
parserOptions: {
|
||||
sourceType: 'script',
|
||||
@@ -71,7 +70,13 @@ module.exports = {
|
||||
browser: false,
|
||||
node: true,
|
||||
},
|
||||
extends: ['plugin:n/recommended'],
|
||||
plugins: ['node'],
|
||||
extends: ['plugin:node/recommended'],
|
||||
},
|
||||
{
|
||||
// test files
|
||||
files: ['tests/**/*-test.{js,ts}'],
|
||||
extends: ['plugin:qunit/recommended'],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
4
console/.github/workflows/ci.yml
vendored
4
console/.github/workflows/ci.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.x] # Build on Node.js 18
|
||||
node-version: [16.x] # Build on Node.js 16
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@@ -57,4 +57,4 @@ jobs:
|
||||
run: pnpm run lint
|
||||
|
||||
- name: Build
|
||||
run: npx ember build --environment production
|
||||
run: npx ember build --environment production
|
||||
|
||||
10
console/.gitignore
vendored
10
console/.gitignore
vendored
@@ -1,17 +1,22 @@
|
||||
# See https://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
/dist/
|
||||
/declarations/
|
||||
/tmp/
|
||||
|
||||
# dependencies
|
||||
/bower_components/
|
||||
/node_modules/
|
||||
/scripts/node_modules/
|
||||
|
||||
# misc
|
||||
/.env*
|
||||
/environments/.env*
|
||||
/.pnp*
|
||||
/.sass-cache
|
||||
/.eslintcache
|
||||
/connect.lock
|
||||
/coverage/
|
||||
/libpeerconnection.log
|
||||
/npm-debug.log*
|
||||
/testem.log
|
||||
/yarn-error.log
|
||||
@@ -19,6 +24,7 @@
|
||||
|
||||
# ember-try
|
||||
/.node_modules.ember-try/
|
||||
/bower.json.ember-try
|
||||
/npm-shrinkwrap.json.ember-try
|
||||
/package.json.ember-try
|
||||
/package-lock.json.ember-try
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
# unconventional js
|
||||
/blueprints/*/files/
|
||||
/vendor/
|
||||
|
||||
# compiled output
|
||||
/dist/
|
||||
/tmp/
|
||||
|
||||
# dependencies
|
||||
/bower_components/
|
||||
/node_modules/
|
||||
|
||||
# misc
|
||||
/coverage/
|
||||
!.*
|
||||
.*/
|
||||
.eslintcache
|
||||
.lint-todo/
|
||||
|
||||
# ember-try
|
||||
/.node_modules.ember-try/
|
||||
/bower.json.ember-try
|
||||
/npm-shrinkwrap.json.ember-try
|
||||
/package.json.ember-try
|
||||
/package-lock.json.ember-try
|
||||
/yarn.lock.ember-try
|
||||
|
||||
@@ -8,7 +8,7 @@ module.exports = {
|
||||
printWidth: 190,
|
||||
overrides: [
|
||||
{
|
||||
files: '*.{hbs,js,ts}',
|
||||
files: '*.hbs',
|
||||
options: {
|
||||
singleQuote: false,
|
||||
},
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# unconventional files
|
||||
/blueprints/*/files/
|
||||
|
||||
# compiled output
|
||||
/dist/
|
||||
|
||||
# addons
|
||||
/.node_modules.ember-try/
|
||||
@@ -1,8 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'],
|
||||
rules: {
|
||||
'import-notation': null,
|
||||
},
|
||||
};
|
||||
@@ -6,6 +6,7 @@ module.exports = {
|
||||
'no-bare-strings': 'off',
|
||||
'no-invalid-interactive': 'off',
|
||||
'no-yield-only': 'off',
|
||||
'no-down-event-binding': 'off',
|
||||
'table-groups': 'off',
|
||||
'link-href-attributes': 'off',
|
||||
'require-input-label': 'off',
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"ignore_dirs": ["dist"]
|
||||
"ignore_dirs": ["tmp", "dist"]
|
||||
}
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
# ---- Build Stage ----
|
||||
FROM node:18.15.0-alpine as builder
|
||||
FROM node:16.20-alpine AS builder
|
||||
|
||||
# Set the working directory in the container to /console
|
||||
WORKDIR /console
|
||||
# Set the working directory in the container to /app
|
||||
WORKDIR /app
|
||||
|
||||
# Create the pnpm directory and set the PNPM_HOME environment variable
|
||||
RUN mkdir -p ~/.pnpm
|
||||
ENV PNPM_HOME=/root/.pnpm
|
||||
|
||||
# Set environment
|
||||
ARG ENVIRONMENT=production
|
||||
ENV PNPM_HOME /root/.pnpm
|
||||
|
||||
# Add the pnpm global bin to the PATH
|
||||
ENV PATH=/root/.pnpm/bin:$PATH
|
||||
ENV PATH /root/.pnpm/bin:$PATH
|
||||
|
||||
# Copy pnpm-lock.yaml (or package.json) into the directory /console in the container
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
# Copy pnpm-lock.yaml (or package.json) into the directory /app in the container
|
||||
COPY console/package.json console/pnpm-lock.yaml ./
|
||||
|
||||
# Copy over .npmrc if applicable
|
||||
COPY .npmr[c] ./
|
||||
COPY console/.npmr[c] ./
|
||||
|
||||
# Install global dependencies
|
||||
RUN npm install -g ember-cli pnpm
|
||||
@@ -32,23 +29,23 @@ RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
|
||||
# Install app dependencies
|
||||
RUN pnpm install
|
||||
|
||||
# Copy the console directory contents into the container at /console
|
||||
COPY . .
|
||||
# Copy the console directory contents into the container at /app
|
||||
COPY console .
|
||||
|
||||
# Build the application
|
||||
RUN pnpm build --environment $ENVIRONMENT
|
||||
RUN pnpm build
|
||||
|
||||
# ---- Serve Stage ----
|
||||
FROM nginx:alpine
|
||||
|
||||
# Copy the built app to our served directory
|
||||
COPY --from=builder /console/dist /usr/share/nginx/html
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# Expose the port nginx is bound to
|
||||
EXPOSE 4200
|
||||
|
||||
# Use custom nginx.conf
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY console/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Start Nginx server
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -1,12 +0,0 @@
|
||||
runtime: python312
|
||||
|
||||
handlers:
|
||||
- url: /(.*\..+)$
|
||||
static_files: \1
|
||||
upload: (.+)
|
||||
secure: always
|
||||
expiration: 1h
|
||||
- url: /.*
|
||||
static_files: index.html
|
||||
upload: index.html
|
||||
secure: always
|
||||
@@ -4,8 +4,6 @@ import loadInitializers from 'ember-load-initializers';
|
||||
import config from '@fleetbase/console/config/environment';
|
||||
import loadExtensions from '@fleetbase/ember-core/utils/load-extensions';
|
||||
import mapEngines from '@fleetbase/ember-core/utils/map-engines';
|
||||
import loadRuntimeConfig from '@fleetbase/console/utils/runtime-config';
|
||||
import applyRouterFix from './utils/router-refresh-patch';
|
||||
|
||||
export default class App extends Application {
|
||||
modulePrefix = config.modulePrefix;
|
||||
@@ -15,7 +13,6 @@ export default class App extends Application {
|
||||
engines = {};
|
||||
|
||||
async ready() {
|
||||
applyRouterFix(this);
|
||||
const extensions = await loadExtensions();
|
||||
|
||||
this.extensions = extensions;
|
||||
@@ -23,11 +20,4 @@ export default class App extends Application {
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
await loadRuntimeConfig();
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
|
||||
let fleetbase = App.create();
|
||||
fleetbase.deferReadiness();
|
||||
fleetbase.boot();
|
||||
});
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
{{yield}}
|
||||
@@ -1,3 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
|
||||
export default class Configure2faComponent extends Component {}
|
||||
@@ -1,4 +1,4 @@
|
||||
<ContentPanel @title="Filesystem" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="Filesystem" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<InputGroup @name="Driver" @helpText="Select the default filesystem driver for Fleetbase to use.">
|
||||
<Select @options={{this.disks}} @value={{this.driver}} @onSelect={{this.setDriver}} @placeholder="Select filesystem driver" class="w-full" disabled={{this.isLoading}} />
|
||||
</InputGroup>
|
||||
@@ -7,33 +7,8 @@
|
||||
<InputGroup @name="S3 URL" @value={{this.s3Url}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="S3 Endpoint" @value={{this.s3Endpoint}} disabled={{this.isLoading}} />
|
||||
{{/if}}
|
||||
{{#if (eq this.driver "gcs")}}
|
||||
{{#if this.isGoogleCloudStorageEnvConfigued}}
|
||||
<div class="border border-yellow-900 shadow-sm rounded-lg bg-yellow-200 mb-4">
|
||||
<div class="px-3 py-2 text-sm text-yellow-900 flex items-center">
|
||||
<FaIcon @icon="triangle-exclamation" @size="md" class="mr-1.5" />
|
||||
Warning! GCS is already configured in the server environment. Changing values below may break this.
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
<InputGroup @name="GCS Bucket" @value={{this.gcsBucket}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="GCS Service Account Key File" @wrapperClass="">
|
||||
<div class="flex flex-row items-center mb-0i">
|
||||
<UploadButton @name="firebase-service-account" @accept="text/plain,text/javascript,application/json" @onFileAdded={{this.uploadGcsCredentialsFile}} @buttonText="Upload Service Account JSON" @icon="upload" class="w-auto m-0i mt-0i" />
|
||||
{{#if this.gcsCredentialsFile}}
|
||||
<div class="ml-2.5 text-sm dark:text-white text-black flex flex-row items-center border border-blue-500 rounded-lg px-2 py-0.5 -mt-1">
|
||||
<FaIcon @icon="file-text" @size="sm" class="mr-2 dark:text-white text-black" />
|
||||
<span>{{this.gcsCredentialsFile.original_filename}}</span>
|
||||
<a href="javascript:;" class="text-red-500 ml-2" {{on "click" this.removeGcsCredentialsFile}}>
|
||||
<FaIcon @icon="times" class="text-red-500" />
|
||||
</a>
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</InputGroup>
|
||||
{{/if}}
|
||||
{{#if this.testResponse}}
|
||||
<div class="flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
|
||||
<span class="text-xs">{{this.this.testResponse.message}}</span>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,6 @@ import { action } from '@ember/object';
|
||||
export default class ConfigureFilesystemComponent extends Component {
|
||||
@service fetch;
|
||||
@service notifications;
|
||||
@service currentUser;
|
||||
@tracked isLoading = false;
|
||||
@tracked testResponse;
|
||||
@tracked disks = [];
|
||||
@@ -14,10 +13,6 @@ export default class ConfigureFilesystemComponent extends Component {
|
||||
@tracked s3Bucket = null;
|
||||
@tracked s3Url = null;
|
||||
@tracked s3Endpoint = null;
|
||||
@tracked gcsBucket = null;
|
||||
@tracked gcsCredentialsFileId = null;
|
||||
@tracked gcsCredentialsFile = null;
|
||||
@tracked isGoogleCloudStorageEnvConfigued = false;
|
||||
|
||||
/**
|
||||
* Creates an instance of ConfigureFilesystemComponent.
|
||||
@@ -64,8 +59,6 @@ export default class ConfigureFilesystemComponent extends Component {
|
||||
url: this.s3Url,
|
||||
endpoint: this.s3Endpoint,
|
||||
},
|
||||
gcsCredentialsFileId: this.gcsCredentialsFileId,
|
||||
gcsBucket: this.gcsBucket,
|
||||
})
|
||||
.then(() => {
|
||||
this.notifications.success('Filesystem configuration saved.');
|
||||
@@ -89,29 +82,4 @@ export default class ConfigureFilesystemComponent extends Component {
|
||||
this.isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@action removeGcsCredentialsFile() {
|
||||
this.gcsCredentialsFileId = undefined;
|
||||
this.gcsCredentialsFile = undefined;
|
||||
}
|
||||
|
||||
@action uploadGcsCredentialsFile(file) {
|
||||
try {
|
||||
this.fetch.uploadFile.perform(
|
||||
file,
|
||||
{
|
||||
path: 'gcs',
|
||||
subject_uuid: this.currentUser.companyId,
|
||||
subject_type: 'company',
|
||||
type: 'gcs_credentials',
|
||||
},
|
||||
(uploadedFile) => {
|
||||
this.gcsCredentialsFileId = uploadedFile.id;
|
||||
this.gcsCredentialsFile = uploadedFile;
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,64 +1,27 @@
|
||||
<ContentPanel @title="Mail" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="Mail" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<InputGroup @name="Mailer" @helpText="Select the default mailer for Fleetbase to use.">
|
||||
<Select @options={{this.mailers}} @value={{this.mailer}} @onSelect={{this.setMailer}} @placeholder="Select mailer" class="w-full" />
|
||||
</InputGroup>
|
||||
{{#if (eq this.mailer "smtp")}}
|
||||
<InputGroup @name="SMTP Host" @value={{this.smtpHost}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup @name="SMTP Port" @type="number" @value={{this.smtpPort}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup>
|
||||
<Toggle @isToggled={{eq this.smtpEncryption "tls"}} @onToggle={{this.enableSmtpEncryption}} @label="SMTP Encryption" @helpText="Enabled TLS Encryption" />
|
||||
</InputGroup>
|
||||
<InputGroup @name="SMTP Username" @value={{this.smtpUsername}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup @name="SMTP Password" @value={{this.smtpPassword}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup @name="SMTP Timeout" @value={{this.smtpTimeout}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup @name="SMTP Auth Mode" @value={{this.smtpAuth_mode}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup @name="SMTP Host" @value={{this.smtpHost}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="SMTP Port" @type="number" @value={{this.smtpPort}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="SMTP Encryption" @value={{this.smtpEncryption}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="SMTP Username" @value={{this.smtpUsername}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="SMTP Password" @type="password" @value={{this.smtpPassword}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="SMTP Timeout" @value={{this.smtpTimeout}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="SMTP Auth Mode" @value={{this.smtpAuth_mode}} disabled={{this.isLoading}} />
|
||||
{{/if}}
|
||||
{{#if (eq this.mailer "microsoft-graph")}}
|
||||
<InputGroup @name="Client ID" @value={{this.microsoftGraphClient_id}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup @name="Client Secret" @value={{this.microsoftGraphClient_secret}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup @name="Tenant ID" @value={{this.microsoftGraphTenant_id}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup>
|
||||
<Toggle @isToggled={{this.microsoftGraphSave_to_sent_items}} @onToggle={{fn (mut this.microsoftGraphSave_to_sent_items)}} @label="Save to sent items" />
|
||||
</InputGroup>
|
||||
{{/if}}
|
||||
{{#if (eq this.mailer "mailgun")}}
|
||||
<InputGroup @name="Mailgun Domain" @value={{this.mailgunDomain}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup @name="Mailgun Endpoint" @value={{this.mailgunEndpoint}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
<InputGroup @name="Mailgun Secret" @value={{this.mailgunSecret}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
{{/if}}
|
||||
{{#if (eq this.mailer "postmark")}}
|
||||
<InputGroup @name="Postmark Token" @value={{this.postmarkToken}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
{{/if}}
|
||||
{{#if (eq this.mailer "sendgrid")}}
|
||||
<InputGroup @name="Sendgrid API Key" @value={{this.sendgridApi_key}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
{{/if}}
|
||||
{{#if (eq this.mailer "resend")}}
|
||||
<InputGroup @name="Resend API Key" @value={{this.resendKey}} disabled={{this.loadConfigValues.isRunning}} />
|
||||
{{/if}}
|
||||
<InputGroup
|
||||
@name="From Address"
|
||||
@helpText="Input the email address for Fleetbase to send emails from."
|
||||
@value={{this.fromAddress}}
|
||||
@placeholder="From Address"
|
||||
disabled={{this.isLoading}}
|
||||
/>
|
||||
<InputGroup @name="From Address" @helpText="Input the email address for Fleetbase to send emails from." @value={{this.fromAddress}} @placeholder="From Address" disabled={{this.isLoading}} />
|
||||
<InputGroup @name="From Name" @helpText="Input the name for Fleetbase to send emails from." @value={{this.fromName}} @placeholder="From Name" disabled={{this.isLoading}} />
|
||||
{{#if this.testResponse}}
|
||||
<div
|
||||
class="flex flex-row items-center rounded-lg border
|
||||
{{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}}
|
||||
shadow-sm my-2 px-4 py-2"
|
||||
>
|
||||
<FaIcon
|
||||
@icon={{if (eq this.testResponse.status "error") "triangle-exclamation" "circle-check"}}
|
||||
class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}"
|
||||
/>
|
||||
<span class="text-xs">{{this.testResponse.message}}</span>
|
||||
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
|
||||
<span class="text-xs">{{this.this.testResponse.message}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Config" @onClick={{perform this.test}} @isLoading={{this.test.isRunning}} />
|
||||
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Config" @onClick={{this.test}} @isLoading={{this.isLoading}} />
|
||||
</ContentPanel>
|
||||
|
||||
<EmberWormhole @to="next-view-section-subheader-actions">
|
||||
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{perform this.save}} @disabled={{this.save.isRunning}} @isLoading={{this.save.isRunning}} />
|
||||
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{this.save}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
|
||||
</EmberWormhole>
|
||||
@@ -2,7 +2,6 @@ import Component from '@glimmer/component';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { action } from '@ember/object';
|
||||
import { task } from 'ember-concurrency';
|
||||
|
||||
export default class ConfigureMailComponent extends Component {
|
||||
@service fetch;
|
||||
@@ -15,21 +14,11 @@ export default class ConfigureMailComponent extends Component {
|
||||
@tracked fromName = null;
|
||||
@tracked smtpHost = 'smtp.mailgun.org';
|
||||
@tracked smtpPort = 587;
|
||||
@tracked smtpEncryption = null;
|
||||
@tracked smtpEncryption = 'tls';
|
||||
@tracked smtpUsername = null;
|
||||
@tracked smtpPassword = null;
|
||||
@tracked smtpTimeout = null;
|
||||
@tracked smtpAuth_mode = null;
|
||||
@tracked mailgunDomain = null;
|
||||
@tracked mailgunEndpoint = 'api.mailgun.net';
|
||||
@tracked mailgunSecret = null;
|
||||
@tracked postmarkToken = null;
|
||||
@tracked sendgridApi_key = null;
|
||||
@tracked resendKey = null;
|
||||
@tracked microsoftGraphClient_id = null;
|
||||
@tracked microsoftGraphClient_secret = null;
|
||||
@tracked microsoftGraphTenant_id = null;
|
||||
@tracked microsoftGraphSave_to_sent_items = false;
|
||||
|
||||
/**
|
||||
* Creates an instance of ConfigureFilesystemComponent.
|
||||
@@ -37,7 +26,7 @@ export default class ConfigureMailComponent extends Component {
|
||||
*/
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.loadConfigValues.perform();
|
||||
this.loadConfigValues();
|
||||
}
|
||||
|
||||
@action setConfigValues(config) {
|
||||
@@ -48,10 +37,6 @@ export default class ConfigureMailComponent extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
@action enableSmtpEncryption(enabled) {
|
||||
this.smtpEncryption = enabled ? 'tls' : null;
|
||||
}
|
||||
|
||||
@action setMailer(mailer) {
|
||||
this.mailer = mailer;
|
||||
}
|
||||
@@ -68,92 +53,56 @@ export default class ConfigureMailComponent extends Component {
|
||||
};
|
||||
}
|
||||
|
||||
@action serializeMicrosoftGraphConfig() {
|
||||
return {
|
||||
client_id: this.microsoftGraphClient_id,
|
||||
client_secret: this.microsoftGraphClient_secret,
|
||||
tenant_id: this.microsoftGraphTenant_id,
|
||||
save_to_sent_items: this.microsoftGraphSave_to_sent_items,
|
||||
from: {
|
||||
address: this.fromAddress,
|
||||
name: this.fromName,
|
||||
},
|
||||
};
|
||||
@action loadConfigValues() {
|
||||
this.isLoading = true;
|
||||
|
||||
this.fetch
|
||||
.get('settings/mail-config')
|
||||
.then((response) => {
|
||||
this.setConfigValues(response);
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@action serializeMailgunConfig() {
|
||||
return {
|
||||
domain: this.mailgunDomain,
|
||||
secret: this.mailgunSecret,
|
||||
endpoint: this.mailgunEndpoint,
|
||||
};
|
||||
}
|
||||
@action test() {
|
||||
this.isLoading = true;
|
||||
|
||||
@action serializePostmarkConfig() {
|
||||
return {
|
||||
token: this.postmarkToken,
|
||||
};
|
||||
}
|
||||
|
||||
@action serializeSendgridConfig() {
|
||||
return {
|
||||
api_key: this.sendgridApi_key,
|
||||
};
|
||||
}
|
||||
|
||||
@action serializeResendConfig() {
|
||||
return {
|
||||
key: this.resendKey,
|
||||
};
|
||||
}
|
||||
|
||||
@task *loadConfigValues() {
|
||||
try {
|
||||
const config = yield this.fetch.get('settings/mail-config');
|
||||
this.setConfigValues(config);
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
|
||||
@task *test() {
|
||||
try {
|
||||
this.testResponse = yield this.fetch.post('settings/test-mail-config', {
|
||||
this.fetch
|
||||
.post('settings/test-mail-config', {
|
||||
mailer: this.mailer,
|
||||
from: {
|
||||
address: this.fromAddress,
|
||||
name: this.fromName,
|
||||
},
|
||||
smtp: this.serializeSmtpConfig(),
|
||||
mailgun: this.serializeMailgunConfig(),
|
||||
postmark: this.serializePostmarkConfig(),
|
||||
sendgrid: this.serializeSendgridConfig(),
|
||||
resend: this.serializeResendConfig(),
|
||||
microsoftGraph: this.serializeMicrosoftGraphConfig(),
|
||||
})
|
||||
.then((response) => {
|
||||
this.testResponse = response;
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
|
||||
@task *save() {
|
||||
try {
|
||||
yield this.fetch.post('settings/mail-config', {
|
||||
@action save() {
|
||||
this.isLoading = true;
|
||||
|
||||
this.fetch
|
||||
.post('settings/mail-config', {
|
||||
mailer: this.mailer,
|
||||
from: {
|
||||
address: this.fromAddress,
|
||||
name: this.fromName,
|
||||
},
|
||||
smtp: this.serializeSmtpConfig(),
|
||||
mailgun: this.serializeMailgunConfig(),
|
||||
postmark: this.serializePostmarkConfig(),
|
||||
sendgrid: this.serializeSendgridConfig(),
|
||||
resend: this.serializeResendConfig(),
|
||||
microsoftGraph: this.serializeMicrosoftGraphConfig(),
|
||||
})
|
||||
.then(() => {
|
||||
this.notifications.success('Mail configuration saved.');
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
this.notifications.success('Mail configuration saved.');
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<ContentPanel @title="APN Configutation" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="APN Configutation" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<InputGroup @name="APN Key ID" @value={{this.apn.key_id}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="APN Team ID" @value={{this.apn.team_id}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="APN App Bundle ID" @value={{this.apn.app_bundle_id}} disabled={{this.isLoading}} />
|
||||
@@ -6,7 +6,7 @@
|
||||
<Textarea class="form-input w-full" @value={{this.apn.private_key_content}} placeholder="APN Private Key" rows="10" disabled={{this.isLoading}} />
|
||||
</InputGroup> --}}
|
||||
<InputGroup @wrapperClass="flex flex-row items-center">
|
||||
<UploadButton @name="apn-key" @accept="text/plain,application/x-pem-file,application/x-pkcs12,application/x-x509-ca-cert,.p12,.pem,.p8" @onFileAdded={{this.uploadApnKey}} @buttonText="Upload P8 Key File" @icon="upload" class="w-auto m-0i mt-0i" />
|
||||
<UploadButton @name="apn-key" @accept="text/plain,application/x-pem-file,application/x-pkcs12,application/x-x509-ca-cert,.p12,.pem,.p8" @onFileAdded={{this.uploadApnKey}} @buttonText="Upload P8 Key File" @uploadIcon="upload" class="w-auto m-0i mt-0i" />
|
||||
{{#if this.apn.private_key_file}}
|
||||
<div class="ml-2.5 text-sm dark:text-white text-black flex flex-row items-center border border-blue-500 rounded-lg px-2 py-0.5 -mt-1">
|
||||
<FaIcon @icon="file-text" @size="sm" class="mr-2 dark:text-white text-black" />
|
||||
@@ -15,32 +15,16 @@
|
||||
</div>
|
||||
{{/if}}
|
||||
</InputGroup>
|
||||
<InputGroup @wrapperClass="mb-0i">
|
||||
<Checkbox @label="APN Production" @value={{this.apn.production}} @onToggle={{this.toggleApnProduction}} />
|
||||
<InputGroup>
|
||||
<Checkbox @label="APN Production" @value={{this.apn.production}} @onToggle={{fn (mut this.apn.production)}} @disabled={{this.isLoading}} />
|
||||
</InputGroup>
|
||||
</ContentPanel>
|
||||
|
||||
<ContentPanel @title="Firebase Configutation" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<InputGroup @wrapperClass="flex flex-row items-center mb-0i">
|
||||
<UploadButton @name="firebase-service-account" @accept="text/plain,text/javascript,application/json" @onFileAdded={{this.uploadFirebaseCredentials}} @buttonText="Upload Service Account JSON" @icon="upload" class="w-auto m-0i mt-0i" />
|
||||
{{#if this.firebase.credentials_file}}
|
||||
<div class="ml-2.5 text-sm dark:text-white text-black flex flex-row items-center border border-blue-500 rounded-lg px-2 py-0.5 -mt-1">
|
||||
<FaIcon @icon="file-text" @size="sm" class="mr-2 dark:text-white text-black" />
|
||||
<span>{{this.firebase.credentials_file.original_filename}}</span>
|
||||
<a href="javascript:;" class="text-red-500 ml-2" {{on "click" this.removeFirebaseCredentialsFile}}><FaIcon @icon="times" class="text-red-500" /></a>
|
||||
</div>
|
||||
{{/if}}
|
||||
</InputGroup>
|
||||
</ContentPanel>
|
||||
|
||||
<ContentPanel @title="Test Push Notification" @open={{true}} @wrapperClass="bordered-classic">
|
||||
{{#if this.testResponse}}
|
||||
<div class="flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
|
||||
<span class="text-xs">{{this.this.testResponse.message}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="">
|
||||
<div class="mt-3 rounded-lg bg-gray-900 shadow-inner p-3">
|
||||
<div class="flex flex-col space-y-2">
|
||||
<div class="flex flex-row items-center">
|
||||
<div class="text-sm w-40">Title:</div>
|
||||
@@ -63,8 +47,6 @@
|
||||
</div>
|
||||
</ContentPanel>
|
||||
|
||||
<Spacer @height="300px" />
|
||||
|
||||
<EmberWormhole @to="next-view-section-subheader-actions">
|
||||
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{this.save}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
|
||||
</EmberWormhole>
|
||||
@@ -18,13 +18,14 @@ export default class ConfigureNotificationChannelsComponent extends Component {
|
||||
team_id: '',
|
||||
app_bundle_id: '',
|
||||
private_key_path: '',
|
||||
_private_key_path: '',
|
||||
private_key_file_id: '',
|
||||
private_key_file: null,
|
||||
production: true,
|
||||
};
|
||||
@tracked firebase = {
|
||||
credentials: '',
|
||||
@tracked fcm = {
|
||||
firebase_credentials_json: '',
|
||||
firebase_database_url: '',
|
||||
firebase_project_name: '',
|
||||
};
|
||||
|
||||
constructor() {
|
||||
@@ -32,48 +33,31 @@ export default class ConfigureNotificationChannelsComponent extends Component {
|
||||
this.loadConfigValues();
|
||||
}
|
||||
|
||||
@action toggleApnProduction(checked) {
|
||||
this.apn = {
|
||||
...this.apn,
|
||||
production: checked,
|
||||
};
|
||||
}
|
||||
|
||||
@action removeApnFile() {
|
||||
const apnConfig = this.apn;
|
||||
apnConfig.private_key_file = null;
|
||||
apnConfig.private_key_file_id = '';
|
||||
apnConfig.private_key_path = '';
|
||||
apnConfig._private_key_path = '';
|
||||
|
||||
this.apn = apnConfig;
|
||||
}
|
||||
|
||||
@action removeFirebaseCredentialsFile() {
|
||||
const firebaseConfig = this.firebase;
|
||||
firebaseConfig.credentials_file = null;
|
||||
firebaseConfig.credentials_file_id = '';
|
||||
firebaseConfig.credentials = '';
|
||||
|
||||
this.firebase = firebaseConfig;
|
||||
}
|
||||
|
||||
@action uploadApnKey(file) {
|
||||
try {
|
||||
this.fetch.uploadFile.perform(
|
||||
file,
|
||||
{
|
||||
path: 'apn',
|
||||
disk: 'local',
|
||||
path: `apn`,
|
||||
subject_uuid: this.currentUser.companyId,
|
||||
subject_type: 'company',
|
||||
type: 'apn_key',
|
||||
subject_type: `company`,
|
||||
type: `apn_key`,
|
||||
},
|
||||
(uploadedFile) => {
|
||||
const apnConfig = this.apn;
|
||||
apnConfig.private_key_file = uploadedFile;
|
||||
apnConfig.private_key_file_id = uploadedFile.id;
|
||||
apnConfig.private_key_path = uploadedFile.path;
|
||||
apnConfig._private_key_path = uploadedFile.path;
|
||||
|
||||
this.apn = apnConfig;
|
||||
}
|
||||
@@ -83,30 +67,6 @@ export default class ConfigureNotificationChannelsComponent extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
@action uploadFirebaseCredentials(file) {
|
||||
try {
|
||||
this.fetch.uploadFile.perform(
|
||||
file,
|
||||
{
|
||||
path: 'firebase',
|
||||
subject_uuid: this.currentUser.companyId,
|
||||
subject_type: 'company',
|
||||
type: 'firebase_credentials',
|
||||
},
|
||||
(uploadedFile) => {
|
||||
const firebaseConfig = this.firebase;
|
||||
firebaseConfig.credentials_file = uploadedFile;
|
||||
firebaseConfig.credentials_file_id = uploadedFile.id;
|
||||
firebaseConfig.credentials_file_path = uploadedFile.path;
|
||||
|
||||
this.firebase = firebaseConfig;
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
|
||||
@action setConfigValues(config) {
|
||||
for (const key in config) {
|
||||
if (this[key] !== undefined) {
|
||||
@@ -134,13 +94,9 @@ export default class ConfigureNotificationChannelsComponent extends Component {
|
||||
const apnConfig = this.apn;
|
||||
delete apnConfig.private_key_file;
|
||||
|
||||
const firebaseConfig = this.firebase;
|
||||
delete firebaseConfig.credentials_file;
|
||||
|
||||
this.fetch
|
||||
.post('settings/notification-channels-config', {
|
||||
apn: apnConfig,
|
||||
firebase: firebaseConfig,
|
||||
})
|
||||
.then(() => {
|
||||
this.notifications.success("Notification channel's configuration saved.");
|
||||
@@ -156,7 +112,6 @@ export default class ConfigureNotificationChannelsComponent extends Component {
|
||||
this.fetch
|
||||
.post('settings/test-notification-channels-config', {
|
||||
apn: this.apn,
|
||||
firebase: this.firebase,
|
||||
title: this.testTitle,
|
||||
message: this.testMessage,
|
||||
apnToken: this.apnToken,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<ContentPanel @title="Queue" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="Queue" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<InputGroup @name="Driver" @helpText="Select the default queue driver for Fleetbase to use.">
|
||||
<Select @options={{this.connections}} @value={{this.driver}} @onSelect={{this.setDriver}} @placeholder="Select queue driver" disabled={{this.isLoading}} class="w-full" />
|
||||
</InputGroup>
|
||||
@@ -12,7 +12,7 @@
|
||||
<InputGroup @name="SQS Suffix" @value={{this.sqsSuffix}} disabled={{this.isLoading}} />
|
||||
{{/if}}
|
||||
{{#if this.testResponse}}
|
||||
<div class="flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
|
||||
<span class="text-xs">{{this.this.testResponse.message}}</span>
|
||||
</div>
|
||||
|
||||
@@ -1,47 +1,45 @@
|
||||
<ContentPanel @title="AWS" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="AWS" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<InputGroup @name="AWS Access Key" @value={{this.awsKey}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="AWS Access Secret" @value={{this.awsSecret}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="AWS Region" @value={{this.awsRegion}} disabled={{this.isLoading}} />
|
||||
</ContentPanel>
|
||||
|
||||
<ContentPanel @title="Google Maps" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="Google Maps" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<InputGroup @name="Google Maps API Key" @value={{this.googleMapsApiKey}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="Google Maps Locale" @value={{this.googleMapsLocale}} disabled={{this.isLoading}} />
|
||||
</ContentPanel>
|
||||
|
||||
<ContentPanel @title="Twilio" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="Twilio" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<InputGroup @name="Twilio SID" @value={{this.twilioSid}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="Twilio Token" @value={{this.twilioToken}} disabled={{this.isLoading}} />
|
||||
<InputGroup @name="Twilio From" @value={{this.twilioFrom}} disabled={{this.isLoading}} />
|
||||
{{#if this.twilioTestResponse}}
|
||||
<div class="flex flex-row items-center rounded-lg border {{if (eq this.twilioTestResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.twilioTestResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<FaIcon @icon={{if (eq this.twilioTestResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.twilioTestResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
|
||||
<span class="text-xs">{{this.this.twilioTestResponse.message}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="flex flex-row items-center mt-3">
|
||||
<Input @value={{this.twilioTestPhone}} @type="tel" placeholder="Send Test SMS Here" class="form-input form-input-sm" />
|
||||
<Button @wrapperClass="ml-2" @icon="plug" @text="Test Twilio Config" @onClick={{perform this.testTwilio}} @isLoading={{this.testTwilio.isRunning}} @disabled={{not this.twilioTestPhone}} />
|
||||
<Button @wrapperClass="ml-2" @icon="plug" @text="Test Twilio Config" @onClick={{this.testTwilio}} @isLoading={{this.isLoading}} @disabled={{not this.twilioTestPhone}} />
|
||||
</div>
|
||||
</ContentPanel>
|
||||
|
||||
<ContentPanel @title="Sentry" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="Sentry" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<InputGroup @name="Sentry DSN" @value={{this.sentryDsn}} disabled={{this.isLoading}} />
|
||||
{{#if this.sentryTestResponse}}
|
||||
<div class="flex flex-row items-center rounded-lg border {{if (eq this.sentryTestResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.sentryTestResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<FaIcon @icon={{if (eq this.sentryTestResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.sentryTestResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
|
||||
<span class="text-xs">{{this.this.sentryTestResponse.message}}</span>
|
||||
</div>
|
||||
{{/if}}
|
||||
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Sentry Config" @onClick={{perform this.testSentry}} @isLoading={{this.testSentry.isRunning}} @disabled={{not this.sentryDsn}} />
|
||||
<Button @wrapperClass="mt-3" @icon="plug" @text="Test Sentry Config" @onClick={{this.testSentry}} @isLoading={{this.isLoading}} />
|
||||
</ContentPanel>
|
||||
|
||||
<ContentPanel @title="IP Info" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="IP Info" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<InputGroup @name="IP Info API Key" @value={{this.ipinfoApiKey}} disabled={{this.isLoading}} />
|
||||
</ContentPanel>
|
||||
|
||||
<Spacer @height="200px" />
|
||||
|
||||
<EmberWormhole @to="next-view-section-subheader-actions">
|
||||
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{perform this.save}} @disabled={{or this.save.isRunning this.loadConfigValues.isRunning}} @isLoading={{or this.save.isRunning this.loadConfigValues.isRunning}} />
|
||||
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{this.save}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
|
||||
</EmberWormhole>
|
||||
@@ -2,7 +2,6 @@ import Component from '@glimmer/component';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { action } from '@ember/object';
|
||||
import { task } from 'ember-concurrency';
|
||||
|
||||
export default class ConfigureServicesComponent extends Component {
|
||||
@service fetch;
|
||||
@@ -38,7 +37,7 @@ export default class ConfigureServicesComponent extends Component {
|
||||
*/
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.loadConfigValues.perform();
|
||||
this.loadConfigValues();
|
||||
}
|
||||
|
||||
@action setConfigValues(config) {
|
||||
@@ -49,19 +48,24 @@ export default class ConfigureServicesComponent extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
@task *loadConfigValues() {
|
||||
try {
|
||||
const config = yield this.fetch.get('settings/services-config');
|
||||
this.setConfigValues(config);
|
||||
return config;
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
@action loadConfigValues() {
|
||||
this.isLoading = true;
|
||||
|
||||
this.fetch
|
||||
.get('settings/services-config')
|
||||
.then((response) => {
|
||||
this.setConfigValues(response);
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@task *save() {
|
||||
try {
|
||||
yield this.fetch.post('settings/services-config', {
|
||||
@action save() {
|
||||
this.isLoading = true;
|
||||
|
||||
this.fetch
|
||||
.post('settings/services-config', {
|
||||
aws: {
|
||||
key: this.awsKey,
|
||||
secret: this.awsSecret,
|
||||
@@ -82,36 +86,45 @@ export default class ConfigureServicesComponent extends Component {
|
||||
sentry: {
|
||||
dsn: this.sentryDsn,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.notifications.success('Services configuration saved.');
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
|
||||
@task *testTwilio() {
|
||||
try {
|
||||
const twilioTestResponse = yield this.fetch.post('settings/test-twilio-config', {
|
||||
@action testTwilio() {
|
||||
this.isLoading = true;
|
||||
|
||||
this.fetch
|
||||
.post('settings/test-twilio-config', {
|
||||
sid: this.twilioSid,
|
||||
token: this.twilioToken,
|
||||
from: this.twilioFrom,
|
||||
phone: this.twilioTestPhone,
|
||||
})
|
||||
.then((response) => {
|
||||
this.twilioTestResponse = response;
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
this.twilioTestResponse = twilioTestResponse;
|
||||
return twilioTestResponse;
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
|
||||
@task *testSentry() {
|
||||
try {
|
||||
const sentryTestResponse = yield this.fetch.post('settings/test-sentry-config', {
|
||||
@action testSentry() {
|
||||
this.isLoading = true;
|
||||
|
||||
this.fetch
|
||||
.post('settings/test-sentry-config', {
|
||||
dsn: this.sentryDsn,
|
||||
})
|
||||
.then((response) => {
|
||||
this.sentryTestResponse = response;
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
this.sentryTestResponse = sentryTestResponse;
|
||||
return sentryTestResponse;
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<ContentPanel @title="SocketCluster Connection" @open={{true}} @wrapperClass="bordered-classic">
|
||||
<ContentPanel @title="SocketCluster Connection" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
|
||||
<p class="mb-4">The SocketCluster configuration cannot be changed at this time.</p>
|
||||
<div id="output" class="font-mono rounded-lg max-h-full px-6 py-4 overflow-y-scroll bg-black shadow-inner dark:shadow-none">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
@@ -37,7 +37,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{{#if this.testResponse}}
|
||||
<div class="flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
|
||||
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
|
||||
<span class="text-xs">{{this.this.testResponse.message}}</span>
|
||||
</div>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<div id="console-wormhole" />
|
||||
7
console/app/components/dashboard.hbs
Normal file
7
console/app/components/dashboard.hbs
Normal file
@@ -0,0 +1,7 @@
|
||||
<div class="fleetbase-dashboard-grid">
|
||||
<div class="grid grid-cols-1 md:grid-cols-12 gap-4">
|
||||
{{#each this.dashboards as |dashboard index|}}
|
||||
<Dashboard::Create @index={{index}} @dashboard={{dashboard}} />
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
48
console/app/components/dashboard.js
Normal file
48
console/app/components/dashboard.js
Normal file
@@ -0,0 +1,48 @@
|
||||
import Component from '@glimmer/component';
|
||||
import loadExtensions from '@fleetbase/ember-core/utils/load-extensions';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import { isArray } from '@ember/array';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { task } from 'ember-concurrency-decorators';
|
||||
|
||||
export default class DashboardComponent extends Component {
|
||||
@service fetch;
|
||||
@tracked extensions;
|
||||
@tracked dashboards = [];
|
||||
@tracked isLoading;
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.loadExtensions();
|
||||
}
|
||||
|
||||
@action async loadExtensions() {
|
||||
this.extensions = await loadExtensions();
|
||||
this.loadDashboardBuilds.perform();
|
||||
}
|
||||
|
||||
@task *loadDashboard(extension) {
|
||||
this.isLoading = extension.extension;
|
||||
let dashboardBuild;
|
||||
|
||||
try {
|
||||
dashboardBuild = yield this.fetch.get(extension.fleetbase.dashboard, {}, { namespace: '' });
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isArray(dashboardBuild)) {
|
||||
this.dashboards = [...this.dashboards, ...dashboardBuild.map((build) => ({ ...build, extension }))];
|
||||
}
|
||||
}
|
||||
|
||||
@task({ enqueue: true, maxConcurrency: 1 }) *loadDashboardBuilds() {
|
||||
const extensionsWithDashboards = this.extensions.filter((extension) => typeof extension.fleetbase?.dashboard === 'string');
|
||||
|
||||
for (let i = 0; i < extensionsWithDashboards.length; i++) {
|
||||
const extension = extensionsWithDashboards[i];
|
||||
yield this.loadDashboard.perform(extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="dashboard-component-count lg:col-span-2 h-full {{@options.wrapperClass}}">
|
||||
<h3 class="text-sm dark:text-gray-100 text-black mb-4 {{@options.titleClass}}">{{this.title}}</h3>
|
||||
<h1 class="text-3xl font-bold dark:text-gray-100 text-black {{@options.valueClass}}">
|
||||
{{this.value}}
|
||||
<div class="dashboard-component-count lg:col-span-2">
|
||||
<h3 class="text-sm dark:text-gray-100 text-black mb-4">{{@options.title}}</h3>
|
||||
<h1 class="text-3xl font-bold dark:text-gray-100 text-black mb-4">
|
||||
{{this.displayValue}}
|
||||
</h1>
|
||||
</div>
|
||||
@@ -1,5 +1,5 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { computed } from '@ember/object';
|
||||
import formatCurrency from '@fleetbase/ember-ui/utils/format-currency';
|
||||
import formatMeters from '@fleetbase/ember-ui/utils/format-meters';
|
||||
import formatBytes from '@fleetbase/ember-ui/utils/format-bytes';
|
||||
@@ -7,45 +7,11 @@ import formatDuration from '@fleetbase/ember-ui/utils/format-duration';
|
||||
import formatDate from '@fleetbase/ember-ui/utils/format-date';
|
||||
|
||||
export default class DashboardCountComponent extends Component {
|
||||
/**
|
||||
* The title of the metric count.
|
||||
*
|
||||
* @memberof WidgetKeyMetricsCountComponent
|
||||
*/
|
||||
@tracked title;
|
||||
|
||||
/**
|
||||
* The value to render
|
||||
*
|
||||
* @memberof WidgetKeyMetricsCountComponent
|
||||
*/
|
||||
@tracked value;
|
||||
|
||||
/**
|
||||
* Creates an instance of WidgetKeyMetricsCountComponent.
|
||||
* @param {EngineInstance} owner
|
||||
* @param {Object} { options }
|
||||
* @memberof WidgetKeyMetricsCountComponent
|
||||
*/
|
||||
constructor(owner, { options, title, value = null }) {
|
||||
super(...arguments);
|
||||
this.title = title;
|
||||
this.value = value;
|
||||
this.createRenderValueFromOptions(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the value to render using the options provided.
|
||||
*
|
||||
* @param {Object} [options={}]
|
||||
* @memberof WidgetKeyMetricsCountComponent
|
||||
*/
|
||||
createRenderValueFromOptions(options = {}) {
|
||||
if (value !== null) {
|
||||
return;
|
||||
}
|
||||
|
||||
let { format, currency, dateFormat, value } = options;
|
||||
@computed('args.options.{currency,dateFormat,format,value}') get displayValue() {
|
||||
let format = this.args.options?.format;
|
||||
let currency = this.args.options?.currency;
|
||||
let dateFormat = this.args.options?.dateFormat;
|
||||
let value = this.args.options?.value;
|
||||
|
||||
switch (format) {
|
||||
case 'money':
|
||||
@@ -72,6 +38,6 @@ export default class DashboardCountComponent extends Component {
|
||||
break;
|
||||
}
|
||||
|
||||
this.value = value;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
{{#if this.isLoading}}
|
||||
<Spinner class="mr-2i" />
|
||||
{{/if}}
|
||||
<h2 class="text-sm font-bold dark:text-gray-100 text-black">{{this.dashboard.title}}</h2>
|
||||
<h2 class="text-sm font-bold dark:text-gray-100 text-black">{{@dashboard.title}}</h2>
|
||||
</div>
|
||||
<div>
|
||||
<Dashboard::QueryParams @params={{this.dashboard.queryParams}} @onChange={{this.onQueryParamsChanged}} />
|
||||
<Dashboard::QueryParams @params={{@dashboard.queryParams}} @onChange={{this.onQueryParamsChanged}} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 lg:grid-cols-12 gap-4">
|
||||
@@ -3,29 +3,31 @@ import { tracked } from '@glimmer/tracking';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import { isArray } from '@ember/array';
|
||||
import { task } from 'ember-concurrency';
|
||||
import { task } from 'ember-concurrency-decorators';
|
||||
|
||||
export default class MetricComponent extends Component {
|
||||
export default class DashboardCreateComponent extends Component {
|
||||
@service fetch;
|
||||
@tracked isLoading = false;
|
||||
@tracked dashboard;
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.loadDashboard.perform();
|
||||
this.dashboard = this.args.dashboard;
|
||||
}
|
||||
|
||||
@action onQueryParamsChanged(changedParams) {
|
||||
this.loadDashboard.perform(changedParams);
|
||||
this.reloadDashboard.perform(changedParams);
|
||||
}
|
||||
|
||||
@task *loadDashboard(params) {
|
||||
@task *reloadDashboard(params) {
|
||||
const { extension } = this.args.dashboard;
|
||||
const index = this.args.index;
|
||||
let dashboards = [];
|
||||
|
||||
this.isLoading = true;
|
||||
|
||||
try {
|
||||
dashboards = yield this.fetch.get(this.args.options.endpoint, params, { namespace: '' });
|
||||
dashboards = yield this.fetch.get(extension.fleetbase.dashboard, params, { namespace: '' });
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
@@ -33,7 +35,7 @@ export default class MetricComponent extends Component {
|
||||
this.isLoading = false;
|
||||
|
||||
if (isArray(dashboards)) {
|
||||
this.dashboard = dashboards.objectAt(0);
|
||||
this.dashboard = dashboards.objectAt(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<Overlay @isOpen={{@isOpen}} @onLoad={{this.setOverlayContext}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @width={{or this.width @width "400px"}}>
|
||||
<Overlay::Header @title={{t "component.dashboard-widget-panel.select-widgets"}} @hideStatusDot={{true}} @titleWrapperClass="leading-5">
|
||||
<div class="flex flex-1 justify-end">
|
||||
<Button @type="default" @icon="times" @helpText={{t "component.dashboard-widget-panel.close-and-save"}} @onClick={{this.onPressClose}} />
|
||||
</div>
|
||||
</Overlay::Header>
|
||||
|
||||
<Overlay::Body @wrapperClass="new-service-rate-overlay-body px-4 space-y-4 pt-4">
|
||||
<div class="grid grid-cols-1 gap-4 text-xs dark:text-gray-100">
|
||||
{{#each this.availableWidgets as |widget|}}
|
||||
<div
|
||||
class="rounded-lg border border-gray-300 bg-white dark:border-gray-700 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-300 ease-in-out shadow-md px-4 py-2 cursor-pointer"
|
||||
{{on "click" (fn this.addWidgetToDashboard widget)}}
|
||||
>
|
||||
<div class="flex flex-row items-center leading-6 mb-2.5">
|
||||
<div class="w-8 flex items-center justify-start">
|
||||
<FaIcon @icon={{widget.icon}} class="text-lg text-gray-600 dark:text-gray-300" />
|
||||
</div>
|
||||
<p class="text-sm truncate font-semibold dark:text-gray-100 text-gray-800">
|
||||
{{t "component.dashboard-widget-panel.widget-name" widgetName=widget.name}}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-xs dark:text-gray-100 text-gray-800">{{widget.description}}</p>
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
<Spacer @height="300px" />
|
||||
</Overlay::Body>
|
||||
</Overlay>
|
||||
@@ -1,60 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
export default class DashboardWidgetPanelComponent extends Component {
|
||||
@service universe;
|
||||
@tracked availableWidgets = [];
|
||||
@tracked dashboard;
|
||||
@tracked isOpen = true;
|
||||
@service notifications;
|
||||
|
||||
/**
|
||||
* Constructs the component and applies initial state.
|
||||
*/
|
||||
constructor(owner, { dashboard }) {
|
||||
super(...arguments);
|
||||
|
||||
this.availableWidgets = this.universe.getDashboardWidgets();
|
||||
this.dashboard = dashboard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the overlay context.
|
||||
*
|
||||
* @action
|
||||
* @param {OverlayContextObject} overlayContext
|
||||
*/
|
||||
@action setOverlayContext(overlayContext) {
|
||||
this.context = overlayContext;
|
||||
|
||||
if (typeof this.args.onLoad === 'function') {
|
||||
this.args.onLoad(...arguments);
|
||||
}
|
||||
}
|
||||
|
||||
@action addWidgetToDashboard(widget) {
|
||||
// If widget is a component definition/class
|
||||
if (typeof widget.component === 'function') {
|
||||
widget.component = widget.component.name;
|
||||
}
|
||||
|
||||
this.args.dashboard.addWidget(widget).catch((error) => {
|
||||
this.notifications.serverError(error);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles cancel button press.
|
||||
*
|
||||
* @action
|
||||
*/
|
||||
@action onPressClose() {
|
||||
this.isOpen = false;
|
||||
|
||||
if (typeof this.args.onClose === 'function') {
|
||||
this.args.onClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
<div class="fleetbase-github-card relative flex-1 w-full" ...attributes>
|
||||
<div class="border dark:border-gray-700 border-gray-200 dark:bg-gray-800 bg-gray-50 rounded-lg shadow-sm flex flex-col">
|
||||
{{#if this.getRepositoryData.isRunning}}
|
||||
{{#if this.isLoading}}
|
||||
<div class="p-4">
|
||||
<Spinner />
|
||||
</div>
|
||||
{{else}}
|
||||
<div class="flex flex-row p-3 border-b dark:border-gray-700 border-gray-200">
|
||||
<div class="flex flex-row p-4 border-b dark:border-gray-700 border-gray-200">
|
||||
<div class="w-12 flex-shrink-0"><img src={{this.data.owner.avatar_url}} alt="fleetbase/fleetbase" class="rounded-full w-8 h-8" width="32" height="32" /></div>
|
||||
<div class="flex-1 -mt-2">
|
||||
<div class="flex flex-1 flex-row items-center justify-between mb-2">
|
||||
<a href={{this.data.html_url}} target="_github" class="dark:text-gray-100 text-black text-base font-semibold">{{this.data.full_name}}</a>
|
||||
<a href={{this.data.html_url}} target="_github" class="dark:text-gray-100 text-black text-lg font-semibold">{{this.data.full_name}}</a>
|
||||
<a href={{this.data.html_url}} target="_github" class="btn btn-xs btn-default">
|
||||
<FaIcon @icon="star" class="text-yellow-400" />
|
||||
<span class="hidden truncate lg:flex ml-2.5">Star on Github</span>
|
||||
<span class="hidden lg:flex ml-2.5">Star on Github</span>
|
||||
</a>
|
||||
</div>
|
||||
<p class="dark:text-gray-100 text-black text-sm">{{this.data.description}}</p>
|
||||
@@ -40,7 +40,7 @@
|
||||
</div>
|
||||
<div class="col-span-3 dark:text-gray-100 text-black text-xs flex flex-row">
|
||||
<span class="font-bold mr-1">{{this.data.open_issues_count}}</span>
|
||||
<span class="truncate"><span class="hidden lg:inline-flex">Open</span> Issues</span>
|
||||
<span><span class="hidden lg:inline-flex">Open</span> Issues</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { computed } from '@ember/object';
|
||||
import { action, computed } from '@ember/object';
|
||||
import { isArray } from '@ember/array';
|
||||
import { isBlank } from '@ember/utils';
|
||||
import { task } from 'ember-concurrency';
|
||||
import { storageFor } from 'ember-local-storage';
|
||||
import { add, isPast } from 'date-fns';
|
||||
import fetch from 'fetch';
|
||||
|
||||
export default class GithubCardComponent extends Component {
|
||||
@storageFor('local-cache') localCache;
|
||||
@tracked data = {
|
||||
owner: {
|
||||
avatar_url: 'https://avatars.githubusercontent.com/u/38091894?v=4',
|
||||
},
|
||||
};
|
||||
@tracked tags = [];
|
||||
@tracked data;
|
||||
@tracked tags;
|
||||
@tracked isLoading = false;
|
||||
|
||||
@computed('tags.length') get latestRelease() {
|
||||
if (isArray(this.tags) && this.tags.length) {
|
||||
@@ -37,47 +30,29 @@ export default class GithubCardComponent extends Component {
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.getRepositoryData.perform();
|
||||
this.getRepositoryTags.perform();
|
||||
this.loadRepositoryData();
|
||||
this.loadRepositoryTags();
|
||||
}
|
||||
|
||||
@task *getRepositoryData() {
|
||||
// Check if cached data and expiration are available
|
||||
const cachedData = this.localCache.get('fleetbase-github-data');
|
||||
const expiration = this.localCache.get('fleetbase-github-data-expiration');
|
||||
@action loadRepositoryData() {
|
||||
this.isLoading = true;
|
||||
|
||||
// Check if the cached data is still valid
|
||||
if (cachedData && expiration && !isPast(new Date(expiration))) {
|
||||
// Use cached data
|
||||
this.data = cachedData;
|
||||
} else {
|
||||
// Fetch new data
|
||||
const response = yield fetch('https://api.github.com/repos/fleetbase/fleetbase');
|
||||
if (response.ok) {
|
||||
this.data = yield response.json();
|
||||
this.localCache.set('fleetbase-github-data', this.data);
|
||||
this.localCache.set('fleetbase-github-data-expiration', add(new Date(), { hours: 6 }));
|
||||
}
|
||||
}
|
||||
return fetch('https://api.github.com/repos/fleetbase/fleetbase')
|
||||
.then((response) => {
|
||||
return response.json().then((data) => {
|
||||
this.data = data;
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
this.isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
@task *getRepositoryTags() {
|
||||
// Check if cached tags and expiration are available
|
||||
const cachedTags = this.localCache.get('fleetbase-github-tags');
|
||||
const expiration = this.localCache.get('fleetbase-github-tags-expiration');
|
||||
|
||||
// Check if the cached tags are still valid
|
||||
if (cachedTags && expiration && !isPast(new Date(expiration))) {
|
||||
// Use cached tags
|
||||
this.tags = cachedTags;
|
||||
} else {
|
||||
// Fetch new tags
|
||||
const response = yield fetch('https://api.github.com/repos/fleetbase/fleetbase/tags');
|
||||
if (response.ok) {
|
||||
this.tags = yield response.json();
|
||||
this.localCache.set('fleetbase-github-tags', this.tags);
|
||||
this.localCache.set('fleetbase-github-tags-expiration', add(new Date(), { hours: 6 }));
|
||||
}
|
||||
}
|
||||
@action loadRepositoryTags() {
|
||||
return fetch('https://api.github.com/repos/fleetbase/fleetbase/tags').then((response) => {
|
||||
return response.json().then((data) => {
|
||||
this.tags = data;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
{{#if this.isImpersonator}}
|
||||
<EmberWormhole @to="view-header-actions">
|
||||
<div class="next-user-button locale-selector-tray" ...attributes>
|
||||
<BasicDropdown
|
||||
class={{@wrapperClass}}
|
||||
@onOpen={{@onOpen}}
|
||||
@onClose={{@onClose}}
|
||||
@calculatePosition={{this.calculatePosition}}
|
||||
@verticalPosition={{@verticalPosition}}
|
||||
@horizontalPosition={{@horizontalPosition}}
|
||||
@renderInPlace={{or @renderInPlace (not (media "isMobile"))}}
|
||||
as |dd|
|
||||
>
|
||||
<dd.Trigger class="{{@triggerClass}} local-selector-tray-trigger {{if (media 'isMobile') 'is-mobile'}}">
|
||||
<div class="next-org-button-trigger flex-shrink-0 {{if dd.isOpen 'is-open'}}">
|
||||
<FaIcon @icon="user-secret" @size="sm" />
|
||||
</div>
|
||||
</dd.Trigger>
|
||||
<dd.Content class="{{@contentClass}} locale-selector-tray-content {{if (media 'isMobile') 'is-mobile'}}">
|
||||
<div class="next-dd-menu {{@dropdownMenuClass}} {{if dd.isOpen 'is-open'}}">
|
||||
<div class="px-1">
|
||||
<a href="javascript:;" class="next-dd-item" {{on "click" this.restoreSession}}>
|
||||
<div class="flex flex-row items-centerw-full">
|
||||
<div class="w-6">
|
||||
<FaIcon @icon="person-walking-arrow-loop-left" @size="sm" />
|
||||
</div>
|
||||
<div>End Impersonation</div>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</dd.Content>
|
||||
</BasicDropdown>
|
||||
</div>
|
||||
</EmberWormhole>
|
||||
{{/if}}
|
||||
@@ -1,39 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import { later } from '@ember/runloop';
|
||||
|
||||
export default class ImpersonatorTrayComponent extends Component {
|
||||
@service session;
|
||||
@service notifications;
|
||||
@service router;
|
||||
@service fetch;
|
||||
|
||||
get isImpersonator() {
|
||||
return typeof this.session.data?.authenticated?.impersonator === 'string';
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore session
|
||||
*
|
||||
* @memberof ConsoleAdminOrganizationsIndexUsersController
|
||||
*/
|
||||
@action async restoreSession() {
|
||||
try {
|
||||
const { token } = await this.fetch.delete('auth/impersonate');
|
||||
await this.router.transitionTo('console');
|
||||
this.session.manuallyAuthenticate(token);
|
||||
this.notifications.info(`Ending impersonation session.`);
|
||||
later(
|
||||
this,
|
||||
() => {
|
||||
window.location.reload();
|
||||
},
|
||||
600
|
||||
);
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<Modal::Default @modalIsOpened={{@modalIsOpened}} @options={{@options}} @confirm={{@onConfirm}} @decline={{@onDecline}}>
|
||||
<div class="modal-body-container">
|
||||
<InputGroup @name="Dashboard name" @value={{@options.name}} @helpText="Enter the name of your dashboard" />
|
||||
</div>
|
||||
</Modal::Default>
|
||||
@@ -1,12 +0,0 @@
|
||||
<Modal::Default @modalIsOpened={{@modalIsOpened}} @options={{@options}} @confirm={{@onConfirm}} @decline={{@onDecline}}>
|
||||
<div class="modal-body-container pt-0i text-gray-900 dark:text-white">
|
||||
<InputGroup @name="Organization name" @value={{@options.organization.name}} />
|
||||
<InputGroup @name="Organization description" @value={{@options.organization.description}} />
|
||||
<InputGroup @name="Organization phone number">
|
||||
<PhoneInput @value={{@options.organization.phone}} @onInput={{fn (mut @options.organization.phone)}} class="form-input w-full" />
|
||||
</InputGroup>
|
||||
<InputGroup @name="Organization currency">
|
||||
<CurrencySelect @value={{@options.organization.currency}} @onSelect={{fn (mut @options.organization.currency)}} @triggerClass="w-full form-select" />
|
||||
</InputGroup>
|
||||
</div>
|
||||
</Modal::Default>
|
||||
@@ -1,3 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
|
||||
export default class ModalsEditOrganizationComponent extends Component {}
|
||||
@@ -1,43 +0,0 @@
|
||||
<Modal::Default @modalIsOpened={{@modalIsOpened}} @options={{@options}} @confirm={{@onConfirm}} @decline={{@onDecline}}>
|
||||
<div class="modal-body-container pt-0i text-gray-900 dark:text-white">
|
||||
{{#if @options.isOwner}}
|
||||
{{#if @options.hasOtherMembers}}
|
||||
<p>
|
||||
<div class="text-base mb-2">
|
||||
As the owner of
|
||||
<strong>{{@options.organization.name}}</strong>, leaving the organization requires you to nominate a new owner.
|
||||
</div>
|
||||
<div>Please select a member from the dropdown below to transfer ownership before you can proceed.</div>
|
||||
</p>
|
||||
<InputGroup @name="Select a New Owner" @wrapperClass="mt-2 mb-0i">
|
||||
<Select
|
||||
@options={{@options.organization.users}}
|
||||
@value={{@options.newOwnerId}}
|
||||
@onSelect={{@options.selectNewOwner}}
|
||||
@optionLabel="name"
|
||||
@optionValue="id"
|
||||
@placeholder="Select a member"
|
||||
/>
|
||||
</InputGroup>
|
||||
{{else if @options.willBeDeleted}}
|
||||
<p>
|
||||
<div class="text-base mb-2">
|
||||
You are the sole owner of
|
||||
<strong>{{@options.organization.name}}</strong>.
|
||||
</div>
|
||||
<div>By leaving, the organization will be permanently deleted along with all its data.</div>
|
||||
<div>Are you sure you want to proceed?</div>
|
||||
</p>
|
||||
<p class="mt-3"><em>This action cannot be undone.</em></p>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<p>
|
||||
<div class="text-base mb-2">
|
||||
Are you sure you want to leave the organization
|
||||
<strong>{{@options.organization.name}}</strong>?
|
||||
</div>
|
||||
<div>You will no longer have access to its resources and settings.</div>
|
||||
</p>
|
||||
{{/if}}
|
||||
</div>
|
||||
</Modal::Default>
|
||||
@@ -1,3 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
|
||||
export default class ModalsLeaveOrganizationComponent extends Component {}
|
||||
@@ -1,13 +0,0 @@
|
||||
<Modal::Default @modalIsOpened={{@modalIsOpened}} @options={{@options}} @confirm={{@onConfirm}} @decline={{@onDecline}}>
|
||||
<div class="px-5">
|
||||
{{#if @options.body}}
|
||||
<p class="dark:text-gray-400 text-gray-700 mb-4">{{@options.body}}</p>
|
||||
{{/if}}
|
||||
<InputGroup>
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
<InputGroup @name="Password" @type="password" @value={{this.password}} @wrapperClass="mb-0i" />
|
||||
<InputGroup @name="Confirm Password" @type="password" @value={{this.confirmPassword}} @wrapperClass="mb-0i" />
|
||||
</div>
|
||||
</InputGroup>
|
||||
</div>
|
||||
</Modal::Default>
|
||||
@@ -1,49 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { task } from 'ember-concurrency';
|
||||
|
||||
export default class ModalsValidatePasswordComponent extends Component {
|
||||
@service fetch;
|
||||
@service notifications;
|
||||
@tracked options = {};
|
||||
@tracked password;
|
||||
@tracked confirmPassword;
|
||||
|
||||
constructor(owner, { options }) {
|
||||
super(...arguments);
|
||||
this.options = options;
|
||||
this.setupOptions();
|
||||
}
|
||||
|
||||
setupOptions() {
|
||||
this.options.title = 'Validate Current Password';
|
||||
this.options.acceptButtonText = 'Validate Password';
|
||||
this.options.declineButtonHidden = true;
|
||||
this.options.confirm = (modal) => {
|
||||
modal.startLoading();
|
||||
return this.validatePassword.perform();
|
||||
};
|
||||
}
|
||||
|
||||
@task *validatePassword() {
|
||||
let isPasswordValid = false;
|
||||
|
||||
try {
|
||||
yield this.fetch.post('users/validate-password', {
|
||||
password: this.password,
|
||||
password_confirmation: this.confirmPassword,
|
||||
});
|
||||
|
||||
isPasswordValid = true;
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error, 'Invalid current password.');
|
||||
}
|
||||
|
||||
if (typeof this.options.onValidated === 'function') {
|
||||
this.options.onValidated(isPasswordValid);
|
||||
}
|
||||
|
||||
return isPasswordValid;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<div class="bg-white dark:bg-gray-800 py-5 px-4 shadow rounded-lg w-full">
|
||||
<div class="mb-4">
|
||||
<Image src={{@brand.logo_url}} @fallbackSrc="/images/fleetbase-logo-svg.svg" alt={{t "app.name"}} height="56" class="h-10 object-contain mx-auto" />
|
||||
<div class="mt-2">
|
||||
<h2 class="text-center text-lg font-extrabold text-gray-900 dark:text-white truncate">
|
||||
{{t "onboard.index.title"}}
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex px-3 py-2 mb-4 rounded-md shadow-sm bg-blue-200">
|
||||
<div>
|
||||
<FaIcon @icon="hand-spock" @size="lg" class="text-blue-900 mr-4" />
|
||||
</div>
|
||||
<p class="flex-1 text-sm text-blue-900 dark:text-blue-900">
|
||||
{{t "onboard.index.welcome-title" htmlSafe=true companyName=(t "app.name")}}
|
||||
{{t "onboard.index.welcome-text"}}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<form {{on "submit" (perform this.onboard)}}>
|
||||
{{#if this.error}}
|
||||
<InfoBlock @icon="exclamation-triangle" @text={{this.error}} class="mb-6 px-3 py-2 bg-red-300 text-red-900" @textClass="text-red-900" />
|
||||
{{/if}}
|
||||
<InputGroup @name={{t "onboard.index.full-name"}} @value={{this.name}} @helpText={{t "onboard.index.full-name-help-text"}} @inputClass="input-lg" />
|
||||
<InputGroup @name={{t "onboard.index.your-email"}} @type="email" @value={{this.email}} @helpText={{t "onboard.index.your-email-help-text"}} @inputClass="input-lg" />
|
||||
<InputGroup @name={{t "onboard.index.phone"}} @helpText={{t "onboard.index.phone-help-text"}}>
|
||||
<PhoneInput @onInput={{fn (mut this.phone)}} class="form-input input-lg w-full" />
|
||||
</InputGroup>
|
||||
<InputGroup @name={{t "onboard.index.organization-name"}} @value={{this.organization_name}} @helpText={{t "onboard.index.organization-help-text"}} @inputClass="input-lg" />
|
||||
<InputGroup @name={{t "onboard.index.password"}} @value={{this.password}} @type="password" @helpText={{t "onboard.index.password-help-text"}} @inputClass="input-lg" />
|
||||
<InputGroup @name={{t "onboard.index.confirm-password"}} @value={{this.password_confirmation}} @type="password" @helpText={{t "onboard.index.confirm-password-help-text"}} @inputClass="input-lg" />
|
||||
|
||||
<div class="flex items-center justify-end mt-5">
|
||||
<Button @buttonType="submit" @icon="check" @iconPrefix="fas" @type="primary" @size="lg" @text={{t "onboard.index.continue-button-text"}} @isLoading={{this.onboard.isRunning}} @disabled={{not this.filled}} />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<RegistryYield @registry="onboard" as |YieldedComponent ctx|>
|
||||
<YieldedComponent @context={{ctx}} />
|
||||
</RegistryYield>
|
||||
</div>
|
||||
@@ -1,77 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { action, getProperties } from '@ember/object';
|
||||
import { isBlank } from '@ember/utils';
|
||||
import { task } from 'ember-concurrency';
|
||||
import OnboardValidations from '../../validations/onboard';
|
||||
import lookupValidator from 'ember-changeset-validations';
|
||||
import Changeset from 'ember-changeset';
|
||||
|
||||
export default class OnboardingFormComponent extends Component {
|
||||
@service fetch;
|
||||
@service session;
|
||||
@service router;
|
||||
@service notifications;
|
||||
@service urlSearchParams;
|
||||
@tracked name;
|
||||
@tracked email;
|
||||
@tracked phone;
|
||||
@tracked organization_name;
|
||||
@tracked password;
|
||||
@tracked password_confirmation;
|
||||
@tracked error;
|
||||
|
||||
get filled() {
|
||||
// eslint-disable-next-line ember/no-get
|
||||
const input = getProperties(this, 'name', 'email', 'phone', 'organization_name', 'password', 'password_confirmation');
|
||||
return Object.values(input).every((val) => !isBlank(val));
|
||||
}
|
||||
|
||||
@task *onboard(event) {
|
||||
event?.preventDefault?.();
|
||||
|
||||
// eslint-disable-next-line ember/no-get
|
||||
const input = getProperties(this, 'name', 'email', 'phone', 'organization_name', 'password', 'password_confirmation');
|
||||
const changeset = new Changeset(input, lookupValidator(OnboardValidations), OnboardValidations);
|
||||
|
||||
yield changeset.validate();
|
||||
|
||||
if (changeset.get('isInvalid')) {
|
||||
const errorMessage = changeset.errors.firstObject.validation.firstObject;
|
||||
|
||||
this.notifications.error(errorMessage);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set user timezone
|
||||
input.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
|
||||
try {
|
||||
const { status, skipVerification, token, session } = yield this.fetch.post('onboard/create-account', input);
|
||||
if (status !== 'success') {
|
||||
this.notifications.error('Onboard failed');
|
||||
return;
|
||||
}
|
||||
|
||||
// save session
|
||||
this.args.context.persist('session', session);
|
||||
|
||||
if (skipVerification === true && token) {
|
||||
// only manually authenticate if skip verification
|
||||
this.session.isOnboarding().manuallyAuthenticate(token);
|
||||
|
||||
yield this.router.transitionTo('console');
|
||||
return this.notifications.success('Welcome to Fleetbase!');
|
||||
} else {
|
||||
this.args.orchestrator.next();
|
||||
this.urlSearchParams.setParamsToCurrentUrl({
|
||||
step: this.args.orchestrator?.current?.id,
|
||||
session,
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
this.notifications.serverError(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
{{page-title (t "onboard.verify-email.header-title")}}
|
||||
|
||||
{{#if this.initialized}}
|
||||
<div class="bg-white dark:bg-gray-800 py-8 px-4 shadow rounded-lg w-full">
|
||||
<div class="mb-6">
|
||||
<LinkTo @route="console" class="flex items-center justify-center">
|
||||
<LogoIcon @size="12" class="rounded-md" />
|
||||
</LinkTo>
|
||||
<h2 class="mt-6 text-center text-lg font-extrabold text-gray-900 dark:text-white truncate">
|
||||
{{t "onboard.verify-email.title"}}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<InfoBlock @type="info" @icon="shield-halved" @iconSize="lg">
|
||||
{{t "onboard.verify-email.message-text" htmlSafe=true}}
|
||||
</InfoBlock>
|
||||
|
||||
<form class="mt-8 space-y-6" {{on "submit" (perform this.verify)}}>
|
||||
<InputGroup
|
||||
@type="tel"
|
||||
@name={{t "onboard.verify-email.verification-input-label"}}
|
||||
@value={{this.code}}
|
||||
@helpText={{t "onboard.verify-email.verification-code-text"}}
|
||||
@inputClass="input-lg"
|
||||
{{on "input" this.verification.validateInput}}
|
||||
{{did-insert this.verification.validateInput}}
|
||||
/>
|
||||
|
||||
<div class="flex flex-row items-center space-x-4">
|
||||
<Button
|
||||
@icon="check"
|
||||
@iconPrefix="fas"
|
||||
@buttonType="submit"
|
||||
@type="primary"
|
||||
@size="lg"
|
||||
@text="Verify & Continue"
|
||||
@isLoading={{this.verify.isRunning}}
|
||||
@disabled={{not this.verification.ready}}
|
||||
/>
|
||||
<a href="#" {{on "click" this.verification.didntReceiveCode}} class="text-sm text-blue-400 hover:text-blue-300">{{t "onboard.verify-email.didnt-receive-a-code"}}</a>
|
||||
</div>
|
||||
|
||||
{{#if this.verification.waiting}}
|
||||
<div class="flex flex-col flex-grow-0 flex-shrink-0 text-sm bg-yellow-800 border border-yellow-600 px-2 py-2 rounded-md text-yellow-100 my-4 transition-all">
|
||||
<div class="flex flex-row items-start mb-2">
|
||||
<div class="w-8 flex-grow-0 flex-shrink-0">
|
||||
<FaIcon @icon="triangle-exclamation" @size="xl" class="pt-1" />
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
<div class="flex-1 text-sm text-yellow-100">
|
||||
<div>{{t "auth.verification.didnt-receive-a-code" htmlSafe=true}}</div>
|
||||
<div>{{t "auth.verification.not-sent.alternative-choice" htmlSafe=true}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex items-center space-x-2">
|
||||
<Button
|
||||
@text={{t "auth.verification.not-sent.resend-email"}}
|
||||
@buttonType="button"
|
||||
@type="link"
|
||||
class="text-yellow-100"
|
||||
@wrapperClass="px-4 py-2 bg-gray-900 bg-opacity-25 hover:opacity-50"
|
||||
@onClick={{this.verification.resendEmail}}
|
||||
/>
|
||||
<Button
|
||||
@text={{t "auth.verification.not-sent.send-by-sms"}}
|
||||
@buttonType="button"
|
||||
@type="link"
|
||||
class="text-yellow-100"
|
||||
@wrapperClass="px-4 py-2 bg-gray-900 bg-opacity-25 hover:opacity-50"
|
||||
@onClick={{this.verification.resendBySms}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</form>
|
||||
</div>
|
||||
{{/if}}
|
||||
@@ -1,53 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { action } from '@ember/object';
|
||||
import { later, next } from '@ember/runloop';
|
||||
import { not } from '@ember/object/computed';
|
||||
import { task } from 'ember-concurrency';
|
||||
|
||||
export default class OnboardingVerifyEmailComponent extends Component {
|
||||
@service('session') authSession;
|
||||
@service('user-verification') verification;
|
||||
@service fetch;
|
||||
@service notifications;
|
||||
@service router;
|
||||
@service urlSearchParams;
|
||||
@tracked code;
|
||||
@tracked session;
|
||||
@tracked initialized = false;
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
next(() => this.#initialize());
|
||||
}
|
||||
|
||||
#initialize() {
|
||||
this.code = this.urlSearchParams.get('code');
|
||||
this.session = this.args.context.get('session') ?? this.urlSearchParams.get('session');
|
||||
this.initialized = true;
|
||||
this.verification.start();
|
||||
}
|
||||
|
||||
@task *verify(event) {
|
||||
event?.preventDefault?.();
|
||||
|
||||
try {
|
||||
const { status, token } = yield this.fetch.post('onboard/verify-email', { session: this.session, code: this.code });
|
||||
if (status === 'ok') {
|
||||
this.notifications.success('Email successfully verified!');
|
||||
|
||||
if (token) {
|
||||
this.notifications.info('Welcome to Fleetbase!');
|
||||
this.authSession.manuallyAuthenticate(token);
|
||||
|
||||
return this.router.transitionTo('console');
|
||||
}
|
||||
|
||||
return this.router.transitionTo('auth.login');
|
||||
}
|
||||
} catch (error) {
|
||||
this.notifications.serverError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<section class="onboarding step-host">
|
||||
{{#if this.initialized}}
|
||||
{{#if this.currentComponent}}
|
||||
{{component this.currentComponent context=this.context orchestrator=this.orchestrator brand=@brand}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<div class="flex items-center justify-center min-h-24">
|
||||
<Spinner />
|
||||
</div>
|
||||
{{/if}}
|
||||
</section>
|
||||
@@ -1,27 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { next } from '@ember/runloop';
|
||||
|
||||
export default class OnboardingYieldComponent extends Component {
|
||||
@service('onboarding-orchestrator') orchestrator;
|
||||
@service('onboarding-context') context;
|
||||
@tracked initialized = false;
|
||||
|
||||
get currentComponent() {
|
||||
return this.orchestrator.current && this.orchestrator.current.component;
|
||||
}
|
||||
|
||||
constructor(owner, { step, session, code }) {
|
||||
super(...arguments);
|
||||
next(() => this.#initialize(step, session, code));
|
||||
}
|
||||
|
||||
#initialize(step, session, code) {
|
||||
if (step) this.orchestrator.goto(step);
|
||||
if (session) this.context.persist('session', session);
|
||||
if (code) this.context.set('code', code);
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{{#if this.shouldRender}}
|
||||
<InfoBlock @icon="triangle-exclamation" class="two-fa-enforcement-alert bg-yellow-100 border-2 border-yellow-600 dark:border-yellow-500 rounded-lg py-3.5 px-5">
|
||||
<div class="flex flex-row justify-between">
|
||||
<div class="flex-1 pr-2">
|
||||
<p class="text-sm dark:text-yellow-900 mb-2">
|
||||
{{t "component.two-fa-enforcement-alert.message"}}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex-shrink-0">
|
||||
<Button id="two-fa-setup-button" @text={{t "component.two-fa-enforcement-alert.button-text"}} @icon="shield-halved" @type="warning" @buttonType="button" @onClick={{this.transitionToTwoFactorSettings}} />
|
||||
</div>
|
||||
</div>
|
||||
</InfoBlock>
|
||||
{{/if}}
|
||||
@@ -1,74 +0,0 @@
|
||||
import Component from '@glimmer/component';
|
||||
import { action } from '@ember/object';
|
||||
import { task } from 'ember-concurrency';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
|
||||
/**
|
||||
* Glimmer component for handling notification enforcement.
|
||||
*
|
||||
* @class EnforceNotificationComponent
|
||||
* @extends Component
|
||||
*/
|
||||
export default class TwoFaEnforcementAlertComponent extends Component {
|
||||
/**
|
||||
* Flag to determine whether the component should render or not.
|
||||
*
|
||||
* @property {boolean} shouldRender
|
||||
* @default false
|
||||
* @tracked
|
||||
*/
|
||||
@tracked shouldRender = false;
|
||||
|
||||
/**
|
||||
* Ember Router service for transitioning between routes.
|
||||
*
|
||||
* @type {RouterService}
|
||||
*/
|
||||
@service router;
|
||||
|
||||
/**
|
||||
* Fetch service for making HTTP requests.
|
||||
*
|
||||
* @property {FetchService} fetch
|
||||
* @inject
|
||||
*/
|
||||
@service fetch;
|
||||
|
||||
/**
|
||||
* Constructor method for the ConsoleAccountAuthController.
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.checkTwoFactorEnforcement.perform();
|
||||
}
|
||||
|
||||
/**
|
||||
* Transition to the users auth page.
|
||||
*
|
||||
* @method transitionToTwoFa
|
||||
* @memberof ConsoleHomeController
|
||||
*/
|
||||
@action transitionToTwoFactorSettings() {
|
||||
this.router.transitionTo('console.account.auth');
|
||||
}
|
||||
|
||||
@task *checkTwoFactorEnforcement() {
|
||||
const shouldRender = yield this.fetch.get('two-fa/enforce').catch((error) => {
|
||||
this.notifications.serverError(error);
|
||||
});
|
||||
|
||||
/**
|
||||
* Task to check whether two-factor authentication enforcement is required.
|
||||
*
|
||||
* @method checkTwoFactorEnforcement
|
||||
* @memberof TwoFaEnforcementAlertComponent
|
||||
* @task
|
||||
*/
|
||||
if (shouldRender) {
|
||||
this.shouldRender = shouldRender.shouldEnforce;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user