Skip to content

Commit

Permalink
Remove travis with github actions
Browse files Browse the repository at this point in the history
Deploy to DO k8s
  • Loading branch information
hugo19941994 committed Jul 28, 2020
1 parent 14520bc commit 159ab90
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 11 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
day: friday
time: "18:00"
timezone: Europe/Madrid
open-pull-requests-limit: 10
- package-ecosystem: docker
directory: "/"
schedule:
interval: weekly
day: friday
time: "18:00"
timezone: Europe/Madrid
open-pull-requests-limit: 10
41 changes: 41 additions & 0 deletions .github/workflows/push.yml
@@ -0,0 +1,41 @@
name: Backend Deployment

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build and push Frotnend image
uses: docker/build-push-action@v1
with:
username: hugo19941994
password: ${{ secrets.DOCKER_PASSWORD }}
repository: hugo19941994/moviepepper-backend
tags: latest

- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

- name: Save DigitalOcean kubeconfig
run: doctl kubernetes cluster kubeconfig save k8s-1-18-6-do-0-lon1-1595844489030

- name: Deploy to DigitalOcean Kubernetes
run: kubectl apply -f manifest.yaml

- name: Deploy to DigitalOcean Kubernetes
run: kubectl rollout restart deployment/moviepepper-backend

- name: Verify deployment
run: kubectl rollout status deployment/moviepepper-backend


41 changes: 41 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,41 @@
name: Backend CI

on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3.8.x]

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Use Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
node-version: ${{ matrix.python-version }}

- name: Install pipenv
run: sudo pip install pipenv

- name: Install dependencies using Pipenv
run: pipenv install --deploy --system

- name: Download deps
run: |
python -m textblob.download_corpora
python -m nltk.downloader stopwords
- name: Test moviepepper-backend
run: |
coverage run --concurrency=multiprocessing tests.py
coverage combine
coveralls
env:
CI: true


11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

23 changes: 23 additions & 0 deletions Dockerfile
@@ -0,0 +1,23 @@
FROM python:3.8-alpine

RUN pip install pipenv

WORKDIR /app
COPY Pipfile* /app/

RUN pipenv install --system

COPY . /app/

# 1 scrape
WORKDIR /app/movie_scrape
RUN START_URL="http://www.imdb.com/search/title?groups=top_1000&sort=user_rating,desc&page=1&ref" ./scrap.sh

# 2 Calculate recommendations
WORKDIR /app
RUN python tfidf-lsa.py
RUN python doc2vec.py

# 3 Serve server
CMD python server.py

37 changes: 37 additions & 0 deletions manifest.yaml
@@ -0,0 +1,37 @@
---
kind: Service
apiVersion: v1
metadata:
name: moviepepper-backend
spec:
type: NodePort
selector:
app: moviepepper-backend
ports:
- name: http
protocol: TCP
port: 80
targetPort: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: moviepepper-backend
spec:
replicas: 2
selector:
matchLabels:
app: moviepepper-backend
template:
metadata:
labels:
app: moviepepper-backend
spec:
containers:
- name: moviepepper-backend
image: hugo19941994/moviepepper-backend
ports:
- containerPort: 5000
protocol: TCP


0 comments on commit 159ab90

Please sign in to comment.