Skip to content

Commit 421ee9e

Browse files
authored
Merge pull request #83 from Zohair-coder/dev
Dev
2 parents bcaaeda + 77c4b35 commit 421ee9e

File tree

21 files changed

+414
-126
lines changed

21 files changed

+414
-126
lines changed

.devcontainer/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM mcr.microsoft.com/devcontainers/python
2+
3+
# set the working directory in the container
4+
WORKDIR /app
5+
6+
# copy the current directory contents into the container at /app
7+
COPY . /app
8+
9+
# upgrade pip
10+
RUN pip install --upgrade pip
11+
12+
# install dependencies
13+
RUN pip install -r requirements.txt
14+
15+
# only for dev container
16+
RUN apt-get update && apt-get install -y postgresql-client
17+
18+
# Run the Python script
19+
CMD ["python3", "src/main.py", "--db", "--all-colleges", "--ratings", "--email"]

.devcontainer/devcontainer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
3+
{
4+
"name": "Drexel Scraper Dev Container",
5+
"dockerComposeFile": [
6+
"../docker-compose.yml",
7+
"docker-compose.yml"
8+
],
9+
"service": "scraper",
10+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
11+
"customizations": {
12+
"vscode": {
13+
"extensions": [
14+
"ms-python.python",
15+
"ms-python.black-formatter"
16+
]
17+
}
18+
}
19+
}

.devcontainer/docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
services:
3+
scraper:
4+
build:
5+
context: .
6+
dockerfile: .devcontainer/Dockerfile
7+
8+
volumes:
9+
- ..:/workspaces:cached
10+
11+
command: /bin/sh -c "while sleep 1000; do :; done"
12+

.github/dependabot.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "devcontainers"
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 0
8+
9+
- package-ecosystem: "docker"
10+
directory: "/"
11+
schedule:
12+
interval: weekly
13+
open-pull-requests-limit: 0
14+
15+
- package-ecosystem: "pip"
16+
directory: "/"
17+
schedule:
18+
interval: weekly
19+
open-pull-requests-limit: 0
20+
21+
- package-ecosystem: "github-actions"
22+
directory: "/"
23+
schedule:
24+
interval: weekly
25+
open-pull-requests-limit: 0

.github/workflows/functional_test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ jobs:
99
name: Functional Test
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
13+
14+
- name: Check code formatting with Black
15+
uses: psf/black@stable
16+
with:
17+
options: "--check --verbose"
18+
src: "./src"
1319

1420
- name: Set up Docker Compose
1521
uses: docker/setup-buildx-action@v3

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ data.json
44
.env
55
postgres-data
66
grafana_data
7-
.vscode
87
trash.py
98
profile_output.pstat
109
callgrind.out.profile

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: main.py",
9+
"type": "debugpy",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/src/main.py",
12+
"console": "integratedTerminal",
13+
"justMyCode": true,
14+
"cwd": "${workspaceFolder}",
15+
"args": ["--ratings"]
16+
// "args": ["--all-colleges"]
17+
// "args": ["--db"]
18+
// "args": ["--ratings", "--db", "--all-colleges"]
19+
// "args": ["--ratings", "--db"]
20+
// "args": ["--email"]
21+
}
22+
]
23+
}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-alpine
1+
FROM python:3.12-alpine
22

33
# set the working directory in the container
44
WORKDIR /app

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ python src/main.py --db --all-colleges --ratings
126126

127127
## Docker
128128

129-
You can also run the scraper in a Docker container. Make sure [Docker](https://docs.docker.com/get-docker/) is installed. Then run the following command to run it:
129+
You can also run the scraper in a Docker container. Make sure [Docker](https://docs.docker.com/get-docker/) is installed. You can then either open up the folder in VS Code as a Dev Container (preferred), or run the following command to run it:
130130

131131
```bash
132132
docker compose up -d --build

docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ services:
88
SCHEDULER_DB_HOSTNAME: postgres
99
SCHEDULER_DB_PORT: 5432
1010
SCHEDULER_DB_PG_PASSWORD: super-secret-password
11+
SNS_ENDPOINT_URL: http://localstack:4566
12+
AWS_DEFAULT_REGION: us-east-1
13+
AWS_ACCESS_KEY_ID: "my-access-key"
14+
AWS_SECRET_ACCESS_KEY: "my-secret-access-key"
1115
volumes:
1216
- ./:/app
1317
depends_on:
1418
- postgres
19+
- localstack
1520

1621
grafana:
1722
image: grafana/grafana-oss
@@ -49,3 +54,16 @@ services:
4954
- DATABASE_URL=postgres://postgres:super-secret-password@postgres:5432/postgres?sslmode=disable
5055
depends_on:
5156
- postgres
57+
58+
# Used to imitate AWS services locally
59+
# We are using SNS in this case for sending error emails
60+
localstack:
61+
image: localstack/localstack
62+
ports:
63+
- "4566:4566"
64+
environment:
65+
- SERVICES=sns
66+
- EDGE_PORT=4566
67+
volumes:
68+
- "/var/run/docker.sock:/var/run/docker.sock"
69+
- "./sns-init-scripts/create-sns-topic.sh:/etc/localstack/init/ready.d/init-aws.sh"

0 commit comments

Comments
 (0)