Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
Signed-off-by: Eden Reich <[email protected]>
  • Loading branch information
edenreich committed Feb 13, 2025
0 parents commit fab5a2a
Show file tree
Hide file tree
Showing 27 changed files with 5,462 additions and 0 deletions.
126 changes: 126 additions & 0 deletions .devcontainer/.zshrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH

# Path to your Oh My Zsh installation.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time Oh My Zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME="powerlevel10k/powerlevel10k"
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time

# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13

# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch $(uname -m)"

# Set personal aliases, overriding those provided by Oh My Zsh libs,
# plugins, and themes. Aliases can be placed here, though Oh My Zsh
# users are encouraged to define aliases within a top-level file in
# the $ZSH_CUSTOM folder, with .zsh extension. Examples:
# - $ZSH_CUSTOM/aliases.zsh
# - $ZSH_CUSTOM/macos.zsh
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
DISABLE_AUTO_UPDATE=true
DISABLE_UPDATE_PROMPT=true
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD=true

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"

# For cross-compiling and statically linking Rust binaries on linux
export OPENSSL_DIR=/usr
export OPENSSL_LIB_DIR=/usr/lib
export OPENSSL_INCLUDE_DIR=/usr/include
export CC_aarch64_unknown_linux_musl=/opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc
export CXX_aarch64_unknown_linux_musl=/opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++
export CC_x86_64_unknown_linux_musl=/opt/x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc
export CXX_x86_64_unknown_linux_musl=/opt/x86_64-linux-musl-cross/bin/x86_64-linux-musl-g++
export PKG_CONFIG_ALLOW_CROSS=1

# For task auto-completion
eval "$(task --completion zsh)"
37 changes: 37 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM mcr.microsoft.com/devcontainers/rust:1.0.20-bookworm

ENV ZSH_CUSTOM=/home/vscode/.oh-my-zsh/custom \
TASK_VERSION=v3.41.0

RUN apt-get update && \
# Install nodejs and npm
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
# Install Task
curl -s https://taskfile.dev/install.sh | sh -s -- -b /usr/local/bin ${TASK_VERSION} && \
apt-get install -y nodejs && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN npm install -g semantic-release @semantic-release/changelog @semantic-release/exec @semantic-release/git @semantic-release/github conventional-changelog-conventionalcommits

RUN git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM}/themes/powerlevel10k

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libssl-dev \
pkg-config \
musl-tools && \
rustup target add \
aarch64-unknown-linux-musl \
x86_64-unknown-linux-musl && \
cd /tmp && \
wget https://musl.cc/aarch64-linux-musl-cross.tgz && \
tar -xzf aarch64-linux-musl-cross.tgz && \
mv aarch64-linux-musl-cross /opt/ && \
rm -rf aarch64-linux-musl-cross.tgz && \
wget https://musl.cc/x86_64-linux-musl-cross.tgz && \
tar -xzf x86_64-linux-musl-cross.tgz && \
mv x86_64-linux-musl-cross /opt/ && \
rm -rf x86_64-linux-musl-cross.tgz

USER vscode
44 changes: 44 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "Debian with Rust",
"dockerFile": "Dockerfile",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:latest": {}
},
"runArgs": ["--add-host=host.docker.internal:host-gateway"],
"customizations": {
"vscode": {
"extensions": [
"task.vscode-task",
"rust-lang.rust-analyzer",
"fill-labs.dependi",
"vadimcn.vscode-lldb",
"tamasfe.even-better-toml",
"streetsidesoftware.code-spell-checker",
"esbenp.prettier-vscode"
],
"settings": {
"terminal.integrated.defaultProfile.linux": "zsh",
"editor.renderWhitespace": "all",
"cSpell.enabled": true,
"cSpell.files": ["**/*.md"],
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"git.enableCommitSigning": true,
"dev.containers.copyGitConfig": true,
"githubPullRequests.experimental.chat": true,
"githubPullRequests.experimental.notificationsView": true,
"[rust]": {
"editor.defaultFormatter": "rust-lang.rust-analyzer",
"editor.formatOnSave": true
}
}
}
},
"mounts": [
"source=${localWorkspaceFolder}/.devcontainer/.zshrc,target=/home/vscode/.zshrc,type=bind,consistency=cached",
"source=${localWorkspaceFolder}/.devcontainer/launch.json,target=/workspaces/coder/.vscode/launch.json,type=bind,consistency=cached"
],
"remoteEnv": {
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}"
}
}
19 changes: 19 additions & 0 deletions .devcontainer/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"env": {
"RUST_BACKTRACE": "1",
"RUST_LOG": "debug"
},
"cargo": {
"args": ["build"]
},
"args": ["start"],
"cwd": "${workspaceFolder}"
}
]
}
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/playground
.env.example
.releaserc.yaml
Taskfile.yaml
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.rs]
indent_style = space
indent_size = 4

[*.yml]
[*.yaml]
[*.toml]
[*.json]
indent_style = space
indent_size = 2
quote_type = single
39 changes: 39 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# General settings
APPLICATION_NAME=inference-gateway
ENVIRONMENT=production
ENABLE_TELEMETRY=false
ENABLE_AUTH=false
# OpenID Connect
OIDC_ISSUER_URL=http://keycloak:8080/realms/inference-gateway-realm
OIDC_CLIENT_ID=inference-gateway-client
OIDC_CLIENT_SECRET=
# Server settings
SERVER_HOST=0.0.0.0
SERVER_PORT=8080
SERVER_READ_TIMEOUT=30s
SERVER_WRITE_TIMEOUT=30s
SERVER_IDLE_TIMEOUT=120s
SERVER_TLS_CERT_PATH=
SERVER_TLS_KEY_PATH=
# Providers
ANTHROPIC_API_URL=https://api.anthropic.com
ANTHROPIC_API_KEY=
CLOUDFLARE_API_URL=https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}
CLOUDFLARE_API_KEY=
COHERE_API_URL=https://api.cohere.com
COHERE_API_KEY=
GOOGLE_API_URL=https://generativelanguage.googleapis.com
GOOGLE_API_KEY=
GROQ_API_URL=https://api.groq.com
GROQ_API_KEY=
OLLAMA_API_URL=http://ollama:8080
OLLAMA_API_KEY=
OPENAI_API_URL=https://api.openai.com
OPENAI_API_KEY=

# Coder settings
CODER_INFERENCE_GATEWAY_URL=http://inference-gateway:8080
CODER_GITHUB_TOKEN=
CODER_GITHUB_USERNAME=
CODER_GITHUB_REPOSITORY=
CODER_GITHUB_READ_ONLY=true
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.devcontainer/** linguist-vendored=true
install.sh linguist-vendored=true

45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-24.04
name: Build
steps:
- uses: actions/checkout@v4

- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Lint
run: cargo fmt --all -- --check

- name: Static Analysis
run: cargo clippy -- -D warnings

- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose
Loading

0 comments on commit fab5a2a

Please sign in to comment.