-
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
Roman Bekkiev
committed
Dec 6, 2021
1 parent
524abfb
commit bbff905
Showing
11 changed files
with
154 additions
and
66 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 |
---|---|---|
@@ -1,5 +1,13 @@ | ||
{ | ||
"semi": false, | ||
"tabWidth": 4, | ||
"singleQuote": true | ||
"singleQuote": true, | ||
"overrides": [ | ||
{ | ||
"files": ["*.yaml", "*.yml", "*.json"], | ||
"options": { | ||
"tabWidth": 2 | ||
} | ||
} | ||
] | ||
} |
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,10 +1,9 @@ | ||
FROM node:lts-alpine | ||
FROM node:14.18.2-alpine3.14 | ||
ENV NODE_ENV=production | ||
WORKDIR /usr/src/app | ||
COPY ["package.json", "yarn.lock"] | ||
RUN npm install --production --silent && mv node_modules ../ | ||
COPY src tsconfig.json /usr/src/app/ | ||
EXPOSE 3000 | ||
RUN chown -R node /usr/src/app | ||
COPY ["package.json", "yarn.lock", "/usr/src/app/"] | ||
RUN yarn install --production --silent | ||
COPY . . | ||
# RUN chown -R node /usr/src/app | ||
USER node | ||
CMD yarn start | ||
CMD yarn start:bot |
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,46 @@ | ||
--- | ||
- hosts: bot | ||
vars: | ||
registry: '{{ lookup("env", "REGISTRY") }}' | ||
|
||
tasks: | ||
- name: Establish network | ||
docker_network: | ||
name: tribalizm | ||
|
||
- name: Deploy MongoDB | ||
docker_container: | ||
name: mongodb | ||
image: mongo:5.0.4-focal | ||
volumes: | ||
- mongo-data:/data/db | ||
networks: | ||
- name: tribalizm | ||
restart_policy: always | ||
env: | ||
MONGO_INITDB_ROOT_USERNAME: '{{ db_user | string}}' | ||
MONGO_INITDB_ROOT_PASSWORD: '{{ db_pass | string}}' | ||
# to get rid of warnings: | ||
container_default_behavior: no_defaults | ||
network_mode: tribalizm | ||
|
||
- name: Log in to AWS ECR | ||
shell: aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin '{{ registry | string }}' | ||
|
||
- name: Deploy Tribalizm bot | ||
docker_container: | ||
name: tribalizm-bot | ||
image: '{{ registry | string }}/tribalizm-bot:1.0' | ||
networks: | ||
- name: tribalizm | ||
ports: | ||
- 5000:3000 | ||
restart_policy: always | ||
env: | ||
DB_HOST: mongodb # name of container from 'Deploy MongoDB' task | ||
DB_USER: '{{ db_user | string}}' | ||
DB_PASS: '{{ db_pass | string}}' | ||
BOT_TOKEN: '{{ bot_token | string}}' | ||
# to get rid of warnings: | ||
container_default_behavior: no_defaults | ||
network_mode: tribalizm |
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
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 |
---|---|---|
|
@@ -6,3 +6,10 @@ rblab.net | |
|
||
[infra] | ||
rblab.net | ||
|
||
[localhost] | ||
127.0.0.1 | ||
|
||
|
||
[localhost:vars] | ||
ansible_connection=local |
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,45 +1,51 @@ | ||
{ | ||
"name": "tribalizm", | ||
"version": "1.0.0", | ||
"description": "Real life MMORPG networking", | ||
"main": "index.ts", | ||
"repository": "-", | ||
"author": "RB-Lab", | ||
"license": "UNLICENZED", | ||
"private": true, | ||
"scripts": { | ||
"start:bot": "ts-node --transpile-only src/main.ts", | ||
"start:bot-dev": "nodemon src/plugins/ui/telegram/ui-tests-mock-bot.ts", | ||
"start:admin": "ts-node --transpile-only src/admin.ts", | ||
"test": "ts-node ./node_modules/.bin/jasmine './src/**/*.spec.ts'", | ||
"test:full": "FULL_TEST='true' ts-node ./node_modules/.bin/jasmine './src/**/*.spec.ts'", | ||
"tdd": "tsnd --rs --respawn ./node_modules/.bin/jasmine './src/**/*.spec.ts'", | ||
"depcruise": "depcruise --include-only '^src' --output-type dot src | dot -T svg | depcruise-wrap-stream-in-html > docs/dependecies.html", | ||
"bridge": "ssh -R 5000:localhost:3000 rblab.net", | ||
"i18n": "typesafe-i18n" | ||
}, | ||
"dependencies": { | ||
"@types/express": "^4.17.11", | ||
"@types/inquirer": "^8.1.3", | ||
"@types/inquirer-autocomplete-prompt": "^1.3.3", | ||
"@types/mongodb": "^3.6.12", | ||
"@types/node": "^14.14.20", | ||
"express": "^4.17.1", | ||
"inquirer": "^8.2.0", | ||
"inquirer-autocomplete-prompt": "^1.4.0", | ||
"mongodb": "^3.6.6", | ||
"telegraf": "^4.4.2", | ||
"telegraf-calendar-telegram": "^1.5.8", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.1.3" | ||
}, | ||
"devDependencies": { | ||
"@types/jasmine": "^3.6.2", | ||
"dependency-cruiser": "^10.5.0", | ||
"jasmine": "^3.6.3", | ||
"mongodb-memory-server": "^6.9.6", | ||
"nodemon": "^2.0.7", | ||
"ts-node-dev": "^1.1.6", | ||
"typesafe-i18n": "^2.52.2" | ||
} | ||
"name": "tribalizm", | ||
"version": "1.0.0", | ||
"description": "Real life MMORPG networking", | ||
"main": "index.ts", | ||
"repository": "-", | ||
"author": "RB-Lab", | ||
"license": "UNLICENZED", | ||
"private": true, | ||
"scripts": { | ||
"start:bot": "ts-node --transpile-only src/main.ts", | ||
"start:bot-dev": "nodemon src/plugins/ui/telegram/ui-tests-mock-bot.ts", | ||
"start:admin": "ts-node --transpile-only src/admin.ts", | ||
"build:images": "docker-compose --env-file ./.env.build build", | ||
"push:login": "aws ecr get-login-password --region eu-central-1 | docker login --username AWS --password-stdin \"${REGISTRY}\"", | ||
"push:tag": "sh -c 'docker tag \"${0}\" ${REGISTRY}/\"${0}\"'", | ||
"push:push": "sh -c 'docker push \"${REGISTRY}\"/\"${0}\"'", | ||
"push": "egrep -v '^#' .env.build | xargs && sh -c 'yarn push:login && yarn push:tag \"${0}\" && yarn push:push \"${0}\"'", | ||
"deploy": "export $(egrep -v '^#' .env.build | xargs) && pushd deploy && ansible-playbook deploy.yml && popd", | ||
"test": "ts-node ./node_modules/.bin/jasmine './src/**/*.spec.ts'", | ||
"test:full": "FULL_TEST='true' ts-node ./node_modules/.bin/jasmine './src/**/*.spec.ts'", | ||
"tdd": "tsnd --rs --respawn ./node_modules/.bin/jasmine './src/**/*.spec.ts'", | ||
"depcruise": "depcruise --include-only '^src' --output-type dot src | dot -T svg | depcruise-wrap-stream-in-html > docs/dependecies.html", | ||
"bridge": "ssh -R 5000:localhost:3000 rblab.net", | ||
"i18n": "typesafe-i18n" | ||
}, | ||
"dependencies": { | ||
"@types/express": "^4.17.11", | ||
"@types/inquirer": "^8.1.3", | ||
"@types/inquirer-autocomplete-prompt": "^1.3.3", | ||
"@types/mongodb": "^3.6.12", | ||
"@types/node": "^14.14.20", | ||
"express": "^4.17.1", | ||
"inquirer": "^8.2.0", | ||
"inquirer-autocomplete-prompt": "^1.4.0", | ||
"mongodb": "^3.6.6", | ||
"telegraf": "^4.4.2", | ||
"telegraf-calendar-telegram": "^1.5.8", | ||
"ts-node": "^9.1.1", | ||
"typesafe-i18n": "^2.55.1", | ||
"typescript": "^4.1.3" | ||
}, | ||
"devDependencies": { | ||
"@types/jasmine": "^3.6.2", | ||
"dependency-cruiser": "^10.5.0", | ||
"jasmine": "^3.6.3", | ||
"mongodb-memory-server": "^6.9.6", | ||
"nodemon": "^2.0.7", | ||
"ts-node-dev": "^1.1.6" | ||
} | ||
} |
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