Skip to content

Commit e685d58

Browse files
authored
feat: improve environment configuration and Docker support (#257)
1 parent a2e4d2b commit e685d58

File tree

3 files changed

+121
-30
lines changed

3 files changed

+121
-30
lines changed

.env.sample

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,101 @@
1+
#####################
2+
# Nuxt Application Configuration
3+
#####################
14
# endpoint for API
25
NUXT_API_PARTY_ENDPOINTS_API_URL=http://localhost:5000/v2
3-
NUXT_PUBLIC_COMMUNITY_API_URL=http://localhost:5000/v2
6+
# Nuxt auth base URL
47
NUXT_PUBLIC_AUTH_BASE_URL=http://localhost:5000/auth
5-
NUXT_PUBLIC_TARGET_ENV=
8+
# Set debugging true or false
9+
NUXT_PUBLIC_DEBUG=
10+
# Used for displaying things like build banner which are
11+
# used for debugging purposes
12+
# development, production
13+
NUXT_PUBLIC_TARGET_ENV= development
14+
#####################
15+
# Nuxt Build Configuration
16+
# Displayed in the build banner
17+
#####################
618
NUXT_PUBLIC_BUILD_COMMIT_SHA=
719
NUXT_PUBLIC_BUILD_NUMBER=
820
NUXT_PUBLIC_BUILD_LINK=
921
NUXT_PUBLIC_BUILD_COMMIT_LINK=
1022
NUXT_PUBLIC_BUILD_REPO_LINK=
1123
NUXT_PUBLIC_BUILD_TIMESTAMP=
12-
NUXT_PUBLIC_DEBUG=
24+
25+
######################################################
26+
# Docker Configuration
27+
######################################################
28+
########################
29+
# Server Configuration
30+
########################
31+
# This is used for logging info and debugging purposes.
32+
SERVER_URL=localhost
33+
# The port on which the server will run
34+
SERVER_PORT="5000"
35+
# The environment in which the server is running. # Used to control verbosity of logs and other environment-specific settings.
36+
# Possible values: development (Verbose), production (Shows only errors)
37+
TARGET_ENV=development
38+
# The API version to use, this is used to control the API versioning.
39+
API_VERSION="2.0"
40+
# The global prefix for the API, this is used to control the API prefix in the open api docs.
41+
API_GLOBAL_PREFIX="v2"
42+
JWT_SECRET=""
43+
VERIFICATION_TOKEN_TTL=3600000 # in ms, e.g., 1 hour
44+
SESSION_SECRET=""
45+
HTTPS_SESSION= false # Set to true if you are using https, otherwise false
46+
SESSION_COOKIE_MAX_AGE='86400000' # in ms, e.g., 1 day
47+
########################
48+
## Database Configuration
49+
## These are assigned in environment variables section of the docker-compose file.
50+
########################
51+
DATABASE_HOST=db
52+
DATABASE_PORT=5432
53+
DATABASE_USER=root
54+
DATABASE_PASSWORD=root
55+
DATABASE_NAME=hub_dev
56+
########################
57+
# ADMIN JS Configuration
58+
########################
59+
SUPER_ADMIN_EMAIL=[email protected]
60+
SUPER_ADMIN_PASSWORD=adminCommunityPassword
61+
# This is used to config the JOSA contributions api
62+
CONTRIBUTION_API=http://contributions.josa.ngo/api/v1/users
63+
# the wikipedia api endpoint https prefix is added in the member services getWikimediaContributions. We use this one so we can cycle between arabic and english wikidpedia
64+
WIKIPEDIA_API_ENDPOINT='wikipedia.org/w/api.php'
65+
WIKIDATA_API_ENDPOINT='https://www.wikidata.org/w/api.php'
66+
COMMONS_WIKIMEDIA_API_ENDPOINT='https://commons.wikimedia.org/w/api.php'
67+
########################
68+
# Mail Client Configuration
69+
########################
70+
# This is used to send the email url. Should be updated from the tempalte later on and removed from here.
71+
CLIENT_URL=
72+
LIST_MONK_URL=
73+
LIST_MONK_USER=
74+
LIST_MONK_TOKEN=
75+
LIST_MONK_LIST_ID=
76+
LIST_MONK_WELCOME_TEMPLATE_ID=
77+
LIST_MONK_RESET_TEMPLATE_ID=
78+
########################
79+
# Digital Ocean Spaces Configuration
80+
########################
81+
DO_SPACES_ACCESS_KEY_ID=
82+
DO_SPACES_ACCESS_KEY_SECRET=
83+
DO_SPACES_BUCKET_NAME= # example bucket-name/sub-folder
84+
DO_SPACES_BUCKET_SUB_PATH= # destination folder, used for the url, example: commmunity
85+
DO_SPACES_BUCKET_PUBLIC_LINK= # fra1.do.com
86+
DO_SPACES_BUCKET_PUBLIC_LINK_PREFIX= # EXAMPLE: josa-dev-api.fra1.do.com without the fra1.do.com
87+
########################
88+
# Redis Configuration
89+
## These are assigned in environment variables section of the docker-compose file.
90+
########################
91+
REDIS_HOST=redis
92+
REDIS_PORT=6379
93+
REDIS_PASSWORD=
94+
REDIS_DB=0
95+
REDIS_TTL=
96+
###########################
97+
# POSTGRES docker Configuration
98+
###########################
99+
POSTGRES_USER=root
100+
POSTGRES_PASSWORD=root
101+
POSTGRES_DB=hub_dev

Dockerfile.local

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:22.15.0
2+
3+
WORKDIR /app
4+
COPY . .
5+
RUN npm install && npm run build
6+
7+
EXPOSE ${PORT}
8+
9+
CMD [ "npm", "run", "dev" ]

compose.yaml

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,29 @@
11
services:
22
# Nuxt Frontend
3-
# web:
4-
# container_name: community-web
5-
# build:
6-
# context: .
7-
# environment:
8-
# NUXT_COMMUNITY_API_URL: http://api:8080
9-
# PORT: 3000
10-
# HOST: '0.0.0.0'
11-
# ports:
12-
# - '3000:3000'
13-
# volumes:
14-
# - ./:/app/
15-
# command: npm run dev
3+
web:
4+
container_name: community-web
5+
build:
6+
context: .
7+
dockerfile: Dockerfile.local
8+
env_file:
9+
- .env
10+
ports:
11+
- '3000:3000'
12+
volumes:
13+
- ./:/app/
14+
- /app/node_modules # Ensures node_modules from the image build is used
15+
command: npm run dev
1616

1717
# Nest Backend
1818
api:
1919
container_name: community-api
2020
image: josaorg/community-api:latest
2121
env_file: .env
22-
environment:
23-
- DATABASE_HOST=db
24-
- DATABASE_PORT=5432
25-
- DATABASE_USER=root
26-
- DATABASE_PASSWORD=root
27-
- DATABASE_NAME=hub_dev
28-
- REDIS_HOST=redis
29-
- REDIS_PORT=6379
30-
# - TARGET_ENV='development'
22+
ports:
23+
- '5000:5000'
3124
depends_on:
3225
- db
3326
- redis
34-
# command: npm run start:dev
3527
redis:
3628
image: 'bitnami/redis:latest'
3729
environment:
@@ -43,7 +35,8 @@ services:
4335
image: postgres:14.3
4436
ports:
4537
- '6543:5432'
46-
environment:
47-
- POSTGRES_USER=root
48-
- POSTGRES_PASSWORD=root
49-
- POSTGRES_DB=hub_dev
38+
env_file: .env
39+
volumes:
40+
- postgres-data:/var/lib/postgresql/data
41+
volumes:
42+
postgres-data:

0 commit comments

Comments
 (0)