Skip to content

Commit

Permalink
chore: rename projects
Browse files Browse the repository at this point in the history
  • Loading branch information
marcolongol committed Aug 16, 2024
1 parent b19b029 commit 3281f3f
Show file tree
Hide file tree
Showing 126 changed files with 309 additions and 546 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
.angular
/chart
**/CHANGELOG.md
/apps/marcolongo.cloud/chart/*
/apps/marcolongo.cloud-api/chart/*
/apps/app/chart/*
/apps/api/chart/*
61 changes: 38 additions & 23 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,26 @@ print(
""".strip()
)

allow_k8s_contexts("[email protected]")


# SECTION: APP
# ---
docker_build(
"marcolongo.cloud-app",
"app",
context=".",
dockerfile="./apps/marcolongo.cloud/Dockerfile",
dockerfile="./apps/app/Dockerfile",
only=[
"./dist/apps/marcolongo.cloud/browser",
"./dist/apps/app/browser/",
"./apps/app/nginx.conf",
],
live_update=[
sync("./dist/apps/marcolongo.cloud/browser", "/usr/share/nginx/html/")
sync("./dist/apps/app/browser", "/usr/share/nginx/html/"),
sync("./apps/app/nginx.conf", "/etc/nginx/conf.d/default.conf"),
],
)

local_resource(
"serve:app:dev",
serve_cmd="npm run serve:app:dev",
serve_cmd="npx nx run app:serve:development",
labels=["app"],
trigger_mode=TRIGGER_MODE_AUTO,
auto_init=False,
Expand All @@ -33,45 +35,51 @@ local_resource(

local_resource(
"build:app:dev",
serve_cmd="npm run build:app:dev -- --watch",
serve_cmd="npx nx run app:build:development -- --watch",
labels=["app"],
trigger_mode=TRIGGER_MODE_AUTO,
auto_init=False,
)


# SECTION: API
# ---
docker_build(
"marcolongo.cloud-api",
"api",
context=".",
dockerfile="./apps/marcolongo.cloud-api/Dockerfile",
dockerfile="./apps/api/Dockerfile",
only=[
"./dist/apps/marcolongo.cloud-api",
"./dist/apps/api",
],
live_update=[sync("./dist/apps/marcolongo.cloud-api", "/app")],
target="dev",
live_update=[sync("./dist/apps/api", "/app")],
target="development",
)

local_resource(
"build:api:dev",
serve_cmd="npm run build:api:dev -- --watch",
serve_cmd="npx nx run api:build:development -- --watch",
labels=["api"],
trigger_mode=TRIGGER_MODE_AUTO,
auto_init=False,
)

local_resource(
"serve:api:dev",
serve_cmd="npm run serve:api:dev",
serve_cmd="npx nx run api:serve:development",
labels=["api"],
trigger_mode=TRIGGER_MODE_AUTO,
auto_init=False,
links=[link("http://localhost:3000", "api")],
)

# SECTION: K8s
# ---
k8s_yaml(helm("./chart", "marcolongo-cloud", "marcolongo-cloud", "./chart/values.yaml"))

k8s_resource(
"marcolongo-cloud-app",
port_forwards=[
port_forward(4200, name="web"),
port_forward(80, name="web"),
],
labels=["app"],
auto_init=False,
Expand All @@ -86,9 +94,11 @@ k8s_resource(
auto_init=False,
)

# SECTION: Storybook
# ------------------
local_resource(
"marcolongo.cloud",
serve_cmd="npm run storybook:app",
"app",
serve_cmd="npx nx run app:storybook",
links=[link("http://localhost:4400", "storybook")],
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
Expand All @@ -97,7 +107,7 @@ local_resource(

local_resource(
"common-ui",
serve_cmd="npm run storybook:common-ui",
serve_cmd="npx nx run common-ui:storybook",
links=[link("http://localhost:4401", "storybook")],
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
Expand All @@ -106,7 +116,7 @@ local_resource(

local_resource(
"core",
serve_cmd="npm run storybook:core",
serve_cmd="npx nx run core:storybook",
links=[link("http://localhost:4402", "storybook")],
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
Expand All @@ -115,23 +125,28 @@ local_resource(

local_resource(
"gradient-os",
serve_cmd="npm run storybook:gradient-os",
serve_cmd="npx nx run gradient-os:storybook",
links=[link("http://localhost:4403", "storybook")],
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
labels=["storybook"],
)

# SECTION: Tests
# --------------
local_resource(
"test:unit",
serve_cmd="npm run test:unit -- --watch --parallel 10",
serve_cmd="npx nx run-many --target=test --parallel 10 --configuration ci -- --watch",
trigger_mode=TRIGGER_MODE_MANUAL,
labels=["tests"],
)


# SECTION: E2E
# ------------
local_resource(
"test:e2e",
cmd="npm run test:e2e -- --parallel 10",
cmd="npx nx run-many --target=e2e --parallel 10",
trigger_mode=TRIGGER_MODE_MANUAL,
auto_init=False,
labels=["tests"],
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
displayName: 'marcolongo.cloud-api-e2e',
displayName: 'api',
preset: '../../jest.preset.js',
globalSetup: '<rootDir>/src/support/global-setup.ts',
globalTeardown: '<rootDir>/src/support/global-teardown.ts',
Expand All @@ -14,5 +14,5 @@ export default {
],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/marcolongo.cloud-api-e2e',
coverageDirectory: '../../coverage/api-e2e',
};
4 changes: 4 additions & 0 deletions apps/api-e2e/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "@marcolongo.cloud/api-e2e",
"version": "0.0.0"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "marcolongo.cloud-api-e2e",
"name": "api-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": ["marcolongo.cloud-api"],
"implicitDependencies": ["api"],
"targets": {
"lint": {
"executor": "@nx/eslint:lint"
Expand All @@ -11,10 +11,10 @@
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{e2eProjectRoot}"],
"options": {
"jestConfig": "apps/marcolongo.cloud-api-e2e/jest.config.ts",
"jestConfig": "apps/api-e2e/jest.config.ts",
"passWithNoTests": true
},
"dependsOn": ["marcolongo.cloud-api:build"]
"dependsOn": ["api:build"]
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default async function setup() {
console.log('\nSetting up...\n');

// Start the API server.
const server = spawn('nx', ['run', 'marcolongo.cloud-api:serve'], {
const server = spawn('nx', ['run', 'api:serve'], {
shell: true,
stdio: 'pipe',
});
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 6 additions & 8 deletions apps/marcolongo.cloud-api/Dockerfile → apps/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ FROM node:lts-alpine as deps
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY dist/apps/marcolongo.cloud-api/package*.json ./
COPY dist/apps/api/package*.json ./
RUN npm install --omit=dev


# Production image, copy all the files and run nest
FROM node:lts-alpine as dev
FROM node:lts-alpine as development
RUN apk add --no-cache dumb-init
RUN npm i -g nodemon
ENV NODE_ENV production
ENV NODE_ENV development
ENV PORT 3000
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/package.json ./package.json
COPY dist/apps/marcolongo.cloud-api .
RUN chown -R node:node .
COPY dist/apps/api/ .
USER node
EXPOSE 3000
CMD ["dumb-init", "nodemon", "main.js"]
CMD ["nodemon", "main.js"]

# Production image, copy all the files and run nest
FROM node:lts-alpine as prod
Expand All @@ -30,8 +29,7 @@ ENV PORT 3000
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/package.json ./package.json
COPY dist/apps/marcolongo.cloud-api .
RUN chown -R node:node .
COPY dist/apps/api .
USER node
EXPOSE 3000
CMD ["dumb-init", "node", "main.js"]
File renamed without changes.
6 changes: 6 additions & 0 deletions apps/api/chart/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 15.5.21
digest: sha256:818af7619e898e3cc8c98f0caea0df5719e391a343b641d01a74d08221d4fc46
generated: "2024-08-13T17:14:59.9970171-07:00"
12 changes: 12 additions & 0 deletions apps/api/chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v2
name: api
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: '1.16.0'

dependencies:
- name: postgresql
condition: postgresql.enabled
version: 15.5.21
repository: https://charts.bitnami.com/bitnami
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ spec:
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
- name: api
containerPort: {{ .Values.service.port }}
protocol: TCP
livenessProbe:
Expand Down
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions apps/api/chart/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "chart.fullname" . }}
labels:
{{- include "chart.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: api
protocol: TCP
name: api
selector:
{{- include "chart.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
replicaCount: 1

image:
repository: nginx
repository: api
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ''
Expand Down Expand Up @@ -43,7 +43,7 @@ securityContext:

service:
type: ClusterIP
port: 80
port: 3000

ingress:
enabled: false
Expand Down Expand Up @@ -77,12 +77,12 @@ resources:

livenessProbe:
httpGet:
path: /
port: http
path: /api
port: api
readinessProbe:
httpGet:
path: /
port: http
path: /api
port: api

autoscaling:
enabled: false
Expand All @@ -109,3 +109,6 @@ nodeSelector: {}
tolerations: []

affinity: {}

postgresql:
enabled: false
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default {
displayName: 'marcolongo.cloud-api',
displayName: 'api',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/apps/marcolongo.cloud-api',
coverageDirectory: '../../coverage/apps/api',
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@marcolongo.cloud/marcolongo.cloud-api",
"name": "@marcolongo.cloud/api",
"version": "0.0.0",
"dependencies": {
"@nestjs/common": "^10.0.2",
Expand Down
Loading

0 comments on commit 3281f3f

Please sign in to comment.