Skip to content

Commit

Permalink
vendor upgrade, elasticsearch => opensearch, pulumi upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikzogg committed Jul 3, 2024
1 parent e4d7870 commit 5b1517e
Show file tree
Hide file tree
Showing 16 changed files with 3,747 additions and 2,132 deletions.
30 changes: 16 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ An api skeleton using mongodb for [chubbyts-framework][8].
## Requirements

* node: 16
* [@asteasolutions/zod-to-openapi][1]: ^6.4.0
* [@chubbyts/chubbyts-api][2]: ^4.0.0
* [@asteasolutions/zod-to-openapi][1]: ^7.1.1
* [@chubbyts/chubbyts-api][2]: ^4.1.1
* [@chubbyts/chubbyts-decode-encode][3]: ^1.3.3
* [@chubbyts/chubbyts-dic][4]: ^1.2.0
* [@chubbyts/chubbyts-dic-config][5]: ^1.2.0
* [@chubbyts/chubbyts-dic-types][6]: ^1.2.1
* [@chubbyts/chubbyts-framework][7]: ^1.9.0
* [@chubbyts/chubbyts-framework-router-path-to-regexp][8]: ^1.4.0
* [@chubbyts/chubbyts-framework][7]: ^1.9.4
* [@chubbyts/chubbyts-framework-router-path-to-regexp][8]: ^1.4.1
* [@chubbyts/chubbyts-http][9]: ^1.2.1
* [@chubbyts/chubbyts-http-cors][10]: ^1.2.1
* [@chubbyts/chubbyts-http-error][11]: ^2.3.1
Expand All @@ -40,12 +40,12 @@ An api skeleton using mongodb for [chubbyts-framework][8].
* [@chubbyts/chubbyts-mongodb][15]: ^1.4.0
* [@chubbyts/chubbyts-negotiation][16]: ^3.2.2
* [@chubbyts/chubbyts-pino-adapter][17]: ^1.3.1
* [commander][18]: ^12.0.0
* [mongodb][19]: ^6.5.0
* [openapi3-ts][20]: ^4.2.2
* [pino][21]: ^8.19.0
* [uuid][22]: ^9.0.1
* [zod][23]: ^3.22.4
* [commander][18]: ^12.1.0
* [mongodb][19]: ^6.8.0
* [openapi3-ts][20]: ^4.3.3
* [pino][21]: ^9.2.0
* [uuid][22]: ^10.0.0
* [zod][23]: ^3.23.8

## Environment

Expand Down Expand Up @@ -104,7 +104,7 @@ Models, entities, documents what ever fits your purpose the best.

### Repository

Repositories get data from storages like databases, elasticsearch, redis or whereever your models are stored or cached.
Repositories get data from storages like databases, opensearch, redis or whereever your models are stored or cached.

* [src/repository.ts][34]

Expand Down Expand Up @@ -132,9 +132,11 @@ Service factories are the glue code of the dependeny injection container.
cd pulumi
pnpm install
pulumi config set digitalocean:token XXXXXXXXXXXXXX --secret
pulumi config set chubbyts-petstore:certManagerEmail XXXXXXXXXXXXXX --secret
pulumi config set chubbyts-petstore:ipRange 10.10.11.0/24
pulumi config set chubbyts-petstore:nodeCount: "1"
pulumi config set chubbyts-petstore:cert-manager-email XXXXXXXXXXXXXX --secret
pulumi config set chubbyts-petstore:ip-range 10.10.11.0/24
pulumi config set chubbyts-petstore:k8s-node-Count: "1"
pulumi config set chubbyts-petstore:mongodb-node-Count: "1"
pulumi config set chubbyts-petstore:opensearch-node-Count: "1"
pulumi up
```

Expand Down
59 changes: 33 additions & 26 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,30 @@ services:
context: ./
user: "${USER_ID:-1000}:${GROUP_ID:-1000}"
environment:
FLUENTD_DAEMON_USER: ${USER_ID:-1000}
FLUENTD_DAEMON_GROUP: ${GROUP_ID:-1000}
STACK: 'local'
ELASTICSEARCH_HOSTS: 'http://elasticsearch:9200'
OPENSEARCH_HOSTS: 'opensearch:9200'
OPENSEARCH_USER: 'admin'
OPENSEARCH_PASSWORD: 't9V02zfj!NMj?LugFsOi'
OPENSEARCH_SSL_VERIFY: 'false'
volumes:
- ${PWD}/var/log:/app/var/log
depends_on:
- elasticsearch
- opensearch
mongo:
container_name: chubbyts-petstore-mongo
hostname: chubbyts-petstore-mongo
image: mongo:6.0.11
image: mongo:7.0.7
environment:
MONGO_INITDB_ROOT_USERNAME: petstore
MONGO_INITDB_ROOT_PASSWORD: 4aAUfBjDACcdZxNwJgJ6
ports:
- '27017:27017'
volumes:
- mongo:/data/db
swagger-ui:
container_name: chubbyts-petstore-swagger-ui
hostname: chubbyts-petstore-swagger-ui
image: swaggerapi/swagger-ui:v5.10.3
environment:
BASE_URL: /swagger
URLS: '[ { url: "/openapi" } ]'
nginx:
container_name: chubbyts-petstore-nginx
hostname: chubbyts-petstore-nginx
image: nginx:1.21.6
image: nginx:1.25.3
environment:
SERVER_PORT: '443'
NODE_SERVER_HOST: 'node'
Expand All @@ -76,31 +70,44 @@ services:
depends_on:
- node
- swagger-ui
elasticsearch:
container_name: chubbyts-petstore-elasticsearch
hostname: chubbyts-petstore-elasticsearch
image: elasticsearch:8.11.1
opensearch:
container_name: chubbyts-petstore-opensearch
hostname: chubbyts-petstore-opensearch
image: opensearchproject/opensearch:2.15.0
environment:
ES_JAVA_OPTS: '-Xms512m -Xmx512m'
bootstrap.memory_lock: 'true'
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 't9V02zfj!NMj?LugFsOi'
discovery.type: 'single-node'
xpack.security.enabled: 'false'
xpack.security.enrollment.enabled: 'false'
ports:
- 9200:9200
ulimits:
memlock:
soft: -1
hard: -1
kibana:
container_name: chubbyts-petstore-kibana
hostname: chubbyts-petstore-kibana
image: kibana:8.11.1
healthcheck:
test:
[
"CMD-SHELL",
"curl -sk https://localhost:9200 | grep -q 'Unauthorized'"
]
interval: 10s
timeout: 10s
retries: 120
opensearch-dashboard:
container_name: chubbyts-petstore-opensearch-dashboard
hostname: chubbyts-petstore-opensearch-dashboard
image: opensearchproject/opensearch-dashboards:2.15.0
environment:
XPACK_APM_SERVICEMAPENABLED: 'true'
XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: 0557aa47-1706-48df-8f2b-b7a5eddcbdf2
OPENSEARCH_HOSTS: '["https://opensearch:9200"]'
ports:
- 5601:5601
swagger-ui:
container_name: chubbyts-petstore-swagger-ui
hostname: chubbyts-petstore-swagger-ui
image: swaggerapi/swagger-ui:v5.17.4
environment:
BASE_URL: /swagger
URLS: '[ { url: "/openapi" } ]'

volumes:
mongo:
2 changes: 1 addition & 1 deletion docker/development/node/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rockylinux/rockylinux:9.3
FROM rockylinux/rockylinux:9.4

SHELL ["/bin/bash", "-c"]

Expand Down
16 changes: 15 additions & 1 deletion docker/production/node-fluentd/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
FROM fluent/fluentd:v1.16
FROM fluent/fluentd:v1.17

# Use root account to use apk
USER root

# below RUN includes plugin as examples opensearch is not required
# you may customize including plugins as you wish
RUN apk add --no-cache --update --virtual .build-deps \
sudo build-base ruby-dev \
&& sudo gem install fluent-plugin-opensearch \
&& sudo gem sources --clear-all \
&& apk del .build-deps \
&& rm -rf /tmp/* /var/tmp/* /usr/lib/ruby/gems/*/cache/*.gem

COPY docker/production/node-fluentd/files /

USER fluent
28 changes: 28 additions & 0 deletions docker/production/node-fluentd/files/bin/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

#source vars if file exists
DEFAULT=/etc/default/fluentd

if [ -r $DEFAULT ]; then
set -o allexport
. $DEFAULT
set +o allexport
fi

# If the user has supplied only arguments append them to `fluentd` command
if [ "${1#-}" != "$1" ]; then
set -- fluentd "$@"
fi

# If user does not supply config file or plugins, use the default
if [ "$1" = "fluentd" ]; then
if ! echo $@ | grep -e ' \-c' -e ' \-\-config' ; then
set -- "$@" --config /fluentd/etc/${FLUENTD_CONF}
fi

if ! echo $@ | grep -e ' \-p' -e ' \-\-plugin' ; then
set -- "$@" --plugin /fluentd/plugins
fi
fi

exec "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@
<match application>
@type copy
<store>
@type elasticsearch
@type opensearch
logstash_format true
hosts "#{ENV['ELASTICSEARCH_HOSTS']}"
logstash_prefix "logstash"
logstash_prefix_separator "-"
logstash_dateformat "%Y-%m-%d"
hosts "#{ENV['OPENSEARCH_HOSTS']}"
user "#{ENV['OPENSEARCH_USER']}"
password "#{ENV['OPENSEARCH_PASSWORD']}"
scheme https
ssl_verify "#{ENV['OPENSEARCH_SSL_VERIFY'] == 'true'}"
reconnect_on_error true
reload_on_failure true
reload_connections false
<buffer>
flush_interval 1s
</buffer>
Expand All @@ -33,3 +43,7 @@
@type stdout
</store>
</match>

<system>
rpc_endpoint 127.0.0.1:24444
</system>
27 changes: 13 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"node": ">=18"
},
"dependencies": {
"@asteasolutions/zod-to-openapi": "^7.0.0",
"@chubbyts/chubbyts-api": "^4.1.0",
"@asteasolutions/zod-to-openapi": "^7.1.1",
"@chubbyts/chubbyts-api": "^4.1.1",
"@chubbyts/chubbyts-decode-encode": "^1.3.3",
"@chubbyts/chubbyts-dic": "^1.2.0",
"@chubbyts/chubbyts-dic-config": "^1.2.0",
Expand All @@ -59,31 +59,30 @@
"@chubbyts/chubbyts-negotiation": "^3.2.2",
"@chubbyts/chubbyts-pino-adapter": "^1.3.2",
"commander": "^12.1.0",
"mongodb": "^6.7.0",
"mongodb": "^6.8.0",
"openapi3-ts": "^4.3.3",
"pino": "^9.2.0",
"uuid": "^10.0.0",
"zod": "^3.23.8"
},
"devDependencies": {
"@chubbyts/chubbyts-eslint": "^2.0.7",
"@chubbyts/chubbyts-function-mock": "^1.4.2",
"@chubbyts/chubbyts-function-mock": "^1.4.3",
"@stryker-mutator/core": "^8.2.6",
"@stryker-mutator/typescript-checker": "^8.2.6",
"@stryker-mutator/vitest-runner": "^8.2.6",
"@swc/cli": "^0.3.12",
"@swc/core": "^1.6.1",
"@types/node": "^20.14.2",
"@types/uuid": "^9.0.8",
"@swc/cli": "^0.4.0",
"@swc/core": "^1.6.7",
"@types/node": "^20.14.9",
"@types/uuid": "^10.0.0",
"@vitest/coverage-v8": "^1.6.0",
"cross-fetch": "^4.0.0",
"mongodb-memory-server": "^9.1.7",
"nodemon": "^3.1.0",
"prettier": "^3.2.5",
"prettier-2": "npm:prettier@^2.8.8",
"mongodb-memory-server": "^9.4.0",
"nodemon": "^3.1.4",
"prettier": "^3.3.2",
"ts-node": "^10.9.2",
"typescript": "^5.4.3",
"typescript": "^5.5.3",
"vitest": "^1.6.0"
},
"packageManager": "pnpm@9.3.0+sha512.ee7b93e0c2bd11409c6424f92b866f31d3ea1bef5fbe47d3c7500cdc3c9668833d2e55681ad66df5b640c61fa9dc25d546efa54d76d7f8bf54b13614ac293631"
"packageManager": "pnpm@9.4.0+sha512.f549b8a52c9d2b8536762f99c0722205efc5af913e77835dbccc3b0b0b2ca9e7dc8022b78062c17291c48e88749c70ce88eb5a74f1fa8c4bf5e18bb46c8bd83a"
}
Loading

0 comments on commit 5b1517e

Please # to comment.