Skip to content

Commit

Permalink
Add NodeJs and Golang
Browse files Browse the repository at this point in the history
  • Loading branch information
mmuniraju4444 committed Jun 7, 2020
1 parent 0cb3941 commit 5f3035e
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ CADVISOR_VER=latest
COMPOSER_VER=1.8.5
SONARQUBE_VER=7.1
BROWSERLESS_VER=latest
NODEJS_VER=12.16.3
GOLANG_VER=1.13.7
########### END CONTAINER VERSIONS ##########

########### INSTALL PHP EXTENSION ###########
Expand All @@ -32,4 +34,5 @@ HOST2=example2.com
HOST3=example3.com
HOST4=example4.com
HOST5=example5.com
HOST6=example6.com
############# END EXTRA HOST ############
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/docker-compose.yml
/.idea
/.idea/*
.DS_Store
1 change: 1 addition & 0 deletions GoLang/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GOPATH=/go
1 change: 1 addition & 0 deletions GoLang/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.env
4 changes: 4 additions & 0 deletions GoLang/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARG CONTAINER_VERSION=${CONTAINER_VERSION}
FROM golang:${CONTAINER_VERSION}-alpine3.11

WORKDIR /usr/src/app
3 changes: 2 additions & 1 deletion Nginx/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/.env
/.env
/conf/app.conf
23 changes: 23 additions & 0 deletions Nginx/conf/app.conf → Nginx/conf/example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,26 @@ server {
proxy_cache_bypass $http_upgrade;
}
}

server {
listen 80;
server_name mmtinyurl.local;

location /api {
proxy_pass http://mmtinyurl-backend:8080/api;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}

location / {
proxy_pass http://mmtinyurl:3001;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
3 changes: 3 additions & 0 deletions NodeJs/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
NODE_ENV=development
CHOKIDAR_USEPOLLING=true
PORT=3001
1 change: 1 addition & 0 deletions NodeJs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.env
4 changes: 4 additions & 0 deletions NodeJs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARG CONTAINER_VERSION=${CONTAINER_VERSION}
FROM node:${CONTAINER_VERSION}-alpine3.11
CMD npm start
#ENTRYPOINT ["npm", "start"]
1 change: 1 addition & 0 deletions Supervisor/config/supervisord.pid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
42 changes: 42 additions & 0 deletions docker-compose.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ services:
- "${HOST3}:${HOST_IP}"
- "${HOST4}:${HOST_IP}"
- "${HOST5}:${HOST_IP}"
- "${HOST6}:${HOST_IP}"

# CADVISOR
cadvisor :
Expand Down Expand Up @@ -106,6 +107,7 @@ services:
- "${HOST3}:${HOST_IP}"
- "${HOST4}:${HOST_IP}"
- "${HOST5}:${HOST_IP}"
- "${HOST6}:${HOST_IP}"
depends_on:
- php-fpm
- mariadb-master
Expand Down Expand Up @@ -245,6 +247,7 @@ services:
- "${HOST3}:${HOST_IP}"
- "${HOST4}:${HOST_IP}"
- "${HOST5}:${HOST_IP}"
- "${HOST6}:${HOST_IP}"
volumes:
- ./Source:/var/www/html
- ./Supervisor/config:/etc/supervisor/config
Expand All @@ -264,3 +267,42 @@ services:
- "${HOST3}:${HOST_IP}"
- "${HOST4}:${HOST_IP}"
- "${HOST5}:${HOST_IP}"
- "${HOST6}:${HOST_IP}"

# NodeJs
mmtinyurl:
build:
context: ./NodeJs
dockerfile: Dockerfile
args:
- CONTAINER_VERSION=${NODEJS_VER}
working_dir: /var/www/html/urlshortner
tty: true
command: "npm start"
volumes:
- ./Source:/var/www/html
env_file:
- ./NodeJs/.env
extra_hosts:
- "${HOST1}:${HOST_IP}"
- "${HOST2}:${HOST_IP}"
- "${HOST3}:${HOST_IP}"
- "${HOST4}:${HOST_IP}"
- "${HOST5}:${HOST_IP}"
- "${HOST6}:${HOST_IP}"

# GoLang
mmtinyurl-backend:
build:
context: ./GoLang
dockerfile: Dockerfile
args:
- CONTAINER_VERSION=${GOLANG_VER}
volumes:
- ./Source/urlshortner-backend:/usr/src/app
command: "go run app.go"
tty: true
ports:
- 8084:8080
env_file:
- ./GoLang/.env

0 comments on commit 5f3035e

Please sign in to comment.