mirror of
https://github.com/fleetbase/fleetbase.git
synced 2026-01-08 07:16:49 +00:00
Compare commits
140 Commits
v0.1.4
...
dev-v0.1.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7ff7094b6 | ||
|
|
690c9d7486 | ||
|
|
6deeb9fd0a | ||
|
|
4dbe344bb5 | ||
|
|
216e6a9a18 | ||
|
|
5855df6a5d | ||
|
|
782c1aa706 | ||
|
|
32cca548c3 | ||
|
|
1761b45911 | ||
|
|
93ac555427 | ||
|
|
04b6a1f47e | ||
|
|
843e9a21cc | ||
|
|
220b486c3d | ||
|
|
60690ec334 | ||
|
|
a71c3c46d8 | ||
|
|
f956f853e1 | ||
|
|
c2efb2ac4d | ||
|
|
bb0951feba | ||
|
|
fca83a25e5 | ||
|
|
f0f3800d3c | ||
|
|
2edb3f66e1 | ||
|
|
36b15f1544 | ||
|
|
60f8f33d5c | ||
|
|
6ed95b8cd7 | ||
|
|
079cfabeb5 | ||
|
|
d8d8063620 | ||
|
|
46b3554fce | ||
|
|
d604acebe4 | ||
|
|
962f46d4e2 | ||
|
|
664d7f19cd | ||
|
|
06dcb90499 | ||
|
|
6d0ac8496d | ||
|
|
10f8e694fe | ||
|
|
8e68ed1aeb | ||
|
|
267184df5f | ||
|
|
98d96a50ab | ||
|
|
51f8e4d289 | ||
|
|
04b01c734d | ||
|
|
405e299f07 | ||
|
|
aea4b781b8 | ||
|
|
35e81f05cd | ||
|
|
9d388892b1 | ||
|
|
becb39b447 | ||
|
|
f490a552c4 | ||
|
|
95381ba140 | ||
|
|
7b190d7718 | ||
|
|
92c153cf93 | ||
|
|
ef662fbd5e | ||
|
|
a5d05de27c | ||
|
|
5a6f44aee5 | ||
|
|
60cbc41b36 | ||
|
|
81e3d8466d | ||
|
|
4f9096a94a | ||
|
|
122fcf80cb | ||
|
|
50b5f54a63 | ||
|
|
243032469d | ||
|
|
42d26a6d81 | ||
|
|
e2b2097855 | ||
|
|
dbcc2fe8ef | ||
|
|
d34b845719 | ||
|
|
a8e050b20c | ||
|
|
9b68458114 | ||
|
|
eb12313614 | ||
|
|
68ee8be32c | ||
|
|
6f35a2b456 | ||
|
|
4bdd25288a | ||
|
|
5804f65ef6 | ||
|
|
4db3677b6d | ||
|
|
475c03c077 | ||
|
|
00b49a7c04 | ||
|
|
768fa6fc27 | ||
|
|
ed72c2afdd | ||
|
|
3aa5e2f89e | ||
|
|
2656c764a1 | ||
|
|
c217d6dc44 | ||
|
|
c68ec787c1 | ||
|
|
22a2f2048e | ||
|
|
c53d360ef0 | ||
|
|
406ca11199 | ||
|
|
9c604edcf5 | ||
|
|
cb96b4112c | ||
|
|
a502e1f5f3 | ||
|
|
27e10a2b33 | ||
|
|
1c70b2f62c | ||
|
|
a8ba45fc73 | ||
|
|
f6a7edf6f4 | ||
|
|
9889c4b4aa | ||
|
|
8bdababe5e | ||
|
|
a3184b3c6e | ||
|
|
1de56e08fa | ||
|
|
475b7ddda0 | ||
|
|
f9ba04198c | ||
|
|
e8fce1b1fc | ||
|
|
174dd83542 | ||
|
|
629d8bdd26 | ||
|
|
045bcc1648 | ||
|
|
a0e9a912f6 | ||
|
|
cbed2de0d5 | ||
|
|
557666252b | ||
|
|
7cf544bd30 | ||
|
|
5bf9e691aa | ||
|
|
011f658086 | ||
|
|
08b50cbfc1 | ||
|
|
6c0888ffae | ||
|
|
de4b088c31 | ||
|
|
1e5ea0e2fa | ||
|
|
0f8f7bb423 | ||
|
|
1b4993cb93 | ||
|
|
2d905e50c9 | ||
|
|
98b9afd151 | ||
|
|
03e6a87696 | ||
|
|
947746e4f1 | ||
|
|
d819516a17 | ||
|
|
3a34ff1627 | ||
|
|
cb53cb7270 | ||
|
|
f75efa6c07 | ||
|
|
90b1987ade | ||
|
|
bc854c5d6c | ||
|
|
b467f30d69 | ||
|
|
74ed29ad8c | ||
|
|
04125ebfb3 | ||
|
|
05746fccd0 | ||
|
|
c90df0218e | ||
|
|
03bbae856a | ||
|
|
71d27375c6 | ||
|
|
75a1a1b389 | ||
|
|
fc5a5df5c7 | ||
|
|
3dfa7a4076 | ||
|
|
45387cb360 | ||
|
|
6425180c40 | ||
|
|
98f3a2ceba | ||
|
|
275b1bcab8 | ||
|
|
e61ace5bcb | ||
|
|
b5d6ba2114 | ||
|
|
7b62ff9d50 | ||
|
|
b601136754 | ||
|
|
b1da01d4f6 | ||
|
|
80b43ffa72 | ||
|
|
c1545dbd14 | ||
|
|
452f8c4bd5 |
163
.github/workflows/cd.yml
vendored
Normal file
163
.github/workflows/cd.yml
vendored
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
name: Fleetbase CI/CD
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "deploy/*" ]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
PROJECT: ${{ secrets.PROJECT }}
|
||||||
|
|
||||||
|
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@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: Login to Amazon ECR
|
||||||
|
id: login-ecr
|
||||||
|
uses: aws-actions/amazon-ecr-login@v1
|
||||||
|
|
||||||
|
- 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: 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
|
||||||
|
|
||||||
|
- 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: |-
|
||||||
|
set -eu
|
||||||
|
# run deploy.sh script before deployments
|
||||||
|
env "ECS_RUN.SERVICE=app" "ECS_RUN.LAUNCH_TYPE=FARGATE" ./ecs-tool run --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
|
||||||
|
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: 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: |
|
||||||
|
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
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
pnpm build
|
||||||
|
working-directory: ./console
|
||||||
|
|
||||||
|
- name: Deploy Console 🚀
|
||||||
|
run: |
|
||||||
|
DEPLOY_BUCKET=${{ env.PROJECT }}-${{ env.STACK }}
|
||||||
|
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}
|
||||||
38
.github/workflows/ci.yml
vendored
38
.github/workflows/ci.yml
vendored
@@ -7,16 +7,11 @@ on:
|
|||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
env:
|
|
||||||
REGISTRY: ghcr.io/fleetbase
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build and Start Docker Services
|
name: Build and Start Docker Services
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
@@ -27,33 +22,16 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
- name: Log in to the Container registry
|
- name: Prepare Composer Auth Secret
|
||||||
uses: docker/login-action@v2
|
run: |
|
||||||
with:
|
if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then
|
||||||
registry: ${{ env.REGISTRY }}
|
echo '{"github-oauth": {"github.com": "'${{ secrets._GITHUB_AUTH_TOKEN }}'"}}' > composer-auth.json
|
||||||
username: ${{ github.actor }}
|
else
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
echo '{}' > composer-auth.json
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Build and Release
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
# this will be replaced by docker buildx bake with an empty line
|
|
||||||
# to get just tags without the image name
|
|
||||||
images: |
|
|
||||||
willbereplaced
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
|
|
||||||
- name: Build and release
|
|
||||||
if: startsWith(github.ref, 'refs/tags/') && success()
|
|
||||||
env:
|
|
||||||
# get tags from the json object and pass as a string-encoded list
|
|
||||||
tags: "${{ toJSON(fromJSON(steps.meta.outputs.json).tags) }}"
|
|
||||||
uses: docker/bake-action@v2
|
uses: docker/bake-action@v2
|
||||||
with:
|
with:
|
||||||
push: true
|
|
||||||
files: |
|
files: |
|
||||||
./docker-bake.hcl
|
./docker-bake.hcl
|
||||||
${{ steps.meta.outputs.bake-file }}
|
|
||||||
|
|||||||
18
.github/workflows/cloud.yml
vendored
Normal file
18
.github/workflows/cloud.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: "Close Invalid PRs"
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- cloud
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
close_pr:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Close invalid PRs
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event.pull_request.head.ref }}" != "main" ]] && [[ "${{ github.event.pull_request.head.ref }}" != "dev-cloud" ]]; then
|
||||||
|
echo "This PR is from '${{ github.event.pull_request.head.ref }}', but only PRs from 'main' or 'dev-cloud' are allowed. Closing PR."
|
||||||
|
gh pr close ${{ github.event.pull_request.number }} --repo ${{ github.repository }}
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -12,4 +12,9 @@ api/storage/*.key
|
|||||||
api/storage/uploads
|
api/storage/uploads
|
||||||
api/storage/public
|
api/storage/public
|
||||||
api/vendor
|
api/vendor
|
||||||
act.sh
|
act.sh
|
||||||
|
composer-auth.json
|
||||||
|
packages/billing-api
|
||||||
|
packages/billing-engine
|
||||||
|
docker/database/*
|
||||||
|
docker/database/mysql/*
|
||||||
28
.gitmodules
vendored
28
.gitmodules
vendored
@@ -5,37 +5,37 @@
|
|||||||
[submodule "packages/core-api"]
|
[submodule "packages/core-api"]
|
||||||
path = packages/core-api
|
path = packages/core-api
|
||||||
url = git@github.com:fleetbase/core-api.git
|
url = git@github.com:fleetbase/core-api.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
[submodule "packages/fleetops-api"]
|
[submodule "packages/fleetops-api"]
|
||||||
path = packages/fleetops-api
|
path = packages/fleetops-api
|
||||||
url = git@github.com:fleetbase/fleetops-api.git
|
url = git@github.com:fleetbase/fleetops-api.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
[submodule "packages/ember-core"]
|
[submodule "packages/ember-core"]
|
||||||
path = packages/ember-core
|
path = packages/ember-core
|
||||||
url = git@github.com:fleetbase/ember-core.git
|
url = git@github.com:fleetbase/ember-core.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
[submodule "packages/ember-ui"]
|
[submodule "packages/ember-ui"]
|
||||||
path = packages/ember-ui
|
path = packages/ember-ui
|
||||||
url = git@github.com:fleetbase/ember-ui.git
|
url = git@github.com:fleetbase/ember-ui.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
[submodule "packages/storefront-engine"]
|
[submodule "packages/storefront-engine"]
|
||||||
path = packages/storefront-engine
|
path = packages/storefront-engine
|
||||||
url = git@github.com:fleetbase/storefront-engine.git
|
url = git@github.com:fleetbase/storefront-engine.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
[submodule "packages/iam-engine"]
|
[submodule "packages/iam-engine"]
|
||||||
path = packages/iam-engine
|
path = packages/iam-engine
|
||||||
url = git@github.com:fleetbase/iam-engine.git
|
url = git@github.com:fleetbase/iam-engine.git
|
||||||
[submodule "packages/dev-engine"]
|
[submodule "packages/dev-engine"]
|
||||||
path = packages/dev-engine
|
path = packages/dev-engine
|
||||||
url = git@github.com:fleetbase/dev-engine.git
|
url = git@github.com:fleetbase/dev-engine.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
[submodule "packages/fleetbase-extensions-indexer"]
|
[submodule "packages/fleetbase-extensions-indexer"]
|
||||||
path = packages/fleetbase-extensions-indexer
|
path = packages/fleetbase-extensions-indexer
|
||||||
url = git@github.com:fleetbase/fleetbase-extensions-indexer.git
|
url = git@github.com:fleetbase/fleetbase-extensions-indexer.git
|
||||||
[submodule "packages/fleetops-engine"]
|
[submodule "packages/fleetops-engine"]
|
||||||
path = packages/fleetops-engine
|
path = packages/fleetops-engine
|
||||||
url = git@github.com:fleetbase/fleetops-engine.git
|
url = git@github.com:fleetbase/fleetops-engine.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
[submodule "docs/guides"]
|
[submodule "docs/guides"]
|
||||||
path = docs/guides
|
path = docs/guides
|
||||||
url = git@github.com:fleetbase/guides.git
|
url = git@github.com:fleetbase/guides.git
|
||||||
@@ -45,12 +45,20 @@
|
|||||||
[submodule "packages/storefront-api"]
|
[submodule "packages/storefront-api"]
|
||||||
path = packages/storefront-api
|
path = packages/storefront-api
|
||||||
url = git@github.com:fleetbase/storefront-api.git
|
url = git@github.com:fleetbase/storefront-api.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
[submodule "packages/fleetops-data"]
|
[submodule "packages/fleetops-data"]
|
||||||
path = packages/fleetops-data
|
path = packages/fleetops-data
|
||||||
url = git@github.com:fleetbase/fleetops-data.git
|
url = git@github.com:fleetbase/fleetops-data.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
[submodule "socket"]
|
[submodule "socket"]
|
||||||
path = socket
|
path = socket
|
||||||
url = git@github.com:fleetbase/socket.git
|
url = git@github.com:fleetbase/socket.git
|
||||||
branch = dev-main
|
branch = main
|
||||||
|
[submodule "packages/pallet-api"]
|
||||||
|
path = packages/pallet-api
|
||||||
|
url = git@github.com:fleetbase/pallet-api.git
|
||||||
|
branch = main
|
||||||
|
[submodule "packages/pallet-engine"]
|
||||||
|
path = packages/pallet-engine
|
||||||
|
url = git@github.com:fleetbase/pallet-engine.git
|
||||||
|
branch = main
|
||||||
|
|||||||
13
.s3deploy.yml
Normal file
13
.s3deploy.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
routes:
|
||||||
|
- route: "^.+\\.(js|css|svg|ttf)$"
|
||||||
|
headers:
|
||||||
|
Cache-Control: "max-age=600, no-transform, public"
|
||||||
|
gzip: true
|
||||||
|
- route: "^.+\\.(png|jpg)$"
|
||||||
|
headers:
|
||||||
|
Cache-Control: "max-age=600, no-transform, public"
|
||||||
|
gzip: false
|
||||||
|
- route: "^.+\\.(html|xml|json)$"
|
||||||
|
headers:
|
||||||
|
Cache-Control: "public, max-age=0, must-revalidate"
|
||||||
|
gzip: true
|
||||||
@@ -207,7 +207,7 @@ Use Docker Compose to build and run the necessary containers. In the root direct
|
|||||||
</li>
|
</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>🛣 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>
|
||||||
<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/MJQgxHwN" target="_discord" alt="Fleetbase Discord">Discord</a>.
|
<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>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|||||||
@@ -2,20 +2,10 @@
|
|||||||
|
|
||||||
namespace App\Exceptions;
|
namespace App\Exceptions;
|
||||||
|
|
||||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
use Fleetbase\Exceptions\Handler as ExceptionHandler;
|
||||||
use Throwable;
|
|
||||||
|
|
||||||
class Handler extends ExceptionHandler
|
class Handler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* A list of the exception types that are not reported.
|
|
||||||
*
|
|
||||||
* @var array<int, class-string<Throwable>>
|
|
||||||
*/
|
|
||||||
protected $dontReport = [
|
|
||||||
//
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list of the inputs that are never flashed for validation exceptions.
|
* A list of the inputs that are never flashed for validation exceptions.
|
||||||
*
|
*
|
||||||
@@ -26,16 +16,4 @@ class Handler extends ExceptionHandler
|
|||||||
'password',
|
'password',
|
||||||
'password_confirmation',
|
'password_confirmation',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the exception handling callbacks for the application.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
$this->reportable(function (Throwable $e) {
|
|
||||||
//
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ class Authenticate extends Middleware
|
|||||||
*/
|
*/
|
||||||
protected function redirectTo($request)
|
protected function redirectTo($request)
|
||||||
{
|
{
|
||||||
if (! $request->expectsJson()) {
|
return response()->error('Unauthenticated.');
|
||||||
return route('login');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ if [ -f composer.lock ]; then
|
|||||||
rm composer.lock
|
rm composer.lock
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv composer.json composer.prod.json && mv composer.dev.json composer.json && composer install && mv composer.json composer.dev.json && mv composer.prod.json composer.json
|
mv composer.json composer.prod.json && cp composer.dev.json composer.json && composer install && mv composer.prod.json composer.json
|
||||||
@@ -6,9 +6,11 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.3|^8.0",
|
"php": "^7.3|^8.0",
|
||||||
"fleetbase/core-api": "^1.1.1-alpha",
|
"fleetbase/core-api": "^1.2.6",
|
||||||
"fleetbase/fleetops-api": "^1.0.5-alpha",
|
"fleetbase/fleetops-api": "^1.1.4",
|
||||||
"fleetbase/storefront-api": "^1.0.4-alpha",
|
"fleetbase/storefront-api": "^1.1.2",
|
||||||
|
"fleetbase/pallet-api": "^0.0.1",
|
||||||
|
"fleetbase/billing-api": "^0.0.2",
|
||||||
"fruitcake/laravel-cors": "^2.0",
|
"fruitcake/laravel-cors": "^2.0",
|
||||||
"guzzlehttp/guzzle": "^7.0.1",
|
"guzzlehttp/guzzle": "^7.0.1",
|
||||||
"laravel/framework": "^8.75",
|
"laravel/framework": "^8.75",
|
||||||
@@ -18,8 +20,7 @@
|
|||||||
"maatwebsite/excel": "^3.1",
|
"maatwebsite/excel": "^3.1",
|
||||||
"phpoffice/phpspreadsheet": "^1.28",
|
"phpoffice/phpspreadsheet": "^1.28",
|
||||||
"predis/predis": "^2.1",
|
"predis/predis": "^2.1",
|
||||||
"psr/http-factory-implementation": "*",
|
"psr/http-factory-implementation": "*"
|
||||||
"textalk/websocket": "^1.6"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"facade/ignition": "^2.5",
|
"facade/ignition": "^2.5",
|
||||||
@@ -42,6 +43,10 @@
|
|||||||
{
|
{
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"url": "../packages/storefront-api"
|
"url": "../packages/storefront-api"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "path",
|
||||||
|
"url": "../packages/pallet-api"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.3|^8.0",
|
"php": "^7.3|^8.0",
|
||||||
"fleetbase/core-api": "^1.1.3-alpha",
|
"fleetbase/core-api": "^1.2.6",
|
||||||
"fleetbase/fleetops-api": "^1.0.7-alpha",
|
"fleetbase/fleetops-api": "^1.1.4",
|
||||||
"fleetbase/storefront-api": "^1.0.6-alpha",
|
"fleetbase/storefront-api": "^1.1.2",
|
||||||
"fruitcake/laravel-cors": "^2.0",
|
"fruitcake/laravel-cors": "^2.0",
|
||||||
"guzzlehttp/guzzle": "^7.0.1",
|
"guzzlehttp/guzzle": "^7.0.1",
|
||||||
"laravel/framework": "^8.75",
|
"laravel/framework": "^8.75",
|
||||||
@@ -21,8 +21,7 @@
|
|||||||
"maatwebsite/excel": "^3.1",
|
"maatwebsite/excel": "^3.1",
|
||||||
"phpoffice/phpspreadsheet": "^1.28",
|
"phpoffice/phpspreadsheet": "^1.28",
|
||||||
"predis/predis": "^2.1",
|
"predis/predis": "^2.1",
|
||||||
"psr/http-factory-implementation": "*",
|
"psr/http-factory-implementation": "*"
|
||||||
"textalk/websocket": "^1.6"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"facade/ignition": "^2.5",
|
"facade/ignition": "^2.5",
|
||||||
|
|||||||
2066
api/composer.lock
generated
2066
api/composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -165,7 +165,7 @@ return [
|
|||||||
/*
|
/*
|
||||||
* Package Service Providers...
|
* Package Service Providers...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Application Service Providers...
|
* Application Service Providers...
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('BROADCAST_DRIVER', 'null'),
|
'default' => env('BROADCAST_DRIVER', 'socketcluster'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('CACHE_DRIVER', 'file'),
|
'default' => env('CACHE_DRIVER', 'redis'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ return [
|
|||||||
|
|
||||||
'allowed_methods' => ['*'],
|
'allowed_methods' => ['*'],
|
||||||
|
|
||||||
'allowed_origins' => ['http://localhost:4200'],
|
'allowed_origins' => ['http://localhost:4200', env('CONSOLE_HOST')],
|
||||||
|
|
||||||
'allowed_origins_patterns' => [],
|
'allowed_origins_patterns' => [],
|
||||||
|
|
||||||
|
|||||||
@@ -39,14 +39,6 @@ return [
|
|||||||
'driver' => 'local',
|
'driver' => 'local',
|
||||||
'root' => storage_path('app/public'),
|
'root' => storage_path('app/public'),
|
||||||
'url' => env('APP_URL').'/storage',
|
'url' => env('APP_URL').'/storage',
|
||||||
'visibility' => 'public',
|
|
||||||
],
|
|
||||||
|
|
||||||
'uploads' => [
|
|
||||||
'driver' => 'local',
|
|
||||||
'root' => storage_path('app/uploads'),
|
|
||||||
'url' => env('APP_URL').'/uploads',
|
|
||||||
'visibility' => 'public',
|
|
||||||
],
|
],
|
||||||
|
|
||||||
's3' => [
|
's3' => [
|
||||||
@@ -56,7 +48,6 @@ return [
|
|||||||
'region' => env('AWS_DEFAULT_REGION'),
|
'region' => env('AWS_DEFAULT_REGION'),
|
||||||
'bucket' => env('AWS_BUCKET'),
|
'bucket' => env('AWS_BUCKET'),
|
||||||
'url' => env('AWS_URL'),
|
'url' => env('AWS_URL'),
|
||||||
'endpoint' => env('AWS_ENDPOINT'),
|
|
||||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Monolog\Formatter\JsonFormatter;
|
||||||
use Monolog\Handler\NullHandler;
|
use Monolog\Handler\NullHandler;
|
||||||
use Monolog\Handler\StreamHandler;
|
use Monolog\Handler\StreamHandler;
|
||||||
use Monolog\Handler\SyslogUdpHandler;
|
use Monolog\Handler\SyslogUdpHandler;
|
||||||
@@ -89,12 +90,21 @@ return [
|
|||||||
'driver' => 'monolog',
|
'driver' => 'monolog',
|
||||||
'level' => env('LOG_LEVEL', 'debug'),
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
'handler' => StreamHandler::class,
|
'handler' => StreamHandler::class,
|
||||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
'formatter' => JsonFormatter::class,
|
||||||
'with' => [
|
'with' => [
|
||||||
'stream' => 'php://stderr',
|
'stream' => 'php://stderr',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'stdout' => [
|
||||||
|
'driver' => 'monolog',
|
||||||
|
'handler' => StreamHandler::class,
|
||||||
|
'formatter' => JsonFormatter::class,
|
||||||
|
'with' => [
|
||||||
|
'stream' => 'php://stdout',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
'syslog' => [
|
'syslog' => [
|
||||||
'driver' => 'syslog',
|
'driver' => 'syslog',
|
||||||
'level' => env('LOG_LEVEL', 'debug'),
|
'level' => env('LOG_LEVEL', 'debug'),
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ return [
|
|||||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||||
'region' => env('AWS_DEFAULT_REGION'),
|
'region' => env('AWS_DEFAULT_REGION'),
|
||||||
'version' => '2010-12-01'
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'mailgun' => [
|
'mailgun' => [
|
||||||
@@ -96,8 +95,8 @@ return [
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
'from' => [
|
'from' => [
|
||||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
'address' => env('MAIL_FROM_ADDRESS', 'hello@fleetbase.io'),
|
||||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
'name' => env('MAIL_FROM_NAME', 'Fleetbase'),
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
'default' => env('QUEUE_CONNECTION', 'redis'),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|||||||
16
api/deploy.sh
Executable file
16
api/deploy.sh
Executable file
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit the script as soon as a command fails
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Create mysql databases if none exists
|
||||||
|
php artisan mysql:createdb
|
||||||
|
|
||||||
|
# Run migrations
|
||||||
|
php artisan migrate --force
|
||||||
|
|
||||||
|
# Run migrations for sandbox too
|
||||||
|
php artisan sandbox:migrate --force
|
||||||
|
|
||||||
|
# Seed database
|
||||||
|
php artisan fleetbase:seed
|
||||||
3
cicd/README.md
Normal file
3
cicd/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
## CI/CD config files
|
||||||
|
|
||||||
|
This folder contains examples of configuration files for different CI/CD systems other than Github Actions.
|
||||||
59
cicd/gitlab-ci.yml
Normal file
59
cicd/gitlab-ci.yml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
image: docker:stable-git
|
||||||
|
variables:
|
||||||
|
# will need the following env vars set in the CI/CD settings
|
||||||
|
# PROJECT - needs to match the project name in the infrastructure
|
||||||
|
# GITHUB_AUTH_TOKEN - if you have it
|
||||||
|
# the AWS specific variables:
|
||||||
|
# AWS_REGION - the project region
|
||||||
|
# AWS_ACCESS_KEY_ID - since OIDC support in Gitlab greatly varies between versions have to revert to plain old user creds
|
||||||
|
# AWS_SECRET_ACCESS_KEY
|
||||||
|
|
||||||
|
build_image:
|
||||||
|
stage: build
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
script:
|
||||||
|
- mkdir -p /usr/local/lib/docker/cli-plugins && wget -O /usr/local/lib/docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.11.2/buildx-v0.11.2.linux-amd64 && chmod +x /usr/local/lib/docker/cli-plugins/docker-buildx
|
||||||
|
- |-
|
||||||
|
if [[ -n "${GITHUB_AUTH_TOKEN}" ]]; then
|
||||||
|
echo '{"github-oauth": {"github.com": "'${GITHUB_AUTH_TOKEN}'"}}' > composer-auth.json
|
||||||
|
else
|
||||||
|
echo '{}' > composer-auth.json
|
||||||
|
fi
|
||||||
|
- |-
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
docker buildx create --driver docker-container --driver-opt image=moby/buildkit:v0.11.5 --use
|
||||||
|
|
||||||
|
docker buildx bake -f docker-bake.hcl --print # just print for now
|
||||||
|
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
stage: deploy
|
||||||
|
only:
|
||||||
|
- /^deploy\/.*$/
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
script:
|
||||||
|
- mkdir -p /usr/local/lib/docker/cli-plugins && wget -O /usr/local/lib/docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.11.2/buildx-v0.11.2.linux-amd64 && chmod +x /usr/local/lib/docker/cli-plugins/docker-buildx
|
||||||
|
- docker buildx create --driver docker-container --driver-opt image=moby/buildkit:v0.11.5 --use
|
||||||
|
- 'export VERSION="$(git describe --always --tags)"'
|
||||||
|
- 'export STACK="$(basename $CI_COMMIT_REF_NAME)"'
|
||||||
|
- |-
|
||||||
|
if [[ -n "${GITHUB_AUTH_TOKEN}" ]]; then
|
||||||
|
echo '{"github-oauth": {"github.com": "'${GITHUB_AUTH_TOKEN}'"}}' > composer-auth.json
|
||||||
|
else
|
||||||
|
echo '{}' > composer-auth.json
|
||||||
|
fi
|
||||||
|
- |-
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
wget https://github.com/springload/ecs-tool/releases/download/1.9.6/ecs-tool_1.9.6_linux_amd64.tar.gz -O /tmp/ecs-tool.tar.gz && tar -C /usr/bin -xvf /tmp/ecs-tool.tar.gz ecs-tool
|
||||||
|
export REGISTRY=$(ecs-tool ecr-endpoint)/${PROJECT}-${STACK}
|
||||||
|
eval $(ecs-tool ecr-login)
|
||||||
|
|
||||||
|
docker buildx bake -f docker-bake.hcl --push
|
||||||
|
|
||||||
|
# run deploy.sh script before deployments
|
||||||
|
env "ECS_RUN.SERVICE=app" "ECS_RUN.LAUNCH_TYPE=FARGATE" ecs-tool run --image_tag '{container_name}-${VERSION}' --cluster ${PROJECT}-${STACK} --task_definition ${PROJECT}-${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
|
||||||
2
console
2
console
Submodule console updated: 945ea37df0...acd7753eda
13
create-erd.sh
Normal file
13
create-erd.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit the script as soon as a command fails
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Run schemacrawler
|
||||||
|
# To use schemacrawler see https://www.schemacrawler.com/downloads.html
|
||||||
|
schemacrawler.sh --server mysql --host localhost --database fleetbase --user root --info-level standard --command script --script-language python --script mermaid.py --output-file database.mmd
|
||||||
|
schemacrawler.sh --server mysql --host localhost --database fleetbase --user root --info-level standard --command=schema --grep-tables="^(?!fleetbase_sandbox\.).*" --output-format=svg --output-file=erd.svg
|
||||||
|
|
||||||
|
# Generate a SVG ERD diagram using `dark` theme
|
||||||
|
# To use mmdc see https://github.com/mermaid-js/mermaid-cli
|
||||||
|
mmdc -i database.mmd -o erd-dark.svg -t dark -b transparent --configFile="mmdc.json"
|
||||||
1676
database.mmd
Normal file
1676
database.mmd
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,23 +1,18 @@
|
|||||||
// docker-bake.hcl
|
// docker-bake.hcl
|
||||||
variable "REGISTRY" { default = "" }
|
variable "REGISTRY" { default = "" }
|
||||||
variable "tags" { default = "[]" }
|
variable "VERSION" { default = "latest" }
|
||||||
target "docker-metadata-action" {}
|
variable "CACHE" { default = "" }
|
||||||
|
|
||||||
group "default" {
|
group "default" {
|
||||||
targets = ["app"]
|
targets = ["app", "app-httpd"]
|
||||||
}
|
}
|
||||||
|
|
||||||
target "app" {
|
target "app" {
|
||||||
name = "app-${tgt}"
|
name = "app-${tgt}"
|
||||||
|
|
||||||
// here we inherit from docker-metadata-action to get
|
|
||||||
// labels for the image
|
|
||||||
// Labels are used to connect the built packages to the repository.
|
|
||||||
inherits = ["docker-metadata-action"]
|
|
||||||
|
|
||||||
// use matrix strategy to build several targets at once
|
// use matrix strategy to build several targets at once
|
||||||
matrix = {
|
matrix = {
|
||||||
tgt = ["app", "scheduler", "jobs", "events"]
|
tgt = ["app", "scheduler", "events"]
|
||||||
}
|
}
|
||||||
context = "./"
|
context = "./"
|
||||||
// set the target from matrix
|
// set the target from matrix
|
||||||
@@ -28,14 +23,27 @@ target "app" {
|
|||||||
]
|
]
|
||||||
|
|
||||||
tags = notequal("", REGISTRY) ? formatlist(
|
tags = notequal("", REGISTRY) ? formatlist(
|
||||||
"${REGISTRY}/fleetbase-${tgt}:%s",
|
"${REGISTRY}:${tgt}-%s",
|
||||||
// some magic happens here:
|
compact(["latest", VERSION])
|
||||||
// We replace "willbereplaced:" with "" to get rid of the fake image
|
) : []
|
||||||
// then we decode the json object passed as a string into a list of tags
|
|
||||||
// then we concat that with "latest"
|
secret = [
|
||||||
// So in the end we'll get something like ["latest". "1.0". "1.0.0"]
|
"type=file,id=composer_auth,src=./composer-auth.json"
|
||||||
// Then formatlist will prepend the registry and image name to each of
|
]
|
||||||
// the tags
|
|
||||||
concat(["latest"], jsondecode(replace(tags, "willbereplaced:", "")))
|
cache-from = notequal("", CACHE) ? ["${CACHE}"] : []
|
||||||
|
cache-to = notequal("", CACHE) ? ["${CACHE},mode=max,ignore-error=true"] : []
|
||||||
|
}
|
||||||
|
|
||||||
|
target "app-httpd" {
|
||||||
|
context = "./"
|
||||||
|
dockerfile = "docker/httpd/Dockerfile"
|
||||||
|
platforms = [
|
||||||
|
"linux/amd64",
|
||||||
|
]
|
||||||
|
|
||||||
|
tags = notequal("", REGISTRY) ? formatlist(
|
||||||
|
"${REGISTRY}:app-httpd-%s",
|
||||||
|
compact(["latest", VERSION])
|
||||||
) : []
|
) : []
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
version: "3.4"
|
version: "3.8"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
cache:
|
cache:
|
||||||
@@ -10,16 +10,13 @@ services:
|
|||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
volumes:
|
volumes:
|
||||||
- "./docker/database/:/docker-entrypoint-initdb.d/"
|
- "./docker/database/:/docker-entrypoint-initdb.d/"
|
||||||
|
- "./docker/database/mysql:/var/lib/mysql"
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
|
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
|
||||||
MYSQL_DATABASE: "fleetbase"
|
MYSQL_DATABASE: "fleetbase"
|
||||||
|
|
||||||
socket:
|
socket:
|
||||||
build:
|
image: socketcluster/socketcluster:v17.4.0
|
||||||
context: .
|
|
||||||
dockerfile: socket/Dockerfile
|
|
||||||
args:
|
|
||||||
ENVIRONMENT: dev
|
|
||||||
ports:
|
ports:
|
||||||
- "38000:8000"
|
- "38000:8000"
|
||||||
environment:
|
environment:
|
||||||
@@ -44,8 +41,6 @@ services:
|
|||||||
target: app-dev
|
target: app-dev
|
||||||
args:
|
args:
|
||||||
ENVIRONMENT: development
|
ENVIRONMENT: development
|
||||||
ports:
|
|
||||||
- "8000:80"
|
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: "mysql://root@database/fleetbase"
|
DATABASE_URL: "mysql://root@database/fleetbase"
|
||||||
CACHE_DRIVER: redis
|
CACHE_DRIVER: redis
|
||||||
@@ -58,4 +53,15 @@ services:
|
|||||||
LOG_CHANNEL: daily
|
LOG_CHANNEL: daily
|
||||||
depends_on:
|
depends_on:
|
||||||
- database
|
- database
|
||||||
- cache
|
- cache
|
||||||
|
|
||||||
|
httpd:
|
||||||
|
volumes:
|
||||||
|
- ./api/storage:/var/www/html/api/storage
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/httpd/Dockerfile
|
||||||
|
ports:
|
||||||
|
- "8000:80"
|
||||||
|
depends_on:
|
||||||
|
- application
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# syntax = docker/dockerfile:1.2
|
||||||
# Base stage
|
# Base stage
|
||||||
FROM php:7.4-fpm-bullseye as base
|
FROM php:7.4-fpm-bullseye as base
|
||||||
|
|
||||||
@@ -10,7 +11,7 @@ RUN mkdir -p /usr/src/php/ext \
|
|||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y nano git unzip libzip-dev libgd-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
|
&& apt-get install -y nano git unzip libzip-dev libgd-dev libfreetype6-dev libjpeg62-turbo-dev libpng-dev \
|
||||||
imagemagick libmagickwand-dev --no-install-recommends libmemcached-dev libgeos-dev libgmp-dev \
|
imagemagick libmagickwand-dev --no-install-recommends libmemcached-dev libgeos-dev libgmp-dev \
|
||||||
default-mysql-client libicu-dev tmux nginx dnsutils \
|
default-mysql-client libicu-dev tmux nginx dnsutils mycli redis-tools \
|
||||||
&& pecl install imagick \
|
&& pecl install imagick \
|
||||||
&& docker-php-ext-enable imagick \
|
&& docker-php-ext-enable imagick \
|
||||||
&& docker-php-ext-configure gd --with-external-gd \
|
&& docker-php-ext-configure gd --with-external-gd \
|
||||||
@@ -33,32 +34,43 @@ COPY --from=ghcr.io/springload/ssm-parent:1.8 /usr/bin/ssm-parent /sbin/ssm-pare
|
|||||||
# Install Composer
|
# Install Composer
|
||||||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
|
# Set some build ENV variables
|
||||||
|
ENV LOG_CHANNEL=stdout
|
||||||
|
ENV CACHE_DRIVER=null
|
||||||
|
|
||||||
# For development only
|
# For development only
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
COPY --chown=www-data:nogroup packages ./
|
COPY --chown=www-data:nogroup ./packages ./packages
|
||||||
|
|
||||||
# Setup application
|
# Setup application
|
||||||
WORKDIR /var/www/html/api
|
WORKDIR /var/www/html/api
|
||||||
COPY --chown=www-data:nogroup api ./
|
COPY --chown=www-data:nogroup ./api ./
|
||||||
RUN chown -R www-data:www-data /var/www/html/api
|
RUN chown -R www-data:www-data /var/www/html/api
|
||||||
RUN mkdir -p ./storage/logs/ && ln -sf /dev/stdout ./storage/logs/laravel-$(date +'%Y-%m-%d').log
|
|
||||||
USER www-data
|
# Setup composer root directory
|
||||||
RUN composer install
|
RUN mkdir -p /root/.composer
|
||||||
RUN composer dumpautoload
|
RUN mkdir -p /var/www/.composer && chown www-data:www-data /var/www/.composer
|
||||||
|
|
||||||
|
# Setup logging
|
||||||
|
RUN mkdir -p ./storage/logs/ && touch ./storage/logs/laravel-$(date +'%Y-%m-%d').log
|
||||||
|
RUN chown -R www-data:www-data ./storage
|
||||||
|
RUN chmod -R 755 ./storage
|
||||||
|
|
||||||
|
# Load the secret into the auth.json file if exists, and install dependencies
|
||||||
|
COPY composer-auth.jso[n] /root/.composer/auth.json
|
||||||
|
RUN --mount=type=secret,id=composer_auth,target=/root/.composer/auth.json \
|
||||||
|
if [ -f "/root/.composer/auth.json" ]; then \
|
||||||
|
mkdir -p /var/www/.composer/ && \
|
||||||
|
cp /root/.composer/auth.json /var/www/.composer/auth.json && \
|
||||||
|
chown www-data:www-data /var/www/.composer/auth.json && \
|
||||||
|
su www-data -s /bin/sh -c "composer install && composer dumpautoload"; \
|
||||||
|
fi; \
|
||||||
|
su www-data -s /bin/sh -c "composer install && composer dumpautoload"
|
||||||
|
|
||||||
# Continue
|
# Continue
|
||||||
USER root
|
USER root
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
# Copy nginx config
|
|
||||||
COPY nginx.conf /etc/nginx/sites-enabled/default
|
|
||||||
|
|
||||||
# Copy the startup script into the Docker image
|
|
||||||
COPY startup.sh /startup.sh
|
|
||||||
|
|
||||||
# Make sure the script is executable
|
|
||||||
RUN chmod +x /startup.sh
|
|
||||||
|
|
||||||
# Create unique instance ID
|
# Create unique instance ID
|
||||||
RUN echo $(cat /proc/sys/kernel/random/uuid) > /.fleetbase
|
RUN echo $(cat /proc/sys/kernel/random/uuid) > /.fleetbase
|
||||||
|
|
||||||
@@ -90,21 +102,14 @@ CMD ["go-crond", "--verbose", "--no-auto", "root:./crontab"]
|
|||||||
# Application dev stage
|
# Application dev stage
|
||||||
FROM base as app-dev
|
FROM base as app-dev
|
||||||
ENTRYPOINT ["docker-php-entrypoint"]
|
ENTRYPOINT ["docker-php-entrypoint"]
|
||||||
EXPOSE 80
|
CMD ["php-fpm"]
|
||||||
CMD ["/startup.sh"]
|
|
||||||
|
|
||||||
# Events stage
|
# Events stage
|
||||||
FROM base as events
|
FROM base as events
|
||||||
ENTRYPOINT ["/sbin/ssm-parent", "-c", ".ssm-parent.yaml", "run", "--", "docker-php-entrypoint"]
|
ENTRYPOINT ["/sbin/ssm-parent", "-c", ".ssm-parent.yaml", "run", "--", "docker-php-entrypoint"]
|
||||||
CMD ["php", "artisan", "queue:work", "events"]
|
|
||||||
|
|
||||||
# Jobs stage
|
|
||||||
FROM base as jobs
|
|
||||||
ENTRYPOINT ["/sbin/ssm-parent", "-c", ".ssm-parent.yaml", "run", "--", "docker-php-entrypoint"]
|
|
||||||
CMD ["php", "artisan", "queue:work", "sqs"]
|
CMD ["php", "artisan", "queue:work", "sqs"]
|
||||||
|
|
||||||
# Application stage
|
# Application stage
|
||||||
FROM base as app
|
FROM base as app
|
||||||
ENTRYPOINT ["/sbin/ssm-parent", "-c", ".ssm-parent.yaml", "run", "--", "docker-php-entrypoint"]
|
ENTRYPOINT ["/sbin/ssm-parent", "-c", ".ssm-parent.yaml", "run", "--", "docker-php-entrypoint"]
|
||||||
EXPOSE 80
|
CMD ["php-fpm"]
|
||||||
CMD ["/startup.sh"]
|
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
# alpine is more secure
|
# alpine is more secure
|
||||||
FROM nginx:stable-alpine
|
FROM nginx:stable-alpine
|
||||||
|
|
||||||
COPY docker/httpd/vhost.conf /etc/nginx/conf.d/default.conf
|
ENV NGINX_APPLICATION_HOSTNAME application
|
||||||
COPY api/public/ /var/www/html/api/public/
|
|
||||||
|
COPY docker/httpd/vhost.conf /etc/nginx/templates/default.conf.template
|
||||||
|
COPY api/public/ /var/www/html/api/public/
|
||||||
|
|||||||
@@ -4,7 +4,12 @@ server {
|
|||||||
root /var/www/html/api/public;
|
root /var/www/html/api/public;
|
||||||
# hide nginx version for security purposes
|
# hide nginx version for security purposes
|
||||||
server_tokens off;
|
server_tokens off;
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error_log;
|
||||||
|
proxy_connect_timeout 600;
|
||||||
|
proxy_send_timeout 600;
|
||||||
|
proxy_read_timeout 600;
|
||||||
|
send_timeout 600;
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
@@ -34,7 +39,7 @@ server {
|
|||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
||||||
|
|
||||||
fastcgi_pass application:9000;
|
fastcgi_pass ${NGINX_APPLICATION_HOSTNAME}:9000;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
erd-dark.svg
Normal file
1
erd-dark.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 1.3 MiB |
6804
erd.svg
Normal file
6804
erd.svg
Normal file
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 726 KiB |
43
mermaid.py
Normal file
43
mermaid.py
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
from __future__ import print_function
|
||||||
|
import re
|
||||||
|
|
||||||
|
def cleanname(name):
|
||||||
|
return re.sub(r'[^\d\w_]', '', name)
|
||||||
|
|
||||||
|
def format_table_name(full_name):
|
||||||
|
parts = full_name.split('.')
|
||||||
|
if len(parts) == 2 and not parts[0].endswith('_sandbox'):
|
||||||
|
return cleanname(parts[0] + '_' + parts[1])
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
print('erDiagram')
|
||||||
|
print('')
|
||||||
|
for table in catalog.tables:
|
||||||
|
formatted_name = format_table_name(table.fullName)
|
||||||
|
if formatted_name:
|
||||||
|
print(' ' + formatted_name + ' {')
|
||||||
|
for column in table.columns:
|
||||||
|
print(' ' + cleanname(column.columnDataType.name) + ' ' + cleanname(column.name),
|
||||||
|
end='')
|
||||||
|
if column.isPartOfPrimaryKey():
|
||||||
|
print(' PK', end='')
|
||||||
|
elif column.isPartOfForeignKey():
|
||||||
|
print(' FK', end='')
|
||||||
|
elif column.isPartOfUniqueIndex():
|
||||||
|
print(' UK', end='')
|
||||||
|
if column.hasRemarks():
|
||||||
|
print(' "' + ' '.join(column.remarks.splitlines()) + '"',
|
||||||
|
end='')
|
||||||
|
print()
|
||||||
|
print(' }')
|
||||||
|
print('')
|
||||||
|
|
||||||
|
for table in catalog.tables:
|
||||||
|
formatted_name = format_table_name(table.fullName)
|
||||||
|
if formatted_name:
|
||||||
|
for childTable in table.referencingTables:
|
||||||
|
child_formatted_name = format_table_name(childTable.fullName)
|
||||||
|
if child_formatted_name:
|
||||||
|
print(' ' + formatted_name + ' ||--o{ ' +
|
||||||
|
child_formatted_name + ' : "foreign key"')
|
||||||
46
nginx.conf
46
nginx.conf
@@ -1,46 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name localhost;
|
|
||||||
root /var/www/html/api/public;
|
|
||||||
# hide nginx version for security purposes
|
|
||||||
server_tokens off;
|
|
||||||
access_log /var/log/nginx/access.log;
|
|
||||||
error_log /var/log/nginx/error_log;
|
|
||||||
proxy_connect_timeout 600;
|
|
||||||
proxy_send_timeout 600;
|
|
||||||
proxy_read_timeout 600;
|
|
||||||
send_timeout 600;
|
|
||||||
|
|
||||||
index index.php;
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.php?$args;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /uploads {
|
|
||||||
alias /var/www/html/api/storage/app/uploads;
|
|
||||||
autoindex on;
|
|
||||||
try_files $uri $uri/ /index.php?$query_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
location /storage {
|
|
||||||
alias /var/www/html/api/storage/app/public;
|
|
||||||
autoindex on;
|
|
||||||
try_files $uri $uri/ /index.php?$query_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
location ~ [^/]\.php(/|$) {
|
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
|
||||||
if (!-f $document_root$fastcgi_script_name) {
|
|
||||||
return 404;
|
|
||||||
}
|
|
||||||
|
|
||||||
include fastcgi_params;
|
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
||||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
||||||
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
|
|
||||||
|
|
||||||
fastcgi_pass application:9000;
|
|
||||||
fastcgi_index index.php;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Submodule packages/core-api updated: 6551b4aa68...46aad9f1ab
Submodule packages/dev-engine updated: 9984299722...d35999c4e6
Submodule packages/ember-core updated: 143a50f88e...eb865b321c
Submodule packages/ember-ui updated: 721e4c3d44...d162e7dc38
Submodule packages/fleetbase-extensions-indexer updated: c534b5a60f...a6f2b4cde9
Submodule packages/fleetops-api updated: 0b5142bf9f...abfd4682c5
Submodule packages/fleetops-data updated: eba1a93cb5...697649dd86
Submodule packages/fleetops-engine updated: 7f3dda3f5f...fba7d9472c
Submodule packages/iam-engine updated: 60ca06c011...68204f8e57
1
packages/pallet-api
Submodule
1
packages/pallet-api
Submodule
Submodule packages/pallet-api added at b65efe23bf
1
packages/pallet-engine
Submodule
1
packages/pallet-engine
Submodule
Submodule packages/pallet-engine added at 6d915afc98
Submodule packages/storefront-api updated: fd95411375...0ad8808a89
Submodule packages/storefront-engine updated: a03df79526...fec9b9de12
35
startup.sh
35
startup.sh
@@ -1,35 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Start PHP-FPM in the background
|
|
||||||
php-fpm -D
|
|
||||||
status=$?
|
|
||||||
if [ $status -ne 0 ]; then
|
|
||||||
echo "Failed to start php-fpm: $status"
|
|
||||||
exit $status
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start Nginx in the foreground
|
|
||||||
nginx -g "daemon off;"
|
|
||||||
status=$?
|
|
||||||
if [ $status -ne 0 ]; then
|
|
||||||
echo "Failed to start nginx: $status"
|
|
||||||
exit $status
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Naive check runs checks once a minute to see if either of the processes exited.
|
|
||||||
while sleep 60; do
|
|
||||||
ps aux | grep php-fpm | grep -q -v grep
|
|
||||||
PROCESS_1_STATUS=$?
|
|
||||||
ps aux |grep nginx |grep -q -v grep
|
|
||||||
PROCESS_2_STATUS=$?
|
|
||||||
|
|
||||||
if [ $PROCESS_1_STATUS -ne 0 ]; then
|
|
||||||
echo "PHP-FPM process has already exited."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $PROCESS_2_STATUS -ne 0 ]; then
|
|
||||||
echo "Nginx process has already exited."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
22
update.sh
Normal file
22
update.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit the script as soon as a command fails
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Switching to the main branch..."
|
||||||
|
git checkout main
|
||||||
|
|
||||||
|
echo "Updating submodules..."
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
|
echo "Updating console..."
|
||||||
|
cd console
|
||||||
|
git checkout main
|
||||||
|
git pull
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo "Building Docker images..."
|
||||||
|
docker-compose build console
|
||||||
|
docker-compose build application
|
||||||
|
|
||||||
|
echo "Update completed. Run \`docker-compose up -d\` to launch!"
|
||||||
Reference in New Issue
Block a user