Skip to content

Commit 1163dd8

Browse files
authored
added some deployment changes (#197)
1 parent 5c8308f commit 1163dd8

File tree

8 files changed

+17
-12
lines changed

8 files changed

+17
-12
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ jobs:
6363
with:
6464
path: "**/node_modules"
6565
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
66-
- run: echo `openssl rand -hex 64` >> mongoPassword
67-
- run: echo "DOESNTMATTER" >> token
68-
- run: sudo docker run -v $(pwd)/mongoPassword:/run/secrets/mongoPassword -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_DATABASE=qutex -e MONGO_INITDB_ROOT_PASSWORD_FILE=/run/secrets/mongoPassword --name mongo -d -p 27017:27017 mongo:4.4.5
66+
- run: |
67+
mkdir -p secrets/local/
68+
echo `openssl rand -hex 64` >> secrets/local/mongoPassword
69+
echo "DOESNTMATTER" >> secrets/local/token
70+
sudo docker run -v $(pwd)/secrets/local/mongoPassword:/run/secrets/mongoPassword -e MONGO_INITDB_ROOT_USERNAME=root -e MONGO_INITDB_DATABASE=qutex -e MONGO_INITDB_ROOT_PASSWORD_FILE=/run/secrets/mongoPassword --name mongo -d -p 27017:27017 mongo:4.4.5
6971
- env:
7072
QUTEX_TESTING: true
7173
run: yarn --cwd services/bot test --verbose

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ secrets.env
66
result.json
77
coverage/
88
.DS_Store
9-
token
10-
mongoPassword
119
site/
10+
secrets
1211

1312
# Jekyll
1413
docs/_site

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ up:
99

1010
.PHONY: deploy $(VERSION)
1111
deploy:
12-
${MAKE} build
1312
./bin/deploy_stack.sh $(VERSION)
1413

1514
.PHONY: logs

docker-compose.dev.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ services:
1616
context: ./services/bot
1717
mongo:
1818
ports:
19-
- 27017:27017
19+
- 27017:27017
20+
secrets:
21+
token:
22+
file: secrets/local/token
23+
mongoPassword:
24+
file: secrets/local/mongoPassword

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ services:
5454
- mongoPassword
5555
secrets:
5656
token:
57-
file: token
57+
file: secrets/prod/token
5858
mongoPassword:
59-
file: mongoPassword
59+
file: secrets/prod/mongoPassword
6060
volumes:
6161
mongo_volume:

services/bot/migrate-mongo-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const GET = (secret) => {
33
if (['production', 'development'].includes(process.env.NODE_ENV || '')) {
44
return FS.readFileSync(`/run/secrets/${secret}`, 'utf8').trim();
55
} else {
6-
return FS.readFileSync(`../../${secret}`, 'utf8').trim();
6+
return FS.readFileSync(`../../secrets/local/${secret}`, 'utf8').trim();
77
}
88
};
99

services/bot/src/secrets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export const GET = (secret: string): string => {
1414
if (['production', 'development'].includes(process.env.NODE_ENV || '')) {
1515
return fs.readFileSync(`/run/secrets/${secret}`, 'utf8').trim();
1616
} else {
17-
return fs.readFileSync(`../../${secret}`, 'utf8').trim();
17+
return fs.readFileSync(`../../secrets/local/${secret}`, 'utf8').trim();
1818
}
1919
};

services/bot/tests/production.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import mock from 'mock-fs';
99
mock({
1010
'/run/secrets/': {
1111
'token': 'some token',
12-
'mongoPassword': mock.load('../../mongoPassword')
12+
'mongoPassword': mock.load('../../secrets/local/mongoPassword')
1313
},
1414
'src': mock.load('src'),
1515
'tests': mock.load('tests'),

0 commit comments

Comments
 (0)