Skip to content

Instantly share code, notes, and snippets.

Avatar

Suprith Reddy suprith-s-reddy

View GitHub Profile
@suprith-s-reddy
suprith-s-reddy / nginx.conf
Created Sep 19, 2020
Prerender nginx.conf file for SPAs+
View nginx.conf
server {
listen 3000;
# server_name example.com;
root /usr/share/nginx/html;
index index.html index.htm;
location / {
proxy_set_header X-Prerender-Token "YOUR PRERENDER IO TOKEN GOES HERE";
set $prerender 0;
if ($http_user_agent ~* "googlebot|apis-google|mediapartners-google|adsbot|bingbot|yandex|baiduspider|twitterbot|facebookexternalhit|rogerbot|linkedinbot|embedly|quora link preview|showyoubot|outbrain|pinterest\/0\.|pinterestbot|slackbot|vkShare|W3C_Validator|whatsapp|facebot") {
set $prerender 1;
@suprith-s-reddy
suprith-s-reddy / sitemapGenerator
Created Sep 19, 2020
sitemap generation for SPAs using webpack
View sitemapGenerator
const axios = require('axios');
const fs = require('fs')
const routes = require('../common/routes')
async function generateSitemap () {
let links = []
links = getVueRoutes()
// const blogsSlugsRes = await getBlogsSlugs();
// links = links.concat(blogSlugs.data.data); writeSlugsToSitemap(links)
};
function getVueRoutes () {
@suprith-s-reddy
suprith-s-reddy / ingress-service.yml
Created Apr 28, 2020
Kubernetes ingress service for vue application
View ingress-service.yml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: ingress-service
namespace: default
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
@suprith-s-reddy
suprith-s-reddy / web-client-ip-service.yml
Created Apr 28, 2020
Kubernetes client IP service for vue application
View web-client-ip-service.yml
apiVersion: v1
kind: Service
metadata:
name: web
spec:
selector:
app: web
ports:
- port: 3000
targetPort: 3000
@suprith-s-reddy
suprith-s-reddy / web-deployment.yml
Created Apr 28, 2020
Kubernetes deployment yaml for vue application
View web-deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
spec:
selector:
matchLabels:
app: web
template:
metadata:
@suprith-s-reddy
suprith-s-reddy / Dockerfile
Last active Apr 28, 2020
Vue app production dockerfile
View Dockerfile
# use node alpine
FROM node:13.11.0-alpine as builder
# set the working directory in the container
WORKDIR /app
# COPY the package json and package json lock files
COPY package*.json ./
# perform npm install
@suprith-s-reddy
suprith-s-reddy / default.conf
Last active Apr 28, 2020
Nginx conf for vue app
View default.conf
server {
listen 3000;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
}