-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
14,139 additions
and
74 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,18 @@ | ||
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ | ||
|
||
name: Fly Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
deploy: | ||
name: Deploy app | ||
runs-on: ubuntu-latest | ||
concurrency: deploy-group # optional: ensure only one action runs at a time | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
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,42 @@ | ||
# Use a single base image with Python 3.11 | ||
FROM python:3.11-slim | ||
|
||
# Install required packages | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
curl \ | ||
ca-certificates \ | ||
unzip && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install Deno | ||
RUN curl -fsSL https://deno.land/install.sh | DENO_INSTALL=/usr/local sh | ||
|
||
# Install Poetry | ||
RUN curl -sSL https://install.python-poetry.org | python3 - && \ | ||
ln -s /root/.local/bin/poetry /usr/local/bin/poetry | ||
|
||
# Set environment variables | ||
ENV POETRY_VERSION=1.4.0 | ||
ENV POETRY_VIRTUALENVS_CREATE=false | ||
ENV PYTHONUNBUFFERED=1 | ||
ENV DENO_INSTALL="/usr/local" | ||
ENV PATH="${DENO_INSTALL}/bin:${PATH}" | ||
|
||
# Copy placer-service code and install dependencies | ||
WORKDIR /app/placer-service | ||
COPY placer-service/ ./ | ||
RUN poetry install --no-dev --no-interaction --no-ansi | ||
|
||
# Copy placer-dashboard code | ||
WORKDIR /app/placer-dashboard | ||
COPY placer-dashboard/ ./ | ||
RUN deno install --allow-scripts | ||
RUN deno task build | ||
|
||
# Copy the entrypoint script and make it executable | ||
COPY entrypoint.fly.sh /entrypoint.fly.sh | ||
RUN chmod +x /entrypoint.fly.sh | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["/bin/sh", "/entrypoint.fly.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
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,5 +1,5 @@ | ||
{ | ||
"linter": { | ||
"ignore": ["dashboard/**"] | ||
"ignore": ["placer-dashboard/**"] | ||
} | ||
} |
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,27 @@ | ||
services: | ||
dashboard: | ||
build: | ||
context: ./placer-dashboard | ||
dockerfile: Dockerfile | ||
ports: | ||
- "8080:8080" | ||
env_file: | ||
- ./placer-dashboard/.env | ||
depends_on: | ||
- placer-service | ||
|
||
placer-service: | ||
build: | ||
context: ./placer-service | ||
dockerfile: Dockerfile | ||
ports: | ||
- "8000:8000" | ||
env_file: | ||
- ./placer-service/.env | ||
volumes: | ||
- ./placer-service/data:/app/data | ||
|
||
volumes: | ||
placer-service-data: | ||
placer-service-logs: | ||
|
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,20 @@ | ||
|
||
#!/bin/bash | ||
|
||
if [ "$1" = "dashboard" ]; then | ||
echo "Starting Dashboard..." | ||
cd /app/placer-dashboard | ||
deno task start | ||
|
||
elif [ "$1" = "placer" ]; then | ||
echo "Starting Placer Service..." | ||
# Create logs directory if it doesn't exist | ||
mkdir -p /app/placer-service/data/logs | ||
|
||
cd /app/placer-service | ||
poetry run python3 main.py | ||
|
||
else | ||
echo "Unknown process group: $1" | ||
exit 1 | ||
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,38 @@ | ||
app = "fly-auto-placer" | ||
primary_region = "sea" | ||
|
||
[build] | ||
dockerfile = "Dockerfile.fly" | ||
|
||
[env] | ||
PLACER_SERVICE_URL = "http://placer.internal:8080" | ||
|
||
[processes] | ||
dashboard = "dashboard" | ||
placer = "placer" | ||
|
||
[http_service] | ||
processes = ["dashboard"] | ||
internal_port = 8080 | ||
force_https = true | ||
auto_stop_machines = "stop" | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
[http_service.concurrency] | ||
type = "requests" | ||
soft_limit = 200 | ||
hard_limit = 250 | ||
|
||
# VM configurations for each process | ||
[process_groups.dashboard] | ||
cpu_kind = "shared" | ||
cpus = 1 | ||
|
||
[process_groups.placer] | ||
cpu_kind = "shared" | ||
cpus = 1 | ||
|
||
[[mounts]] | ||
source = "placer_service_data" | ||
destination = "/app/placer-service/data" | ||
processes = ["placer"] |
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 @@ | ||
fly.toml |
File renamed without changes.
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,15 @@ | ||
FROM denoland/deno:2.0.0 | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN deno install --allow-scripts | ||
RUN deno task build | ||
|
||
EXPOSE 8080 | ||
|
||
USER deno | ||
CMD ["deno", "task", "start"] | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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,19 @@ | ||
# fly.toml app configuration file generated for placer-dashboard on 2024-10-14T11:42:37-07:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
app = 'placer-dashboard' | ||
primary_region = 'sea' | ||
|
||
[http_service] | ||
internal_port = 8080 | ||
force_https = true | ||
auto_stop_machines = 'stop' | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ['app'] | ||
|
||
[[vm]] | ||
memory = '1gb' | ||
cpu_kind = 'shared' | ||
cpus = 1 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
Oops, something went wrong.