-
Notifications
You must be signed in to change notification settings - Fork 0
/
.env.production
139 lines (139 loc) · 6.26 KB
/
.env.production
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Title: MicroCODE Environment Variables for MERN App PRODUCTION STACK
# Module: Modules (.env.production)
# Customer: MITxPRO MERN Course
# Creator: MicroCODE Incorporated
# Date: September 2022
# Author: Timothy J McGuire
#
# Designed and Coded: 2022 MicroCODE Incorporated
#
# This software and related materials are the property of
# MicroCODE Incorporated and contain confidential and proprietary
# information. This software and related materials shall not be
# duplicated, disclosed to others, or used in any way without the
# written of MicroCODE Incorported.
#
#
# DESCRIPTION:
# ------------
#
# This module defines the variables to build all (3) Containers of the Dockerization of a MERN App.
#
# o Frontend = Client = ReactJS / NextJS, NodeJS, Apollo Client, etc.
# o Backend = Server = ExpressJS, NodeJS, Apollo API, GraphQL, etc.
# o Database = MondoDB = Persistent App Data Store.
#
# This allows for the use of proven build environments where we just provide new application code
# and all the 3-Tier Stack Build and Deploy is commonized.
#
#
# NOTES:
# ------
#
# o Remember... Code like a Machine™. Consistently and Explictly, Simply and for Readability. Hail CAESAR™.
#
# o When you change configuration in this file be sure to delete any DOCKER CONTAINERS and DOCKER IMAGES
# that still have the same names as those construcuted by this .env file, it will just reuse them without
# any of the changes generated by edits to this file, i.e.: they will not rebuild.
#
#
# Definition Precedence:
# ---------------------
# 1) docker-compose.yaml
# 2) Dockerfile
# 3) .env
# 4) * .env.development / .env.production *
#
#
# REFERENCES:
# -----------
#
# 1. DOCKER Documentation
# https://docs.docker.com/docker-hub/
#
# 2. CI/CD Hands-On: Github Actions+Docker Hub+AWS EC2
# https://medium.com/ryanjang-devnotes/ci-cd-hands-on-github-actions-docker-hub-aws-ec2-ba09f80297e1
#
# 3. Demo Repository of MERN + DOCKER (Development + Production Guidance)
# https://github.com/joshdcuneo/mern-docker-starter
#
# 4. How To Provision and Manage Remote Docker Hosts with Docker Machine on Ubuntu 16.04
# https://www.digitalocean.com/community/tutorials/how-to-provision-and-manage-remote-docker-hosts-with-docker-machine-on-ubuntu-16-04
#
# 5. Automatically build & push a Full Stack Application onto Docker Hub using GitHub Actions
# https://towardsdev.com/automatically-build-push-a-full-stack-application-onto-docker-hub-using-github-actions-fb274980202d
#
# 6. How to Use MERN Stack: A Complete Guide
# https://www.mongodb.com/languages/mern-stack-tutorial
#
# 7. How to deploy on remote Docker hosts with docker-compose
# by Anca Iordache - March 2, 2020
# https://www.docker.com/blog/how-to-deploy-on-remote-docker-hosts-with-docker-compose/
#
# 8. Use DotEnv to Configure Environment variables
# https://medium.com/frontend-handbooks/use-dotenv-to-configure-environment-variables-ae53ca098ac4
#
# 9. React runtime environment variables - Build once, deploy many!
# https://vesth.dev/posts/react-runtime-environment-variables/#:~:text=Setting%20up%20environment%20variables%20during%20build-time%20is%20easy,so%20we%20cannot%20read%20variables%20from%20the%20environment.
#
# 10. A complete guide to using environment variables and files with Docker and Compose
# by Mike Huls
# https://towardsdatascience.com/a-complete-guide-to-using-environment-variables-and-files-with-docker-and-compose-4549c21dc6af
#
# 11. How to Handle Multiple Environments in a React App
# by Matheswaaran
# https://betterprogramming.pub/managing-environments-for-provisional-builds-with-react-app-1fb411e3597#:~:text=Set%20up%20your%20React%20app%20for%20environments%20beyond,for%20deployment.%20Uses%20.env.production%20by%20default%2C%20if%20available.
#
#
#
#
#
# MODIFICATIONS:
# --------------
#
# Date: By-Group: Rev: Description:
#
# 27-Sep-2022 TJM-MCODE {0001} New file for my '${APP_NAME}' 3-Tier Dockerized Template solution.
# Define all the APP_* environment variables here in your .env file.
# Be sure to 'npm install dotenv' to enable JS code reading .env values.
# 05-Oct-2022 TJM-MCODE {0002} Split into .env (common), .env.development (NODE_ENV=development), and .env.production (NODE_ENV=production)
# 06-Oct-2022 TJM-MCODE {0003} Added '*BACKEND_URL' to support '/backend' vs. ':808x' as the connection URL.
#
#
#
#
# APP_* variables for docker-compose and dockerfile builds
#
# APP_DOMAIN - the name of the domain hosting the App used throughout the build and the JS code
APP_DOMAIN=mcode.com # mcode.com, controlnet.io, laddersnet.io, or localhost for development
#
# APP_SUBDOMAIN - the name of the sub-doomain hosting the App used throughout the build and the JS code
APP_SUBDOMAIN=${APP_NAME}.mcode.com # ${APP_NAME}.${APP_DOMAIN} or localhost for development
#
# APP_BACKEND_URL - taken from the standard .env file into a REACT_APP_* var for the Front-End
# should be equal to ${APP_BACKEND_URL}
APP_BACKEND_URL=http://${APP_SUBDOMAIN}/backend
#
# APP_RESTART_POLICY - the restart policy for the docker-compose.yml file to alaways restart the containers
# in development mode, and only under ceetain conditions in production mode.
APP_RESTART_POLICY=unless-stopped
#
#
#
# REACT_APP_* variables for REACT at runtime
#
# REACT_APP_ENV - for React to see our mode
REACT_APP_ENV=production
#
# REACT_APP_ENV - for React to see our build version
REACT_APP_VERSION=${APP_VERSION}
#
# REACT_APP_SUBDOMAIN - the same name made accessible in the React App Front-end
REACT_APP_SUBDOMAIN=${APP_SUBDOMAIN}
#
# REACT_APP_BACKEND_PORT - taken from the standard .env file into a REACT_APP_* var for the Front-End
REACT_APP_BACKEND_PORT=${APP_BACKEND_PORT}
#
# REACT_APP_BACKEND_URL - taken from the standard .env file into a REACT_APP_* var for the Front-End
# should be equal to ${APP_BACKEND_URL}
REACT_APP_BACKEND_URL=${APP_BACKEND_URL}