From a965cf348b0f5f290826d2e286f4dc0783fbfd6b Mon Sep 17 00:00:00 2001 From: builder_247 <14019974+builder-247@users.noreply.github.com> Date: Sun, 10 Oct 2021 16:24:26 +0300 Subject: [PATCH] removed legacy stuff (#705) --- .travis.yml | 23 ----------------------- README.md | 2 -- dev/insertKeys.js | 12 ------------ index.js | 3 --- scripts/backend.sh | 4 ---- scripts/deploy.sh | 6 ------ scripts/gce.sh | 29 ----------------------------- scripts/redis.sh | 12 ------------ scripts/web.sh | 4 ---- 9 files changed, 95 deletions(-) delete mode 100644 .travis.yml delete mode 100644 dev/insertKeys.js delete mode 100644 scripts/backend.sh delete mode 100644 scripts/deploy.sh delete mode 100644 scripts/gce.sh delete mode 100644 scripts/redis.sh delete mode 100644 scripts/web.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eff45d2e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -sudo: required -language: node_js -services: - - docker -node_js: - - 'node' -notifications: - email: - - olaakkonen@gmail.com -before_install: - - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" - - sudo apt-get update - - sudo apt-get -y install docker-ce -install: true -script: - - sudo bash scripts/build.sh -deploy: - provider: script - skip_cleanup: true - on: - branch: master - script: chmod +x scripts/postbuild.sh && scripts/postbuild.sh diff --git a/README.md b/README.md index ed6d7f15..51119822 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,7 @@ core === [![Discord](https://discordapp.com/api/guilds/323555112553414667/embed.png)](https://discord.gg/ND9bJKK) -[![Build Status](https://travis-ci.org/slothpixel/core.svg?branch=master)](https://travis-ci.org/slothpixel/core) [![Code Quality](https://img.shields.io/lgtm/grade/javascript/github/slothpixel/core)](https://lgtm.com/projects/g/slothpixel/core) -[![Greenkeeper](https://badges.greenkeeper.io/slothpixel/core.svg)](https://greenkeeper.io) **NOTE:** The Slothpixel API is currently in early development - some features are missing and/or incomplete. diff --git a/dev/insertKeys.js b/dev/insertKeys.js deleted file mode 100644 index 25916b3e..00000000 --- a/dev/insertKeys.js +++ /dev/null @@ -1,12 +0,0 @@ -/* -* Used to mass insert API keys to redis - */ -const cp = require('child_process'); - -process.stdin.setRawMode(true); -process.stdin.on('readable', () => { - const keys = JSON.parse(process.stdin.read()); - keys.forEach((key) => { - cp.execSync(`redis-cli -x set api_keys:${key.key} ${JSON.stringify(key)}`); - }); -}); diff --git a/index.js b/index.js index c9306d64..bd5b6b61 100644 --- a/index.js +++ b/index.js @@ -10,9 +10,6 @@ const { apps } = require('./manifest.json'); const arguments_ = process.argv.slice(2); const group = arguments_[0] || process.env.GROUP; -if (process.env.PROVIDER === 'gce') { - cp.execSync('curl -H "Metadata-Flavor: Google" -L http://metadata.google.internal/computeMetadata/v1/project/attributes/env > /usr/src/.env'); -} if (process.env.ROLE) { // if role variable is set just run that script require(`./svc/${process.env.ROLE}.js`); diff --git a/scripts/backend.sh b/scripts/backend.sh deleted file mode 100644 index b64c0397..00000000 --- a/scripts/backend.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -curl -sSL https://get.docker.com/ | sh -sudo docker run -d --name backend --restart=always --net=host --log-opt max-size=1g -e PROVIDER=gce -e GROUP=backend slothpixel/core:latest sh -c "npm start" -sudo docker start backend diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100644 index b3dff118..00000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -for instance in `gcloud compute instance-groups managed list-instances $1-group-1 --format "value(NAME)"` ; -do - gcloud compute instance-groups managed recreate-instances $1-group-1 --instances $instance; - sleep ${2:-180}; -done diff --git a/scripts/gce.sh b/scripts/gce.sh deleted file mode 100644 index 524a68ee..00000000 --- a/scripts/gce.sh +++ /dev/null @@ -1,29 +0,0 @@ -#prod env vars to metadata -gcloud compute project-info add-metadata --metadata-from-file env=./prod.env - -#redis -gcloud compute --project "snappy-nomad-263019" disks create "disk-redis" --size "10" --zone "us-central1-b" --type "pd-ssd" -gcloud compute instances delete --quiet redis-1 -gcloud compute instances create redis-1 --machine-type n1-standard-1 --image-family ubuntu-1804-lts --image-project gce-uefi-images --disk name=disk-redis --boot-disk-size 10GB --boot-disk-type pd-ssd -gcloud compute instances add-metadata redis-1 --metadata-from-file startup-script=./scripts/redis.sh - -#web, health check, loadbalancer -gcloud compute forwarding-rules delete --quiet lb-rule -gcloud compute target-pools delete --quiet lb-pool -gcloud compute http-health-checks delete --quiet lb-check -gcloud compute instance-groups managed delete --quiet web-group-1 -gcloud compute instance-templates delete --quiet web-1 -gcloud compute instance-templates create web-1 --machine-type g1-small --image-family ubuntu-1804-lts --image-project gce-uefi-images --boot-disk-size 10GB --boot-disk-type pd-ssd --tags "http-server" --metadata-from-file startup-script=./scripts/web.sh -gcloud compute instance-groups managed create "web-group-1" --base-instance-name "web-group-1" --template "web-1" --size "0" -gcloud compute --project "snappy-nomad-263019" http-health-checks create "lb-check" --port "80" --request-path "/healthz" --check-interval "5" --timeout "5" --unhealthy-threshold "2" --healthy-threshold "2" -gcloud compute --project "snappy-nomad-263019" target-pools create "lb-pool" --region "us-central1" --http-health-check "lb-check" --session-affinity "NONE" -gcloud compute --project "snappy-nomad-263019" forwarding-rules create "lb-rule" --region "us-central1" --regional --address "34.67.146.236" --ip-protocol "TCP" --ports "80" --target-pool "lb-pool" -gcloud compute --project "snappy-nomad-263019" instance-groups managed set-target-pools "web-group-1" --zone "us-central1-b" --target-pools "https://www.googleapis.com/compute/v1/projects/snappy-nomad-263019/regions/us-central1/targetPools/lb-pool" -gcloud compute instance-groups managed set-autoscaling "web-group-1" --cool-down-period "60" --max-num-replicas "3" --min-num-replicas "2" --target-cpu-utilization "0.9" - -#backend -gcloud compute instance-groups managed delete --quiet backend-group-1 -gcloud compute instance-templates delete --quiet backend-1 -gcloud compute instance-templates create backend-1 --machine-type n1-standard-2 --preemptible --image-family ubuntu-1804-lts --image-project gce-uefi-images --boot-disk-size 10GB --boot-disk-type pd-ssd --tags "http-server" --metadata-from-file startup-script=./scripts/backend.sh -gcloud compute instance-groups managed create "backend-group-1" --base-instance-name "backend-group-1" --template "backend-1" --size "1" -gcloud compute instance-groups managed set-autoscaling "backend-group-1" --cool-down-period "60" --max-num-replicas "1" --min-num-replicas "1" --target-cpu-utilization "0.6" diff --git a/scripts/redis.sh b/scripts/redis.sh deleted file mode 100644 index 7d7d1854..00000000 --- a/scripts/redis.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -curl -sSL https://get.docker.com/ | sh - -# curl -H "Metadata-Flavor: Google" -L http://metadata.google.internal/computeMetadata/v1/project/attributes/redis > /redis.conf - -sudo mkdir -p /var/lib/redis -sudo mount -o discard,defaults /dev/disk/by-id/google-persistent-disk-1 /var/lib/redis -sudo echo never > /sys/kernel/mm/transparent_hugepage/enabled - -sudo docker run -d --name redis --restart=always --log-opt max-size=1g -v /redis.conf:/usr/local/etc/redis/redis.conf -v /var/lib/redis:/var/lib/redis --net=host redis:5 /usr/local/bin/redis-server /usr/local/etc/redis/redis.conf -sudo docker start redis diff --git a/scripts/web.sh b/scripts/web.sh deleted file mode 100644 index 04eeff76..00000000 --- a/scripts/web.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -curl -sSL https://get.docker.com/ | sh -sudo docker run -d --name=web --restart=always --net=host --log-opt max-size=1g -e FRONTEND_PORT=80 -e PROVIDER=gce -e ROLE=web slothpixel/core:latest sh -c "npm start" -sudo docker start web