diff --git a/LyricsPy/K8S/lyrics-deployment.yaml b/LyricsPy/K8S/lyrics-deployment.yaml new file mode 100644 index 0000000..dd55140 --- /dev/null +++ b/LyricsPy/K8S/lyrics-deployment.yaml @@ -0,0 +1,53 @@ +apiVersion: v1 +kind: Service +metadata: + name: lyrics +spec: + type: NodePort + ports: + - name: http + port: 5000 + nodePort: 30338 + targetPort: lyrics + selector: + app: lyrics +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: lyrics + labels: + app: lyrics +spec: + replicas: 1 + selector: + matchLabels: + app: lyrics + strategy: + type: Recreate + template: + metadata: + labels: + app: lyrics + spec: + containers: + - args: + - gunicorn + - --bind + - 0.0.0.0:5000 + - lyrics:create_app() + image: creylopez/lyrics:2.0 + name: lyrics + ports: + - containerPort: 5000 + name: lyrics + resources: {} + volumeMounts: + - mountPath: /lyrics/instance + name: lyrics-prod + restartPolicy: Always + volumes: + - name: lyrics-prod + persistentVolumeClaim: + claimName: lyrics-prod +status: {} diff --git a/LyricsPy/K8S/lyrics-prod-persistentvolumeclaim.yaml b/LyricsPy/K8S/lyrics-prod-persistentvolumeclaim.yaml new file mode 100644 index 0000000..0e7fbfe --- /dev/null +++ b/LyricsPy/K8S/lyrics-prod-persistentvolumeclaim.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + creationTimestamp: null + labels: + io.kompose.service: lyrics-prod + name: lyrics-prod +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Mi +status: {} diff --git a/LyricsPy/K8S/pv-local-lyrics.yaml b/LyricsPy/K8S/pv-local-lyrics.yaml new file mode 100644 index 0000000..98e2fcc --- /dev/null +++ b/LyricsPy/K8S/pv-local-lyrics.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: lyrics-app-folder + labels: + app: lyrics +spec: + capacity: + storage: 100Mi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/Externo/lyrics" + diff --git a/LyricsPy/servicios/creaImagen.sh b/LyricsPy/servicios/creaImagen.sh new file mode 100644 index 0000000..db880e6 --- /dev/null +++ b/LyricsPy/servicios/creaImagen.sh @@ -0,0 +1,3 @@ +docker build --no-cache -t creylopez/lyrics:2.0 . +docker push creylopez/lyrics:2.0 + diff --git a/LyricsPy/servicios/lyrics/paginas.py b/LyricsPy/servicios/lyrics/paginas.py index d87a14f..56fc964 100644 --- a/LyricsPy/servicios/lyrics/paginas.py +++ b/LyricsPy/servicios/lyrics/paginas.py @@ -24,11 +24,11 @@ def add_song(): pista = request.form['pista'] - new_song = Song(title=title, author=author, album_id=album_id, lyrics=lyrics) + new_song = Song(title=title, author=author, album_id=album_id, lyrics=lyrics, pista=pista) db.session.add(new_song) db.session.commit() - return redirect(url_for('index')) + return redirect(url_for('paginas.index')) albums = Album.query.all() return render_template('add_song.html', albums=albums) @@ -44,7 +44,7 @@ def add_album(): db.session.add(new_album) db.session.commit() - return redirect(url_for('index')) + return redirect(url_for('paginas.index')) return render_template('add_album.html')