create-aomex 0.0.31 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/.dockerignore +4 -0
- package/templates/docker-compose-integration.yml +2 -3
- package/templates/docker-compose-production.yml +2 -3
- package/templates/scripts/build-in-docker.sh +0 -2
- package/templates/scripts/deploy.sh +8 -7
- package/templates/src/services/cache.service.ts +8 -7
package/package.json
CHANGED
package/templates/.dockerignore
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
services:
|
|
2
2
|
migration:
|
|
3
3
|
image: {{projectName}}:integration
|
|
4
|
-
command: prisma migrate deploy
|
|
4
|
+
command: npx prisma migrate deploy
|
|
5
5
|
api:
|
|
6
6
|
image: {{projectName}}:integration
|
|
7
7
|
restart: always
|
|
@@ -9,5 +9,4 @@ services:
|
|
|
9
9
|
- 3000:3000
|
|
10
10
|
cron:
|
|
11
11
|
image: {{projectName}}:integration
|
|
12
|
-
|
|
13
|
-
command: aomex cron:start
|
|
12
|
+
command: npx aomex cron:start
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
services:
|
|
2
2
|
migration:
|
|
3
3
|
image: {{projectName}}:production
|
|
4
|
-
command: prisma migrate deploy
|
|
4
|
+
command: npx prisma migrate deploy
|
|
5
5
|
api:
|
|
6
6
|
image: {{projectName}}:production
|
|
7
7
|
restart: always
|
|
@@ -9,5 +9,4 @@ services:
|
|
|
9
9
|
- 3000:3000
|
|
10
10
|
cron:
|
|
11
11
|
image: {{projectName}}:production
|
|
12
|
-
|
|
13
|
-
command: aomex cron:start
|
|
12
|
+
command: npx aomex cron:start
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
set -ex
|
|
4
4
|
|
|
5
5
|
env="$1"
|
|
6
|
-
|
|
6
|
+
project_name="{{projectName}}"
|
|
7
|
+
docker_compose_file="docker-compose-$env.yml"
|
|
7
8
|
|
|
8
|
-
sudo docker build --tag "$
|
|
9
|
+
sudo docker build --tag "$project_name:$env" --file "Dockerfile.$env" .
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if [ -n "$container_exist" ];
|
|
11
|
+
cron_service_name=cron
|
|
12
|
+
if [ -n "$(sudo docker compose --file $docker_compose_file ps | { grep $cron_service_name || :; })" ]
|
|
13
13
|
then
|
|
14
|
-
|
|
14
|
+
# exit 137 SIGKILL
|
|
15
|
+
{ sudo docker compose --file $docker_compose_file exec -it $cron_service_name /bin/sh -c "npx aomex cron:stop" || :; }
|
|
15
16
|
fi
|
|
16
17
|
|
|
17
|
-
sudo docker compose --file
|
|
18
|
+
sudo docker compose --file $docker_compose_file up -d --timeout=1 --remove-orphans
|
|
@@ -3,22 +3,23 @@ import { Caching } from '@aomex/cache';
|
|
|
3
3
|
import { redisAdapter } from '@aomex/cache-redis-adapter';
|
|
4
4
|
import { configs } from '@configs';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const cache = new Caching(redisAdapter(configs.redis));
|
|
7
7
|
|
|
8
8
|
export class CacheService extends Service {
|
|
9
|
-
|
|
9
|
+
public readonly instance = cache;
|
|
10
|
+
|
|
11
|
+
protected readonly demoKey = 'demo';
|
|
10
12
|
|
|
11
13
|
getHotRankings() {
|
|
12
|
-
return cache.get<
|
|
14
|
+
return cache.get<DemoItem[]>(this.demoKey, []);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
setHotRankings(value:
|
|
16
|
-
return cache.set(this.
|
|
17
|
+
setHotRankings(value: DemoItem[]) {
|
|
18
|
+
return cache.set(this.demoKey, value, 30_000);
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
interface
|
|
22
|
+
interface DemoItem {
|
|
21
23
|
id: number;
|
|
22
24
|
name: string;
|
|
23
|
-
ranking: number;
|
|
24
25
|
}
|