This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.3" | |
services: | |
nextjs: | |
ports: | |
- 8080:8080 | |
build: | |
context: . | |
dockerfile: Dockerfile | |
volumes: | |
- ./:/var/movable/app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "next-app", | |
"version": "0.1.0", | |
"private": true, | |
"scripts": { | |
"dev": "next dev", | |
"build": "next build", | |
"start": "next start", | |
"start_prod": "NODE_ENV=production node server.js -p $PORT" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:12 | |
ENV PORT 3000 | |
# Create app directory | |
RUN mkdir /var/movable/ && mkdir /var/movable/app | |
WORKDIR /var/movable/app | |
RUN rm -rf .next* | |
# Installing dependencies |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const next = require("next"); | |
const port = parseInt(process.env.PORT, 10) || 3000; | |
const dev = process.env.NODE_ENV !== "production"; | |
const app = next({ dev }); | |
const handle = app.getRequestHandler(); | |
app | |
.prepare() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ansible-playbook -i /opt/docker/hosts /opt/docker/ansible_scripts/create-and-push-image.yml; | |
ansible-playbook -i /opt/docker/hosts /opt/docker/kubernetes-nodejs-deployment.yml; | |
ansible-playbook -i /opt/docker/hosts /opt/docker/kubernetes-nginx-service.yml; | |
ansible-playbook -i /opt/docker/hosts /opt/docker/kubernetes-nginx-service.yml; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fragment RegularPostResponse on PostResponse{ | |
errors{ | |
...RegularPostError | |
}, | |
post{ | |
...RegularPost | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fragment RegularPostError on PostFieldError{ | |
field | |
message | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssr - | |
browser -> next.js -> graphql api | |
client side - | |
browser -> graphql -> api | |
Conclusion - Need to send cookies from next.js to the server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let unix_timestamp = 1599629512236 | |
// Create a new JavaScript Date object based on the timestamp | |
// multiplied by 1000 so that the argument is in milliseconds, not seconds. | |
var date = new Date(unix_timestamp); | |
// Hours part from the timestamp | |
var hours = date.getHours(); | |
var day = date.getDate(); | |
// Minutes part from the timestamp | |
var minutes = "0" + date.getMinutes(); | |
// Seconds part from the timestamp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Remove Java 1.7 | |
yum remove java-1.7.0* | |
#Install Java 1.8* | |
yum install java-1.8* | |
#Setup the jre path - | |
find /usr/lib/jvm/java-1.8* | head -n 3 | |
#Open the bash file |