Skip to content

Commit

Permalink
fix(docker): fix docker-compose for production grade deployments
Browse files Browse the repository at this point in the history
  • Loading branch information
AmruthPillai committed Mar 14, 2022
1 parent e82e714 commit 57f7edc
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 236 deletions.
2 changes: 1 addition & 1 deletion .env.example
Expand Up @@ -11,7 +11,7 @@ POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USERNAME=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DATABASE=reactive_resume
POSTGRES_DATABASE=postgres
POSTGRES_SSL_CERT=

# Auth
Expand Down
32 changes: 20 additions & 12 deletions client/public/sitemap-0.xml
@@ -1,15 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://rxresu.me</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/meta/privacy</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/meta/service</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/de/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/kn/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/ta/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/hi/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/de</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/kn</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/ta</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me/hi</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-12T10:44:13.581Z</lastmod></url>
<url><loc>https://rxresu.me</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/meta/privacy</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/meta/service</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/bn/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/de/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/es/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/fr/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/hi/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/it/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/kn/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/ta/dashboard</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/bn</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/de</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/es</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/fr</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/hi</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/it</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/kn</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
<url><loc>https://rxresu.me/ta</loc><changefreq>monthly</changefreq><priority>0.7</priority><lastmod>2022-03-14T08:00:09.072Z</lastmod></url>
</urlset>
64 changes: 64 additions & 0 deletions docker-compose.dev.yml
@@ -0,0 +1,64 @@
version: '3'

services:
postgres:
image: postgres
container_name: postgres
ports:
- 5432:5432
env_file: .env
volumes:
- ./scripts/database/initialize.sql:/docker-entrypoint-initdb.d/initialize.sql
- pgdata:/var/lib/postgresql/data

traefik:
image: traefik
container_name: traefik
command:
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
ports:
- 80:80
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro

server:
build:
context: .
dockerfile: server/Dockerfile
container_name: server
env_file: .env
environment:
- PUBLIC_URL=http://localhost
- POSTGRES_HOST=postgres
- POSTGRES_DATABASE=reactive_resume
depends_on:
- traefik
- postgres
labels:
- traefik.enable=true
- traefik.http.routers.server.entrypoints=web
- traefik.http.routers.server.rule=Host(`localhost`) && PathPrefix(`/api/`)
- traefik.http.routers.server.middlewares=server-stripprefix
- traefik.http.middlewares.server-stripprefix.stripprefix.prefixes=/api
- traefik.http.middlewares.server-stripprefix.stripprefix.forceslash=true

client:
build:
context: .
dockerfile: client/Dockerfile
container_name: client
env_file: .env
environment:
- PUBLIC_SERVER_URL=http://localhost/api
depends_on:
- traefik
- server
labels:
- traefik.enable=true
- traefik.http.routers.client.rule=Host(`localhost`)
- traefik.http.routers.client.entrypoints=web

volumes:
pgdata:
25 changes: 6 additions & 19 deletions docker-compose.yml
Expand Up @@ -8,7 +8,6 @@ services:
- 5432:5432
env_file: .env
volumes:
- ./scripts/database/initialize.sql:/docker-entrypoint-initdb.d/initialize.sql
- pgdata:/var/lib/postgresql/data

traefik:
Expand All @@ -24,47 +23,35 @@ services:
- /var/run/docker.sock:/var/run/docker.sock:ro

server:
# Production
# image: amruthpillai/reactive-resume:server-latest

# Development
build:
context: .
dockerfile: server/Dockerfile
image: amruthpillai/reactive-resume:server-latest
container_name: server
env_file: .env
environment:
- PUBLIC_URL=http://localhost
- PUBLIC_URL=http://<SERVER-IP>
- POSTGRES_HOST=postgres
depends_on:
- traefik
- postgres
labels:
- traefik.enable=true
- traefik.http.routers.server.entrypoints=web
- traefik.http.routers.server.rule=Host(`localhost`) && PathPrefix(`/api/`)
- traefik.http.routers.server.rule=Host(`<SERVER-IP>`) && PathPrefix(`/api/`)
- traefik.http.routers.server.middlewares=server-stripprefix
- traefik.http.middlewares.server-stripprefix.stripprefix.prefixes=/api
- traefik.http.middlewares.server-stripprefix.stripprefix.forceslash=true

client:
# Production
# image: amruthpillai/reactive-resume:client-latest

# Development
build:
context: .
dockerfile: client/Dockerfile
image: amruthpillai/reactive-resume:client-latest
container_name: client
env_file: .env
environment:
- PUBLIC_SERVER_URL=http://localhost/api
- PUBLIC_SERVER_URL=http://<SERVER-IP>/api
depends_on:
- traefik
- server
labels:
- traefik.enable=true
- traefik.http.routers.client.rule=Host(`localhost`)
- traefik.http.routers.client.rule=Host(`<SERVER-IP>`)
- traefik.http.routers.client.entrypoints=web

volumes:
Expand Down
2 changes: 2 additions & 0 deletions docs/docs/deployment/_category_.yml
@@ -0,0 +1,2 @@
position: 4
label: Deployment
5 changes: 5 additions & 0 deletions docs/docs/deployment/index.mdx
@@ -0,0 +1,5 @@
---
sidebar_position: 4
---

# Deployment
1 change: 1 addition & 0 deletions docs/docs/index.mdx
@@ -1,6 +1,7 @@
---
sidebar_position: 1
sidebar_label: Introduction
title: Introduction
---

import TOCInline from '@theme/TOCInline';
Expand Down
11 changes: 2 additions & 9 deletions docs/docusaurus.config.js
Expand Up @@ -12,7 +12,7 @@ const config = {
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
favicon: 'favicon.ico',
organizationName: 'AmruthPillai',
projectName: 'Reactive-Resume',

Expand Down Expand Up @@ -45,15 +45,8 @@ const config = {
title: 'Reactive Resume',
logo: {
alt: 'Reactive Resume',
src: 'img/logo.svg',
src: 'logo.svg',
},
items: [
{
href: 'https://github.com/AmruthPillai/Reactive-Resume',
position: 'right',
label: 'GitHub',
},
],
},
footer: {
style: 'dark',
Expand Down
24 changes: 10 additions & 14 deletions docs/package.json
@@ -1,35 +1,28 @@
{
"name": "@reactive-resume/docs",
"name": "docs",
"version": "0.0.0",
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start --port 3200 --no-open",
"start": "docusaurus start --no-open --port 3200",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",
"clear": "docusaurus clear",
"serve": "docusaurus serve --host 0.0.0.0 --port 3200",
"serve": "docusaurus serve",
"write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids",
"typecheck": "tsc"
"write-heading-ids": "docusaurus write-heading-ids"
},
"dependencies": {
"@algolia/client-search": "^4.12.2",
"@docusaurus/core": "2.0.0-beta.17",
"@docusaurus/preset-classic": "2.0.0-beta.17",
"@docusaurus/theme-classic": "^2.0.0-beta.17",
"@mdx-js/react": "^2.0.0",
"@mdx-js/react": "^1.6.22",
"clsx": "^1.1.1",
"prism-react-renderer": "^1.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.0.0-beta.17",
"@docusaurus/types": "^2.0.0-beta.17",
"@tsconfig/docusaurus": "^1.0.5",
"@types/react": "^17.0.40",
"typescript": "^4.6.2"
},
"browserslist": {
"production": [
">0.5%",
Expand All @@ -41,5 +34,8 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@types/react": "17.0.40"
}
}
2 changes: 1 addition & 1 deletion docs/sidebars.js
Expand Up @@ -7,7 +7,7 @@
The sidebars can be generated from the filesystem, or explicitly defined here.
Create as many sidebars as you want.
*/
*/

// @ts-check

Expand Down
File renamed without changes.
17 changes: 0 additions & 17 deletions docs/static/img/logo.svg

This file was deleted.

1 comment on commit 57f7edc

@vercel
Copy link

@vercel vercel bot commented on 57f7edc Mar 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.