sudo apt-get update
sudo apt-get install apache2
| -- Create a group | |
| CREATE ROLE readaccess; | |
| -- Grant access to existing tables | |
| GRANT USAGE ON SCHEMA public TO readaccess; | |
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
| -- Grant access to future tables | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: simple-express-js-server | |
| spec: | |
| replicas: 1 | |
| selector: | |
| matchLabels: | |
| app: simple-express-js-server | |
| template: |
| # using base image with node version 12 installed | |
| FROM node:12 | |
| # Create working app directory | |
| WORKDIR /usr/src/app | |
| # copy packages | |
| # Install app dependencies | |
| COPY package*.json ./ | |
| RUN npm install | |
| const express = require("express") | |
| const app = express() | |
| app.get("/", function(req, res) { | |
| res.send("Hello World") | |
| }) | |
| app.listen(3000, function(req,res){ | |
| console.log("App is listening at port : 3000! ") | |
| }) |
| apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 | |
| kind: Deployment # What kind of object you want to create | |
| metadata: | |
| name: simple-express-js-server | |
| spec: | |
| replicas: 1 # tells deployment to run 1 pods matching the template | |
| selector: | |
| matchLabels: | |
| app: simple-express-js-server | |
| template: # content from this line is pod spec , which image to use, lables for the pods , and the container info |
| apiVersion: v1 | |
| kind: Service # What kind of object you want to create | |
| metadata: | |
| name: simple-express-js-server | |
| spec: | |
| selector: | |
| app: simple-express-js-server | |
| ports: | |
| - port: 80 | |
| targetPort: 3000 |