-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into default_miro
- Loading branch information
Showing
197 changed files
with
4,141 additions
and
1,275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
cd /workspace | ||
|
||
# Get the files into the volume without a bind mount | ||
if [ ! -d ".git" ]; then | ||
git clone https://github.com/mudler/LocalAI.git . | ||
else | ||
git fetch | ||
fi | ||
|
||
echo "Standard Post-Create script completed." | ||
|
||
if [ -f "/devcontainer-customization/postcreate.sh" ]; then | ||
echo "Launching customization postcreate.sh" | ||
bash "/devcontainer-customization/postcreate.sh" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
cd /workspace | ||
|
||
# Grab the pre-stashed backend assets to avoid build issues | ||
cp -r /build/backend-assets /workspace/backend-assets | ||
|
||
# Ensures generated source files are present upon load | ||
make prepare | ||
|
||
echo "Standard Post-Start script completed." | ||
|
||
if [ -f "/devcontainer-customization/poststart.sh" ]; then | ||
echo "Launching customization poststart.sh" | ||
bash "/devcontainer-customization/poststart.sh" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
|
||
# This file contains some really simple functions that are useful when building up customization scripts. | ||
|
||
|
||
# Checks if the git config has a user registered - and sets it up if not. | ||
# | ||
# Param 1: name | ||
# Param 2: email | ||
# | ||
config_user() { | ||
local gcn=$(git config --global user.name) | ||
if [ -z "${gcn}" ]; then | ||
echo "Setting up git user / remote" | ||
git config --global user.name "$1" | ||
git config --global user.email "$2" | ||
|
||
fi | ||
} | ||
|
||
# Checks if the git remote is configured - and sets it up if not. Fetches either way. | ||
# | ||
# Param 1: remote name | ||
# Param 2: remote url | ||
# | ||
config_remote() { | ||
local gr=$(git remote -v | grep $1) | ||
if [ -z "${gr}" ]; then | ||
git remote add $1 $2 | ||
fi | ||
git fetch $1 | ||
} | ||
|
||
# Setup special .ssh files | ||
# | ||
# Param 1: bash array, filenames relative to the customization directory that should be copied to ~/.ssh | ||
setup_ssh() { | ||
local files=("$@") | ||
for file in "${files[@]}"; then | ||
local cfile="/devcontainer-customization/${file}" | ||
local hfile="~/.ssh/${file}" | ||
if [ ! -f "${hfile}" ]; then | ||
echo "copying ${file}" | ||
cp "${cfile}" "${hfile}" | ||
chmod 600 "${hfile}" | ||
fi | ||
done | ||
ls ~/.ssh | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Place any additional resources your environment requires in this directory | ||
|
||
Script hooks are currently called for: | ||
`postcreate.sh` and `poststart.sh` | ||
|
||
If files with those names exist here, they will be called at the end of the normal script. | ||
|
||
This is a good place to set things like `git config --global user.name` are set - and to handle any other files that are mounted via this directory. | ||
|
||
To assist in doing so, `source /.devcontainer-scripts/utils.sh` will provide utility functions that may be useful - for example: | ||
|
||
``` | ||
#!/bin/bash | ||
source "/.devcontainer-scripts/utils.sh" | ||
sshfiles=("config", "key.pub") | ||
setup_ssh "${sshfiles[@]}" | ||
config_user "YOUR NAME" "YOUR EMAIL" | ||
config_remote "REMOTE NAME" "REMOTE URL" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.schema.json", | ||
"name": "LocalAI", | ||
"workspaceFolder": "/workspace", | ||
"dockerComposeFile": [ "./docker-compose-devcontainer.yml" ], | ||
"service": "api", | ||
"shutdownAction": "stopCompose", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"golang.go", | ||
"ms-vscode.makefile-tools", | ||
"ms-azuretools.vscode-docker", | ||
"ms-python.python", | ||
"ms-python.debugpy", | ||
"wayou.vscode-todo-highlight", | ||
"waderyan.gitblame" | ||
] | ||
} | ||
}, | ||
"forwardPorts": [8080, 3000], | ||
"postCreateCommand": "bash /.devcontainer-scripts/postcreate.sh", | ||
"postStartCommand": "bash /.devcontainer-scripts/poststart.sh" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
services: | ||
api: | ||
build: | ||
context: .. | ||
dockerfile: Dockerfile | ||
target: devcontainer | ||
args: | ||
- FFMPEG=true | ||
- IMAGE_TYPE=extras | ||
- GO_TAGS=stablediffusion p2p tts | ||
env_file: | ||
- ../.env | ||
ports: | ||
- 8080:8080 | ||
volumes: | ||
- localai_workspace:/workspace | ||
- ../models:/host-models | ||
- ./customization:/devcontainer-customization | ||
command: /bin/sh -c "while sleep 1000; do :; done" | ||
cap_add: | ||
- SYS_PTRACE | ||
security_opt: | ||
- seccomp:unconfined | ||
prometheus: | ||
image: prom/prometheus | ||
container_name: prometheus | ||
command: | ||
- '--config.file=/etc/prometheus/prometheus.yml' | ||
ports: | ||
- 9090:9090 | ||
restart: unless-stopped | ||
volumes: | ||
- ./prometheus:/etc/prometheus | ||
- prom_data:/prometheus | ||
grafana: | ||
image: grafana/grafana | ||
container_name: grafana | ||
ports: | ||
- 3000:3000 | ||
restart: unless-stopped | ||
environment: | ||
- GF_SECURITY_ADMIN_USER=admin | ||
- GF_SECURITY_ADMIN_PASSWORD=grafana | ||
volumes: | ||
- ./grafana:/etc/grafana/provisioning/datasources | ||
volumes: | ||
prom_data: | ||
localai_workspace: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
apiVersion: 1 | ||
|
||
datasources: | ||
- name: Prometheus | ||
type: prometheus | ||
url: http://prometheus:9090 | ||
isDefault: true | ||
access: proxy | ||
editable: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
global: | ||
scrape_interval: 15s | ||
scrape_timeout: 10s | ||
evaluation_interval: 15s | ||
alerting: | ||
alertmanagers: | ||
- static_configs: | ||
- targets: [] | ||
scheme: http | ||
timeout: 10s | ||
api_version: v1 | ||
scrape_configs: | ||
- job_name: prometheus | ||
honor_timestamps: true | ||
scrape_interval: 15s | ||
scrape_timeout: 10s | ||
metrics_path: /metrics | ||
scheme: http | ||
static_configs: | ||
- targets: | ||
- localhost:9090 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.idea | ||
.github | ||
.vscode | ||
.devcontainer | ||
models | ||
examples/chatbot-ui/models | ||
examples/rwkv/models | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Explorer deployment | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- 'v*' | ||
|
||
concurrency: | ||
group: ci-deploy-${{ github.head_ref || github.ref }}-${{ github.repository }} | ||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.21.x' | ||
cache: false | ||
- name: Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y wget curl build-essential ffmpeg protobuf-compiler ccache upx-ucl gawk cmake libgmock-dev | ||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@1958fcbe2ca8bd93af633f11e97d44e567e945af | ||
go install google.golang.org/protobuf/cmd/[email protected] | ||
make protogen-go | ||
- name: Build api | ||
run: | | ||
CGO_ENABLED=0 make build-api | ||
- name: rm | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EXPLORER_SSH_HOST }} | ||
username: ${{ secrets.EXPLORER_SSH_USERNAME }} | ||
key: ${{ secrets.EXPLORER_SSH_KEY }} | ||
port: ${{ secrets.EXPLORER_SSH_PORT }} | ||
script: | | ||
sudo rm -rf local-ai/ || true | ||
- name: copy file via ssh | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EXPLORER_SSH_HOST }} | ||
username: ${{ secrets.EXPLORER_SSH_USERNAME }} | ||
key: ${{ secrets.EXPLORER_SSH_KEY }} | ||
port: ${{ secrets.EXPLORER_SSH_PORT }} | ||
source: "local-ai" | ||
overwrite: true | ||
rm: true | ||
target: ./local-ai | ||
- name: restarting | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EXPLORER_SSH_HOST }} | ||
username: ${{ secrets.EXPLORER_SSH_USERNAME }} | ||
key: ${{ secrets.EXPLORER_SSH_KEY }} | ||
port: ${{ secrets.EXPLORER_SSH_PORT }} | ||
script: | | ||
sudo cp -rfv local-ai/local-ai /usr/bin/local-ai | ||
sudo systemctl restart local-ai |
Oops, something went wrong.