Skip to content

Commit

Permalink
Rename ark_nova_stats -> skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
shaldengeki committed Jul 16, 2024
1 parent 9968395 commit 23ad4b0
Show file tree
Hide file tree
Showing 20 changed files with 55 additions and 55 deletions.
4 changes: 2 additions & 2 deletions skeleton/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("@rules_python//python:defs.bzl", "py_library", "py_test")
py_library(
name = "models_py",
srcs = ["models.py"],
visibility = ["//ark_nova_stats:__subpackages__"],
visibility = ["//skeleton:__subpackages__"],
deps = [
":config_py",
"@py_deps//requests",
Expand All @@ -14,7 +14,7 @@ py_library(
py_library(
name = "config_py",
srcs = ["config.py"],
visibility = ["//ark_nova_stats:__subpackages__"],
visibility = ["//skeleton:__subpackages__"],
deps = [
"//base:flask_app_py",
],
Expand Down
12 changes: 6 additions & 6 deletions skeleton/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ py_library(
srcs = ["app.py"],
visibility = ["//:__subpackages__"],
deps = [
"//ark_nova_stats:config_py",
"//ark_nova_stats:models_py",
"//ark_nova_stats/api/gql:schema",
"//skeleton:config_py",
"//skeleton:models_py",
"//skeleton/api/gql:schema",
"@py_deps//flask",
"@py_deps//graphql_server",
],
)

api_image(
name = "api_image",
app_package = "ark_nova_stats.api.app",
docker_hub_repository = "docker.io/shaldengeki/ark-nova-stats-api",
repo_tags = ["shaldengeki/ark-nova-stats-api:latest"],
app_package = "skeleton.api.app",
docker_hub_repository = "docker.io/shaldengeki/skeleton-api",
repo_tags = ["shaldengeki/skeleton-api:latest"],
deps = [":app"],
)
6 changes: 3 additions & 3 deletions skeleton/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from flask import abort, redirect, request, session
from graphql_server.flask import GraphQLView # type: ignore

from ark_nova_stats import models
from ark_nova_stats.api.gql import schema
from ark_nova_stats.config import app, db
from skeleton import models
from skeleton.api.gql import schema
from skeleton.config import app, db

app.add_url_rule(
"/graphql",
Expand Down
6 changes: 3 additions & 3 deletions skeleton/api/gql/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ load("@rules_python//python:defs.bzl", "py_library")
py_library(
name = "schema",
srcs = ["schema.py"],
visibility = ["//ark_nova_stats/api:__subpackages__"],
visibility = ["//skeleton/api:__subpackages__"],
deps = [
"//ark_nova_stats:models_py",
"//ark_nova_stats/api/gql/types:example_model",
"//skeleton:models_py",
"//skeleton/api/gql/types:example_model",
"@py_deps//graphql_core",
],
)
4 changes: 2 additions & 2 deletions skeleton/api/gql/schema.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from graphql import GraphQLObjectType, GraphQLSchema

from ark_nova_stats.api.gql.types.example_model import example_model_field
from ark_nova_stats.models import ExampleModel
from skeleton.api.gql.types.example_model import example_model_field
from skeleton.models import ExampleModel


def Schema(app):
Expand Down
4 changes: 2 additions & 2 deletions skeleton/api/gql/types/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ py_library(
srcs = ["example_model.py"],
visibility = ["//:__subpackages__"],
deps = [
"//ark_nova_stats:config_py",
"//ark_nova_stats:models_py",
"//skeleton:config_py",
"//skeleton:models_py",
"@py_deps//flask",
"@py_deps//graphql_core",
],
Expand Down
4 changes: 2 additions & 2 deletions skeleton/api/gql/types/example_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
GraphQLObjectType,
)

from ark_nova_stats.config import app, db
from ark_nova_stats.models import ExampleModel
from skeleton.config import app, db
from skeleton.models import ExampleModel


def example_model_fields() -> dict[str, GraphQLField]:
Expand Down
16 changes: 8 additions & 8 deletions skeleton/api/migrations/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ py_binary(
main = "__main__.py",
visibility = ["//:__subpackages__"],
deps = [
"//ark_nova_stats:config_py",
"//skeleton:config_py",
"//scripts:wait_for_postgres", # keep
"@py_deps//flask_migrate",
"@rules_python//python/runfiles",
Expand All @@ -34,8 +34,8 @@ py_oci_image(
base = "@python3_image",
binary = ":binary",
cmd = [
"/ark_nova_stats/api/migrations/binary.runfiles/_main/scripts/wait_for_postgres",
"/ark_nova_stats/api/migrations/binary",
"/skeleton/api/migrations/binary.runfiles/_main/scripts/wait_for_postgres",
"/skeleton/api/migrations/binary",
],
env = {
"FLASK_APP": "app.py",
Expand All @@ -56,14 +56,14 @@ py_oci_image(
tags = ["manual"],
)

# $ bazel run //ark_nova_stats/api/migrations:image_tarball
# $ docker run --rm shaldengeki/ark-nova-stats-api-migrations:latest
# $ bazel run //skeleton/api/migrations:image_tarball
# $ docker run --rm shaldengeki/skeleton-api-migrations:latest
cross_platform_image(
name = "image",
image = ":base_image",
repo_tags = ["shaldengeki/ark-nova-stats-api-migrations:latest"],
repository = "docker.io/shaldengeki/ark-nova-stats-api-migrations",
visibility = ["//ark_nova_stats/api/migrations:__subpackages__"],
repo_tags = ["shaldengeki/skeleton-api-migrations:latest"],
repository = "docker.io/shaldengeki/skeleton-api-migrations",
visibility = ["//skeleton/api/migrations:__subpackages__"],
)

py_library(
Expand Down
8 changes: 4 additions & 4 deletions skeleton/api/migrations/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
from flask_migrate import upgrade
from python.runfiles import Runfiles

from ark_nova_stats.config import app
from skeleton.config import app

if __name__ == "__main__":
# Copy the alembic.ini.
r = Runfiles.Create()
alembic_ini_src = r.Rlocation("_main/ark_nova_stats/api/migrations/alembic.ini")
shutil.copyfile(alembic_ini_src, "/ark_nova_stats/api/migrations/alembic.ini")
alembic_ini_src = r.Rlocation("_main/skeleton/api/migrations/alembic.ini")
shutil.copyfile(alembic_ini_src, "/skeleton/api/migrations/alembic.ini")

with app.app_context():
upgrade(directory="/ark_nova_stats/api/migrations")
upgrade(directory="/skeleton/api/migrations")
2 changes: 1 addition & 1 deletion skeleton/api/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ py_library(
srcs = ["fixtures.py"],
visibility = ["//:__subpackages__"],
deps = [
"//ark_nova_stats/api:app",
"//skeleton/api:app",
"@py_deps//flask",
"@py_deps//pytest",
],
Expand Down
2 changes: 1 addition & 1 deletion skeleton/api/tests/example_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask.testing import FlaskClient

from ark_nova_stats.api.tests.fixtures import app, client # noqa
from skeleton.api.tests.fixtures import app, client # noqa


def test_example_request(client: FlaskClient) -> None:
Expand Down
2 changes: 1 addition & 1 deletion skeleton/api/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest
from flask.testing import FlaskClient, FlaskCliRunner

from ark_nova_stats.api.app import app as base_app
from skeleton.api.app import app as base_app


@pytest.fixture
Expand Down
4 changes: 2 additions & 2 deletions skeleton/bin/rebuild-and-run
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -euxo pipefail

bazel run //ark_nova_stats/api:api_image_image_tarball
bazel run //ark_nova_stats/api/migrations:image_tarball
bazel run //skeleton/api:api_image_image_tarball
bazel run //skeleton/api/migrations:image_tarball

docker compose -f docker-compose.yaml -f docker-compose.override.yaml up --no-deps -d api migration pg
4 changes: 2 additions & 2 deletions skeleton/bin/snapshot-prod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ssh $PROD_HOST "
docker exec \
-t \
--env PGPASSFILE=/tmp/.pgpass \
ark-nova-stats-api-1 \
skeleton-api-1 \
/bin/sh -c \"
echo \\\"*:*:*:$PROD_DB_USERNAME:$PROD_DB_PASSWORD\\\" > /tmp/.pgpass ;
chmod 0600 /tmp/.pgpass ;
Expand All @@ -48,7 +48,7 @@ docker compose up -d pg
sleep 5
cat pg_dump.sql | docker exec \
-i \
ark-nova-stats-pg-1 \
skeleton-pg-1 \
psql \
--username $LOCAL_DB_USERNAME \
--dbname $LOCAL_DATABASE_NAME
Expand Down
2 changes: 1 addition & 1 deletion skeleton/bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

set -ex

bazel test //ark_nova_stats/...
bazel test //skeleton/...
6 changes: 3 additions & 3 deletions skeleton/docker-compose.override.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ services:
- "5000:5000"
migration:
<<: *api
image: shaldengeki/ark-nova-stats-api-migrations
image: shaldengeki/skeleton-api-migrations
ports: []
worker:
<<: *api
image: shaldengeki/ark-nova-stats-worker:latest
image: shaldengeki/skeleton-worker:latest
ports: []
deploy:
replicas: 0
pg:
env_file:
- env/.postgres.env
frontend:
image: shaldengeki/ark-nova-stats-frontend:latest
image: shaldengeki/skeleton-frontend:latest
env_file:
- env/.frontend.env
ports:
Expand Down
6 changes: 3 additions & 3 deletions skeleton/docker-compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ services:
- env/.api.prod.env
migration:
<<: *api
image: shaldengeki/ark-nova-stats-api-migrations:latest
image: shaldengeki/skeleton-api-migrations:latest
ports: []
worker:
<<: *api
image: shaldengeki/ark-nova-stats-worker:latest
image: shaldengeki/skeleton-worker:latest
ports: []
pg:
restart: always
env_file:
- env/.postgres.prod.env
frontend:
image: shaldengeki/ark-nova-stats-frontend:latest
image: shaldengeki/skeleton-frontend:latest
ports:
- "5001:80"
env_file:
Expand Down
14 changes: 7 additions & 7 deletions skeleton/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
version: '3'
services:
api: &api
image: shaldengeki/ark-nova-stats-api:latest
image: shaldengeki/skeleton-api:latest
env_file:
- env/.api.env
restart: always
depends_on:
- pg
migration:
<<: *api
image: shaldengeki/ark-nova-stats-api-migrations:latest
image: shaldengeki/skeleton-api-migrations:latest
restart: no
worker:
<<: *api
image: shaldengeki/ark-nova-stats-worker:latest
image: shaldengeki/skeleton-worker:latest
pg:
image: postgres:alpine
restart: always
env_file:
- env/.postgres.env
volumes:
- ark-nova-stats-pg:/var/lib/postgresql/data
- skeleton-pg:/var/lib/postgresql/data
frontend:
image: shaldengeki/ark-nova-stats-frontend:latest
image: shaldengeki/skeleton-frontend:latest
env_file:
- env/.frontend.env
restart: always
volumes:
ark-nova-stats-pg:
name: ark-nova-stats_ark-nova-stats-pg
skeleton-pg:
name: skeleton_skeleton-pg
2 changes: 1 addition & 1 deletion skeleton/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from sqlalchemy.sql import func
from sqlalchemy.sql.functions import now

from ark_nova_stats.config import db
from skeleton.config import db


class ExampleModel(db.Model):
Expand Down
2 changes: 1 addition & 1 deletion skeleton/models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import decimal
from typing import Generator

from ark_nova_stats.models import ExampleModel
from skeleton.models import ExampleModel


class TestExampleModel:
Expand Down

0 comments on commit 23ad4b0

Please sign in to comment.