Skip to content

Commit 4dbc0c7

Browse files
committed
Remove travis with github actions
Deploy to DO k8s
1 parent 14520bc commit 4dbc0c7

File tree

6 files changed

+160
-11
lines changed

6 files changed

+160
-11
lines changed

.github/dependabot.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
day: friday
8+
time: "18:00"
9+
timezone: Europe/Madrid
10+
open-pull-requests-limit: 10
11+
- package-ecosystem: docker
12+
directory: "/"
13+
schedule:
14+
interval: weekly
15+
day: friday
16+
time: "18:00"
17+
timezone: Europe/Madrid
18+
open-pull-requests-limit: 10

.github/workflows/push.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Backend Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Build and push Frotnend image
17+
uses: docker/build-push-action@v1
18+
with:
19+
username: hugo19941994
20+
password: ${{ secrets.DOCKER_PASSWORD }}
21+
repository: hugo19941994/moviepepper-backend
22+
tags: latest
23+
24+
- name: Install doctl
25+
uses: digitalocean/action-doctl@v2
26+
with:
27+
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
28+
29+
- name: Save DigitalOcean kubeconfig
30+
run: doctl kubernetes cluster kubeconfig save k8s-1-18-6-do-0-lon1-1595844489030
31+
32+
- name: Deploy to DigitalOcean Kubernetes
33+
run: kubectl apply -f manifest.yaml
34+
35+
- name: Deploy to DigitalOcean Kubernetes
36+
run: kubectl rollout restart deployment/moviepepper-backend
37+
38+
- name: Verify deployment
39+
run: kubectl rollout status deployment/moviepepper-backend
40+
41+

.github/workflows/test.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Backend CI
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
matrix:
11+
python-version: [3.8.x]
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Use Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v2
19+
with:
20+
node-version: ${{ matrix.python-version }}
21+
22+
- name: Install pipenv
23+
run: sudo pip install pipenv
24+
25+
- name: Install dependencies using Pipenv
26+
run: pipenv install --deploy --system
27+
28+
- name: Download deps
29+
run: |
30+
python -m textblob.download_corpora
31+
python -m nltk.downloader stopwords
32+
33+
- name: Test moviepepper-backend
34+
run: |
35+
coverage run --concurrency=multiprocessing tests.py
36+
coverage combine
37+
coveralls
38+
env:
39+
CI: true
40+
41+

.travis.yml

-11
This file was deleted.

Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM python:3.8-slim
2+
3+
RUN pip install pipenv
4+
5+
WORKDIR /app
6+
COPY Pipfile* /app/
7+
8+
RUN pipenv install --system
9+
10+
COPY . /app/
11+
12+
# 1 scrape
13+
WORKDIR /app/movie_scrape
14+
RUN START_URL="http://www.imdb.com/search/title?groups=top_1000&sort=user_rating,desc&page=1&ref" ./scrap.sh
15+
16+
# 2 Calculate recommendations
17+
WORKDIR /app
18+
RUN python tfidf-lsa.py
19+
RUN python doc2vec.py
20+
21+
# 3 Serve server
22+
CMD python server.py
23+

manifest.yaml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
kind: Service
3+
apiVersion: v1
4+
metadata:
5+
name: moviepepper-backend
6+
spec:
7+
type: NodePort
8+
selector:
9+
app: moviepepper-backend
10+
ports:
11+
- name: http
12+
protocol: TCP
13+
port: 80
14+
targetPort: 3000
15+
---
16+
apiVersion: apps/v1
17+
kind: Deployment
18+
metadata:
19+
name: moviepepper-backend
20+
spec:
21+
replicas: 2
22+
selector:
23+
matchLabels:
24+
app: moviepepper-backend
25+
template:
26+
metadata:
27+
labels:
28+
app: moviepepper-backend
29+
spec:
30+
containers:
31+
- name: moviepepper-backend
32+
image: hugo19941994/moviepepper-backend
33+
ports:
34+
- containerPort: 5000
35+
protocol: TCP
36+
37+

0 commit comments

Comments
 (0)