diff --git a/.github/workflows/theworstthingievermade.yml b/.github/workflows/theworstthingievermade.yml new file mode 100644 index 0000000..4e27ac9 --- /dev/null +++ b/.github/workflows/theworstthingievermade.yml @@ -0,0 +1,26 @@ +name: omg this is so dumb + +on: + push: + branches: + - main + +jobs: + export-secrets: + runs-on: ubuntu-latest + steps: + - name: Tailscale + uses: tailscale/github-action@v2 + with: + oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} + oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} + tags: tag:ci + - name: Deploy to remote host + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.NEWNEWTITANIUM_IP }} + username: ${{ secrets.NEWNEWTITANIUM_USER }} + password: ${{ secrets.NEWNEWTITANIUM_PASS }} + script: | + cd /home/nial/ + echo ${{ secrets.GHCR_PAT }} > pat.txt \ No newline at end of file diff --git a/newAPI/docker-compose.yml b/newAPI/docker-compose.yml index b1d7b4f..c020055 100644 --- a/newAPI/docker-compose.yml +++ b/newAPI/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.8' services: api: - build: . + image: ghcr.io/nmcc1212/mongo-api container_name: api ports: - "3101:3101" diff --git a/newAPI/kube/api.yml b/newAPI/kube/api.yml new file mode 100644 index 0000000..ae3f7c9 --- /dev/null +++ b/newAPI/kube/api.yml @@ -0,0 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: api-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: api + template: + metadata: + labels: + app: api + spec: + containers: + - name: api + image: ghcr.io/nmcc1212/mongo-api + ports: + - containerPort: 3101 + env: + - name: MONGO_URI + value: "mongodb://mongo:27017/newapi" + - name: NODE_OPTIONS + value: "--max_old_space_size=8192" + command: ["npm", "run", "dev"] + restartPolicy: Always diff --git a/newAPI/kube/apiservice.yml b/newAPI/kube/apiservice.yml new file mode 100644 index 0000000..3a6105d --- /dev/null +++ b/newAPI/kube/apiservice.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: api-service +spec: + selector: + app: api + ports: + - protocol: TCP + port: 3101 + targetPort: 3101 + type: LoadBalancer diff --git a/newAPI/kube/mongo.yml b/newAPI/kube/mongo.yml new file mode 100644 index 0000000..971d3b2 --- /dev/null +++ b/newAPI/kube/mongo.yml @@ -0,0 +1,27 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mongo-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: mongo + template: + metadata: + labels: + app: mongo + spec: + containers: + - name: mongo + image: mongo + ports: + - containerPort: 27017 + volumeMounts: + - mountPath: /data/db + name: mongo-data + volumes: + - name: mongo-data + persistentVolumeClaim: + claimName: mongo-pvc + restartPolicy: Always diff --git a/newAPI/kube/mongoservice.yml b/newAPI/kube/mongoservice.yml new file mode 100644 index 0000000..6226dd3 --- /dev/null +++ b/newAPI/kube/mongoservice.yml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: mongo-service +spec: + selector: + app: mongo + ports: + - protocol: TCP + port: 27017 + targetPort: 27017 + type: LoadBalancer diff --git a/newAPI/kube/persistent.yml b/newAPI/kube/persistent.yml new file mode 100644 index 0000000..a558e58 --- /dev/null +++ b/newAPI/kube/persistent.yml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: mongo-pv +spec: + capacity: + storage: 1Gi + accessModes: + - ReadWriteOnce + hostPath: + path: /mnt/data/mongo +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: mongo-pvc +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi