Skip to content

Commit

Permalink
Update docker and queue
Browse files Browse the repository at this point in the history
  • Loading branch information
ttmx committed May 6, 2024
1 parent efb4e4f commit ef06053
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 42 deletions.
42 changes: 13 additions & 29 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ services:
image: ghcr.io/carrismetropolitana/api-server:beta
restart: unless-stopped
logging:
options:
max-size: '1m'
max-file: '1'
driver: none
environment:
- SERVERDB_HOST=serverdb
# - MONGODB_URI=mongodb://mongodbuser:mongodbpassword@localhost:27017/production?authSource=admin
Expand All @@ -87,22 +85,13 @@ services:
networkdb:
condition: service_healthy

ports:
- "5050:5050"
healthcheck:
test: ["CMD-SHELL","wget -O - http://localhost:5050/timetables | wc -c | grep -q -E '^([0-9]{2,}|1[0-9]{2,}|200)$$' || exit 1"]
interval: 10s
timeout: 30s
retries: 500000
start_period: 10s


# # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # #

parse-network:
image: ghcr.io/carrismetropolitana/api-parse-network:beta
restart: unless-stopped
restart: "no"
logging:
options:
max-size: '1m'
Expand All @@ -112,8 +101,9 @@ services:
- NETWORKDB_HOST=networkdb
- NETWORKDB_USER=networkdbuser
- NETWORKDB_PASSWORD=networkdbpassword
# - GTFS_URL=https://github.com/carrismetropolitana/gtfs/raw/live/CarrisMetropolitana.zip
- GTFS_URL=https://storage.carrismetropolitana.pt/static/gtfs/20240417_41_YEAR_02_28_03.zip
- SINGLE_RUN=true
- GTFS_URL=https://github.com/carrismetropolitana/gtfs/raw/live/CarrisMetropolitana.zip
# - GTFS_URL=https://storage.carrismetropolitana.pt/static/gtfs/GTFS_a4_ref_20240502.zip
depends_on:
- serverdb
- networkdb
Expand Down Expand Up @@ -155,23 +145,17 @@ services:
max-file: '1'
environment:
- API_URL=http://api:5050
healthcheck:
test: curl -f http://localhost:5052/ready || exit 1
interval: 5s
timeout: 9000s
retries: 100000
start_period: 30s
ports:
- "5052:5052"
# ports:
# - "5052:5052"
depends_on:
api:
condition: service_healthy
parse-network:
condition: service_completed_successfully

pdf-printer:
build:
context: ./printer
dockerfile: Dockerfile
restart: unless-stopped
restart: "no"
logging:
options:
max-size: '1m'
Expand All @@ -182,7 +166,7 @@ services:
- RENDER_URL=http://pdf-renderer:3000/schedule
- QUEUE_URL=http://queue:5052
depends_on:
pdf-renderer:
condition: service_healthy
parse-network:
condition: service_completed_successfully
queue:
condition: service_healthy
condition: service_started
3 changes: 2 additions & 1 deletion printer/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
README.md
*.zip
3 changes: 2 additions & 1 deletion printer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ yarn-error.log*
next-env.d.ts

/pdfs
*.pdf
*.pdf
*.zip
10 changes: 0 additions & 10 deletions printer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ RUN npm --omit=dev install
ARG CACHEBUST=1
RUN npm install puppeteer

# Add pptr user.
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \
&& mkdir -p /home/pptruser/Downloads \
&& chown -R pptruser:pptruser /home/pptruser \
&& chown -R pptruser:pptruser /app \
&& mkdir -p /output/jobsdata/pdfs \
&& chown -R pptruser:pptruser /output/jobsdata/pdfs/ \
&& chmod -R 777 /output/jobsdata/pdfs/


# Run user as non privileged.
# USER pptruser

Expand Down
2 changes: 1 addition & 1 deletion queue-manager/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function main() {
if (i % LOG_EVERY === 0) {
let currentTime = process.hrtime.bigint();
// log how many items per second we are processing since last log
console.log(`${String(i).padStart(String(queue.length).length)}/${queue.length} @ ${(LOG_EVERY / (Number(currentTime - startTime) / 1e9)).toFixed(2)} pdfs/s`);
console.log(`${String(i).padStart(String(queue.length + i).length)}/${queue.length + i} @ ${(LOG_EVERY / (Number(currentTime - startTime) / 1e9)).toFixed(2)} pdfs/s`);
startTime = currentTime;
}
i++;
Expand Down

0 comments on commit ef06053

Please sign in to comment.