Skip to content

Commit 21905ec

Browse files
authored
Merge pull request #35 from Georepublic/develop
Preparation of release v0.2.0
2 parents 386a98f + 6ffd8a5 commit 21905ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+14212
-6474
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ indent_size = 2
3737
# .bat files want CRLF
3838
[*.bat]
3939
end_of_line = crlf
40+
41+
[*.js]
42+
indent_style = space
43+
indent_size = 2
44+
45+
[*.html]
46+
indent_style = space
47+
indent_size = 2

.github/workflows/codeql.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# CodeQL Analysis for discovering vulnerabilities
2-
name: 'CodeQL'
2+
name: "CodeQL"
33

44
on:
55
push:
@@ -13,16 +13,16 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
language: ['go']
16+
language: ["go"]
1717

1818
steps:
19-
- name: Checkout repository
20-
uses: actions/checkout@v2
19+
- name: Checkout repository
20+
uses: actions/checkout@v2
2121

22-
- name: Initialize CodeQL
23-
uses: github/codeql-action/init@v1
24-
with:
25-
languages: ${{ matrix.language }}
22+
- name: Initialize CodeQL
23+
uses: github/codeql-action/init@v1
24+
with:
25+
languages: ${{ matrix.language }}
2626

27-
- name: Perform CodeQL Analysis
28-
uses: github/codeql-action/analyze@v1
27+
- name: Perform CodeQL Analysis
28+
uses: github/codeql-action/analyze@v1

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Lint'
1+
name: "Lint"
22

33
on:
44
push:
@@ -24,7 +24,7 @@ jobs:
2424
- name: Install Go
2525
uses: actions/setup-go@v2
2626
with:
27-
go-version: '1.17.x'
27+
go-version: "1.17.x"
2828

2929
- name: Cache Go modules
3030
uses: actions/cache@v2

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*.*.*'
7-
6+
- "v*.*.*"
87

98
jobs:
109
release:
1110
name: Release
1211
runs-on: ubuntu-latest
1312

1413
strategy:
15-
fail-fast: false
14+
fail-fast: false
1615

1716
steps:
1817
- name: Checkout repository
@@ -23,7 +22,7 @@ jobs:
2322
- name: Install Go
2423
uses: actions/setup-go@v2
2524
with:
26-
go-version: '1.17.x'
25+
go-version: "1.17.x"
2726

2827
- name: Get pg_scheduleserv version
2928
run: |
@@ -43,6 +42,7 @@ jobs:
4342
4443
- name: Build
4544
run: |
45+
# Remove debugging informations in the build
4646
go build -ldflags "-s -w"
4747
mv pg_scheduleserv pg_scheduleserv-${PG_SCHEDULESERV_VERSION}
4848
@@ -55,7 +55,7 @@ jobs:
5555
5656
- name: Make Attachments
5757
run: |
58-
grep -Pzo "(?s)## pg_scheduleserv ${PG_SCHEDULESERV_VERSION//./\\.} Release Notes.*?(?=## pg_scheduleserv .\..\.. Release Notes)" NEWS.md | tr '\0' '\n' > release_body.txt
58+
grep -Pzo "(?s)## v${PG_SCHEDULESERV_VERSION//./\\.} Release Notes.*?(?=## v.\..\.. Release Notes)" NEWS.md | tr '\0' '\n' > release_body.txt
5959
echo "**Attachments**" >> release_body.txt
6060
echo "File | Contents" >> release_body.txt
6161
echo "| --- | --- |" >> release_body.txt

.github/workflows/test.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Test'
1+
name: "Test"
22

33
on:
44
push:
@@ -23,8 +23,9 @@ jobs:
2323
echo "PGVER=${PGVER}" >> $GITHUB_ENV
2424
echo "PGPORT=5432" >> $GITHUB_ENV
2525
echo "PGIS=3" >> $GITHUB_ENV
26-
echo "VROOMVER=1.10.0" >> $GITHUB_ENV
27-
echo "VRPVER=0.2.0" >> $GITHUB_ENV
26+
echo "VROOMVER=1.11.0" >> $GITHUB_ENV
27+
echo "VRPVER=0.3.0" >> $GITHUB_ENV
28+
echo "DEVELOP=false" >> $GITHUB_ENV
2829
2930
- name: Add PostgreSQL APT repository
3031
run: |
@@ -74,6 +75,7 @@ jobs:
7475
make
7576
7677
- name: Cache vrpRouting
78+
if: ${{ env.DEVELOP != 'true' }}
7779
id: cache-vrprouting
7880
uses: actions/cache@v2
7981
env:
@@ -84,13 +86,18 @@ jobs:
8486
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.VRPVER }}
8587

8688
- name: Clone vrpRouting
87-
if: steps.cache-vroom.outputs.cache-hit != 'true'
89+
if: steps.cache-vroom.outputs.cache-hit != 'true' || ${{ env.DEVELOP }} == "true"
8890
run: |
89-
wget https://github.com/pgRouting/vrprouting/archive/refs/tags/v${{ env.VRPVER }}.tar.gz -O /tmp/${{ env.VRPVER }}.tar.gz
90-
tar -zvxf /tmp/${{ env.VRPVER }}.tar.gz -C ~/
91-
cd ~/vrprouting-${{ env.VRPVER }}
92-
# TEMP: Adding support for postgresql-14
93-
sed -i 's/PostgreSQL_ADDITIONAL_VERSIONS "12" "13"/PostgreSQL_ADDITIONAL_VERSIONS "12" "13" "14"/' CMakeLists.txt
91+
if [ "${{ env.DEVELOP }}" = true ]; then
92+
git clone --depth 1 https://github.com/pgRouting/vrprouting -b develop
93+
mv vrprouting ~/vrprouting-${{ env.VRPVER }}
94+
else
95+
wget https://github.com/pgRouting/vrprouting/archive/refs/tags/v${{ env.VRPVER }}.tar.gz -O /tmp/${{ env.VRPVER }}.tar.gz
96+
tar -zvxf /tmp/${{ env.VRPVER }}.tar.gz -C ~/
97+
cd ~/vrprouting-${{ env.VRPVER }}
98+
# TEMP: Adding support for postgresql-14
99+
sed -i 's/PostgreSQL_ADDITIONAL_VERSIONS "12" "13"/PostgreSQL_ADDITIONAL_VERSIONS "12" "13" "14"/' CMakeLists.txt
100+
fi
94101
95102
- name: Configure vrpRouting
96103
run: |
@@ -110,7 +117,7 @@ jobs:
110117
- name: Install Go
111118
uses: actions/setup-go@v2
112119
with:
113-
go-version: '1.17.x'
120+
go-version: "1.17.x"
114121

115122
- name: Cache Go modules
116123
uses: actions/cache@v2

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
app.env
22
pg_scheduleserv
33
pg_scheduleserv.exe
4+
node_modules
5+

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,23 @@
2626

2727
# ******************************************************************GRP-GNU-AGPL
2828

29+
app.env:
30+
cp app.env.example app.env
31+
32+
include app.env
33+
2934
migrateup:
30-
migrate -path migrations -database postgres://$(POSTGRES_PASSWORD):$(POSTGRES_PASSWORD)@localhost:$(POSTGRES_PORT)/$(POSTGRES_DB) -verbose up
35+
migrate -path migrations -database postgres://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB) -verbose up
3136
.PHONY: migrateup
3237

3338
migratedown:
34-
migrate -path migrations -database postgres://$(POSTGRES_PASSWORD):$(POSTGRES_PASSWORD)@localhost:$(POSTGRES_PORT)/$(POSTGRES_DB) -verbose down
39+
migrate -path migrations -database postgres://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):$(POSTGRES_PORT)/$(POSTGRES_DB) -verbose down
3540
.PHONY: migratedown
3641

37-
swagger:
42+
doc:
3843
swag init
3944
swagger generate markdown -f docs/swagger.json --output=docs/api.md
40-
.PHONY: swagger
45+
.PHONY: doc
4146

4247
check-mod:
4348
go mod tidy

NEWS.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,41 @@
11
# pg_scheduleserv Release Notes
22

3-
## pg_scheduleserv 0.1.0 Release Notes
3+
## v0.2.0 Release Notes
4+
5+
To see all issues & pull requests closed by this release see the [Git closed milestone for v0.2.0](https://github.com/Georepublic/pg_scheduleserv/issues?q=milestone%3Av0.2.0+) on Github.
6+
7+
### New Features
8+
9+
- #26: Update to `vrprouting v0.3.0` and `vroom v1.11.0`.
10+
- #21: Extend the schedule output to provide metadata and the complete schedule, using optional "overview" query parameter.
11+
- Also extended all API responses to provide message and status code.
12+
- #12: Create a demo application
13+
- #15, #22: Schedule new tasks of a project without changing the schedule of existing tasks, Schedule request with dropping all previous allocations.
14+
- Fresh scheduling (`fresh=true` query parameter in Schedule POST API endpoint):
15+
- Schedule request with dropping all previous allocations.
16+
- Normal scheduling - DEFAULT (`fresh=false` query parameter in Schedule POST API endpoint):
17+
- Schedule request such that previous tasks are not unscheduled, and are shifted by the "max_shift" interval.
18+
- Add "max_shift" field in the projects, with default value of `'00:30:00'::INTERVAL` (30 mins).
19+
- #33: Add "duration_calc" field in projects to choose whether to use OSRM API (2a39915), Valhalla API (23983a4), or Euclidean distance with speed = 9.0 m/sec (3423468) for computing durations.
20+
- d282638: Add "exploration_level" (default = 5) and "timeout" (default = "00:10:00"::INTERVAL) field to projects.
21+
- b313ca2: Enable Cross-Origin Resource Sharing (CORS)- currently, allow all.
22+
- ff48656: Change pgx connection to connection pool for concurrent requests.
23+
- e0e9354, 56a2400, 60490c8: Included time_window as job, shipment(p&d), and break field, instead of separate API endpoint.
24+
- 4b1750f: Remove matrix and project_locations table, so that the durations are calculated only when the schedule is requested.
25+
26+
### Fixes
27+
28+
- 13b4805: Change all fields with INTERVAL to HH:MM:SS format.
29+
- 1ba6d35: Change datetime output from `yyyy-mm-dd hh:tt:ss` to `yyyy-mm-ddThh:tt:ss`.
30+
- b3b5817: Returning 404 NotFound Error instead of empty list when the project/task id is wrong.
31+
- ff35d18: Error in displaying schedule with multiple vehicles.
32+
- 7daa973: Change ical schedule id for start/end entry, to make it a unique entry.
33+
- 3e9bc59: Fix Break List API error, displaying custom error message for DB Errors in Job and Shipment.
34+
- 697c6ec: Change data field in shipment to p_data and d_data.
35+
36+
## v0.1.0 Release Notes
437

538
### New Features
639

7-
* Initial release of `pg_scheduleserv`, that uses `vrprouting v0.2.0` and `vroom v1.10.0`.
8-
* Scheduling of the tasks is done by dropping all the previous allocations.
40+
- Initial release of `pg_scheduleserv`, that uses `vrprouting v0.2.0` and `vroom v1.10.0`.
41+
- Scheduling of the tasks is done by dropping all the previous allocations.

README.md

Lines changed: 63 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<div align="center">
22
<img alt="pg_scheduleserv logo" src="./docs/images/logo.png" width="250px" />
33

4-
# pg_scheduleserv - VRP scheduler over the web
4+
# pg_scheduleserv - VRP scheduler over the web
55

6-
[![Go Reference](https://pkg.go.dev/badge/github.com/Georepublic/pg_scheduleserv.svg)](https://pkg.go.dev/github.com/Georepublic/pg_scheduleserv)
6+
[![Go Reference](https://pkg.go.dev/badge/github.com/Georepublic/pg_scheduleserv.svg)](https://pkg.go.dev/github.com/Georepublic/pg_scheduleserv)
77
[![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/Georepublic/pg_scheduleserv)](https://go.dev/doc/go1.17)
88
[![Go Report Card](https://goreportcard.com/badge/github.com/Georepublic/pg_scheduleserv)](https://goreportcard.com/report/github.com/Georepublic/pg_scheduleserv)
99
[![GitHub Release](https://img.shields.io/github/release/Georepublic/pg_scheduleserv.svg)](https://github.com/Georepublic/pg_scheduleserv/releases)
@@ -17,67 +17,90 @@
1717

1818
A RESTful API Server for scheduling VRP tasks using [vrpRouting](https://github.com/pgRouting/vrprouting), written in [Go](https://golang.org/).
1919

20-
API Documentation: [docs/api.md](./docs/api.md)
20+
API Documentation: [docs/api.md](./docs/api.md)
2121
Release Notes: [NEWS.md](./NEWS.md)
2222

2323
## Status
2424

25-
Service | Main | Develop
26-
--- | --- | ---
27-
Test | [![Test](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/test.yml?query=branch%3Amain) | [![Test](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/test.yml/badge.svg?branch=develop)](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/test.yml?query=branch%3Adevelop)
28-
Lint | [![Lint](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/lint.yml?query=branch%3Amain) | [![Lint](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/lint.yml/badge.svg?branch=develop)](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/lint.yml?query=branch%3Adevelop)
29-
Coverage | [![codecov](https://img.shields.io/codecov/c/github/Georepublic/pg_scheduleserv/main?logo=codecov)](https://app.codecov.io/gh/Georepublic/pg_scheduleserv/branch/main) | [![codecov](https://img.shields.io/codecov/c/github/Georepublic/pg_scheduleserv/develop?logo=codecov)](https://app.codecov.io/gh/Georepublic/pg_scheduleserv/branch/develop)
25+
| Service | Main | Develop |
26+
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27+
| Test | [![Test](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/test.yml?query=branch%3Amain) | [![Test](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/test.yml/badge.svg?branch=develop)](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/test.yml?query=branch%3Adevelop) |
28+
| Lint | [![Lint](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/lint.yml?query=branch%3Amain) | [![Lint](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/lint.yml/badge.svg?branch=develop)](https://github.com/Georepublic/pg_scheduleserv/actions/workflows/lint.yml?query=branch%3Adevelop) |
29+
| Coverage | [![codecov](https://img.shields.io/codecov/c/github/Georepublic/pg_scheduleserv/main?logo=codecov)](https://app.codecov.io/gh/Georepublic/pg_scheduleserv/branch/main) | [![codecov](https://img.shields.io/codecov/c/github/Georepublic/pg_scheduleserv/develop?logo=codecov)](https://app.codecov.io/gh/Georepublic/pg_scheduleserv/branch/develop) |
3030

3131
## Getting Started
3232

3333
### Requirements
3434

35-
- Build Requirements:
36-
- [Go](https://golang.org/) == 1.17
35+
- Build Requirements:
3736

38-
- Usage Requirements:
39-
- [vrpRouting](https://github.com/pgRouting/vrprouting) >= 0.2.0
40-
- [VROOM](https://github.com/VROOM-Project/vroom) >= 1.10.0 is required to build vrpRouting.
41-
- [pgRouting](https://github.com/pgRouting/pgrouting)
42-
- [PostGIS](https://postgis.net/)
43-
- [PostgreSQL](https://www.postgresql.org/)
44-
- C and C++ compilers with C++17 standard support
45-
- The Boost Graph Library (BGL) >= 1.65
46-
- CMake >= 3.12
37+
- [Go](https://golang.org/) == 1.17
38+
39+
- Usage Requirements:
40+
- [vrpRouting](https://github.com/pgRouting/vrprouting) >= 0.3.0
41+
- [VROOM](https://github.com/VROOM-Project/vroom) >= 1.11.0 is required to build vrpRouting.
42+
- [pgRouting](https://github.com/pgRouting/pgrouting)
43+
- [PostGIS](https://postgis.net/)
44+
- [PostgreSQL](https://www.postgresql.org/)
45+
- C and C++ compilers with C++17 standard support
46+
- The Boost Graph Library (BGL) >= 1.65
47+
- CMake >= 3.12
4748

4849
### Download and run
4950

5051
Builds of the latest code can be found in the [releases](https://github.com/Georepublic/pg_scheduleserv/releases).
51-
- Download the latest executable for Linux, say [pg_scheduleserv-0.1.0](https://github.com/Georepublic/pg_scheduleserv/releases/download/v0.1.0/pg_scheduleserv-0.1.0).
52-
- Change permissions to make it an executable: `chmod +x pg_scheduleserv-0.1.0`
53-
- Create `app.env`, and set the values to the environment variables:
54-
- POSTGRES_USER=username
55-
- POSTGRES_PASSWORD=password
56-
- POSTGRES_HOST=localhost
57-
- POSTGRES_PORT=5432
58-
- POSTGRES_DB=scheduler
59-
- SERVER_BIND_ADDRESS=:9100
60-
- Create the tables in the database with the help of the migrations file.
61-
- Run the executable to start the API server on http://localhost:9100
52+
53+
- Download the latest executable for Linux, say [pg_scheduleserv-0.2.0](https://github.com/Georepublic/pg_scheduleserv/releases/download/v0.2.0/pg_scheduleserv-0.2.0).
54+
- Change permissions to make it an executable: `chmod +x pg_scheduleserv-0.2.0`
55+
- Create `app.env`, and set the values to the environment variables:
56+
- POSTGRES_USER=username
57+
- POSTGRES_PASSWORD=password
58+
- POSTGRES_HOST=localhost
59+
- POSTGRES_PORT=5432
60+
- POSTGRES_DB=scheduler
61+
- SERVER_PORT=:9100
62+
- OSRM_URL=https://router.project-osrm.org
63+
- VALHALLA_URL=https://valhalla1.openstreetmap.de
64+
- Create the tables in the database with the help of the migrations file.
65+
- Run the executable to start the API server on http://localhost:9100
6266

6367
### Build from source
6468

6569
All the steps are similar as above, except that the executable will be built from source.
6670

6771
`pg_scheduleserv` is developed using Go 1.17. To build this project from source:
68-
- Ensure that the Go compiler is installed
69-
- Download or clone this repository.
70-
- Copy `app.env.example` to `app.env`, and set the values to the environment variables.
71-
- Apply migrations from the `migrations/000001_init.up.sql` file to the database.
72-
- Run `go build` command inside the directory to create the executable named `pg_scheduleserv`
73-
- Run the executable to start the API server on http://localhost:9100
72+
73+
- Ensure that the Go compiler is installed
74+
- Download or clone this repository.
75+
- Copy `app.env.example` to `app.env`, and set the values to the environment variables.
76+
- Apply migrations from the `migrations/000001_init.up.sql` file to the database.
77+
- Run `go build` command inside the directory to create the executable named `pg_scheduleserv`
78+
- Run the executable to start the API server on http://localhost:9100
7479

7580
### Usage
7681

77-
Any API client can be used to interact with the API server. The API can also be tested using the Swagger documentation. These documenations can be accessed after running the API server on the following URLs:
78-
- Swagger UI: http://localhost:9100
79-
- RapiDoc: http://localhost:9100/rapidoc
80-
- Redoc: http://localhost:9100/redoc
82+
Any API client can be used to interact with the API server. The API can also be tested using the Swagger documentation. Sample deployed API can be found on https://api.udc.pgrouting.org/
83+
84+
These documenations can be accessed after running the API server on the following URLs:
85+
86+
- Swagger UI: http://localhost:9100
87+
- RapiDoc: http://localhost:9100/rapidoc
88+
- Redoc: http://localhost:9100/redoc
89+
90+
![swagger-api](https://user-images.githubusercontent.com/39548570/152192999-1f173519-61a8-4b9b-91f4-ae680f783fe1.png)
91+
92+
### Demo Application
93+
94+
A frontend demo application for the API resides in the `demo` directory. Sample deployed demo application can be found on https://vrpdemo.udc.pgrouting.org/
95+
96+
To run the demo application:
97+
98+
- Change directory to the `demo` directory: `cd demo`
99+
- Make sure that node is installed. Install the other requirements: `npm install`
100+
- Run the application: `node server.js`. The application will run at http://localhost:9101 and will use the API running at http://localhost:9100
101+
- To change the Server Base URL or the OSRM API URL, modify the `js/config.js` file.
102+
103+
![demo-application](https://user-images.githubusercontent.com/39548570/152192932-2fe42d9f-b464-42ec-9a10-47779d087c7e.png)
81104

82105
## LICENSE
83106

app.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ POSTGRES_PASSWORD=password
33
POSTGRES_HOST=localhost
44
POSTGRES_PORT=5432
55
POSTGRES_DB=scheduler
6-
SERVER_BIND_ADDRESS=:9100
6+
SERVER_PORT=:9100
7+
OSRM_URL=https://router.project-osrm.org
8+
VALHALLA_URL=https://valhalla1.openstreetmap.de

0 commit comments

Comments
 (0)