File tree 3 files changed +52
-5
lines changed
packages/adapter-postgres
3 files changed +52
-5
lines changed Original file line number Diff line number Diff line change 1
1
const path = require ( 'path' ) ;
2
- const serviceName = path . basename ( __dirname ) ;
2
+ const namePrefix = path . basename ( __dirname ) ;
3
3
4
4
module . exports = {
5
5
apps : [ {
6
- name : serviceName ,
6
+ name : ` ${ namePrefix } -agent` ,
7
7
script : 'pnpm start' ,
8
8
instances : 1 ,
9
9
autorestart : true ,
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ postgres=>
2
2
-- create user
3
3
CREATE USER eliza WITH PASSWORD ' your_password' ;
4
4
5
+ -- add CREATEDB permission to database user
6
+ ALTER USER eliza WITH CREATEDB;
7
+
5
8
-- switch to eliza role
6
9
SET ROLE eliza;
7
10
@@ -22,9 +25,6 @@ GRANT ALL PRIVILEGES ON DATABASE eliza TO eliza;
22
25
GRANT USAGE ON SCHEMA public TO eliza;
23
26
GRANT CREATE ON SCHEMA public TO eliza;
24
27
25
- -- add CREATEDB permission to database user
26
- ALTER USER eliza WITH CREATEDB;
27
-
28
28
-- grant all permissions to specific schema (usually public)
29
29
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO eliza;
30
30
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO eliza;
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # switch to project root directory
4
+ cd " $( dirname " $0 " ) /.."
5
+
6
+ # load service port configurations from .env file
7
+ if [ -f .env ]; then
8
+ echo " Loading service port configurations from .env file..."
9
+ export $( cat .env | grep " SERVER_PORT" | grep -v ' ^#' | xargs)
10
+ else
11
+ echo " Warning: .env file not found!"
12
+ fi
13
+
14
+ # get project name prefix
15
+ namePrefix=$( basename $( pwd) )
16
+ if [ ! -z " $APP_PREFIX " ]; then
17
+ namePrefix=$APP_PREFIX
18
+ fi
19
+
20
+
21
+ cleanup_port () {
22
+ # if get port failed, return directly
23
+ if [ -z " $SERVER_PORT " ]; then
24
+ echo " Skipping port cleanup for $service due to port not found"
25
+ return
26
+ fi
27
+
28
+ echo " Checking port $SERVER_PORT "
29
+
30
+ # find process using this port
31
+ # pid can only get the first line of losf value
32
+ local pid=$( lsof -ti:$SERVER_PORT | head -n 1)
33
+ if [ ! -z " $pid " ]; then
34
+ echo " Found process $pid using port $SERVER_PORT , killing it..."
35
+ kill -9 $pid
36
+ sleep 1
37
+ fi
38
+ }
39
+
40
+
41
+ echo " Stopping agent..."
42
+ pm2 stop " ${namePrefix} -agent" | grep " ${namePrefix} -agent"
43
+ sleep 2
44
+ cleanup_port
45
+
46
+ echo " Starting agent..."
47
+ pm2 start " ${namePrefix} -agent"
You can’t perform that action at this time.
0 commit comments