-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathINSTALL
45 lines (38 loc) · 1.57 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#### smartcharge.dev local installation instructions
### PostgreSQL Server
## install on windows:
# download from https://www.postgresql.org/download/windows/
## install on mac:
brew install postgresql
brew services start postgresql
### setup
# add the server user
psql postgres -c "CREATE USER scserver WITH LOGIN PASSWORD 'scserverpass'; COMMENT ON ROLE scserver IS 'smartcharge.dev server user';"
# create the server database (for windows installation, use "en-US" instead of "en_US.utf-8")
psql postgres -c "CREATE DATABASE smartcharge WITH OWNER scserver ENCODING UTF8 LC_COLLATE 'en_US.utf-8' LC_CTYPE 'en_US.utf-8' TEMPLATE template0;"
# set our default schema
psql postgres -c "ALTER ROLE scserver IN DATABASE smartcharge SET search_path TO scserver;"
# grant?
psql postgres -c "GRANT ALL PRIVILEGES ON DATABASE smartcharge TO scserver;"
## create an .env file to override default configuration, for example:
cat >.env <<EOL
# DATABASE_URL=postgres://scserver:scserverpass@localhost:5432/smartcharge
# DATABASE_SSL=false
SERVER_IP=127.0.0.1
SERVER_PORT=80
SINGLE_USER_PASSWORD=secret
EOL
### build
npm run build
### start the server
npm run start:server
# or
node dist/server/server.js
# at first startup the server will populate the database and generate
# a unique INTERNAL_SERVICE_TOKEN, you need to save this token to
# configure the worker process, add the following line to your .env file
INTERNAL_SERVICE_TOKEN=your_token
### start the worker
npm run start:worker
# or if you running on different token, server or port
node dist/server/agency.js -d your_token http://10.0.0.2:80