Skip to content

Feat: improve environment configuration and Docker support #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 92 additions & 3 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,12 +1,101 @@
#####################
# Nuxt Application Configuration
#####################
# endpoint for API
NUXT_API_PARTY_ENDPOINTS_API_URL=http://localhost:5000/v2
NUXT_PUBLIC_COMMUNITY_API_URL=http://localhost:5000/v2
# Nuxt auth base URL
NUXT_PUBLIC_AUTH_BASE_URL=http://localhost:5000/auth
NUXT_PUBLIC_TARGET_ENV=
# Set debugging true or false
NUXT_PUBLIC_DEBUG=
# Used for displaying things like build banner which are
# used for debugging purposes
# development, production
NUXT_PUBLIC_TARGET_ENV= development
#####################
# Nuxt Build Configuration
# Displayed in the build banner
#####################
NUXT_PUBLIC_BUILD_COMMIT_SHA=
NUXT_PUBLIC_BUILD_NUMBER=
NUXT_PUBLIC_BUILD_LINK=
NUXT_PUBLIC_BUILD_COMMIT_LINK=
NUXT_PUBLIC_BUILD_REPO_LINK=
NUXT_PUBLIC_BUILD_TIMESTAMP=
NUXT_PUBLIC_DEBUG=

######################################################
# Docker Configuration
######################################################
########################
# Server Configuration
########################
# This is used for logging info and debugging purposes.
SERVER_URL=localhost
# The port on which the server will run
SERVER_PORT="5000"
# The environment in which the server is running. # Used to control verbosity of logs and other environment-specific settings.
# Possible values: development (Verbose), production (Shows only errors)
TARGET_ENV=development
# The API version to use, this is used to control the API versioning.
API_VERSION="2.0"
# The global prefix for the API, this is used to control the API prefix in the open api docs.
API_GLOBAL_PREFIX="v2"
JWT_SECRET=""
VERIFICATION_TOKEN_TTL=3600000 # in ms, e.g., 1 hour
SESSION_SECRET=""
HTTPS_SESSION= false # Set to true if you are using https, otherwise false
SESSION_COOKIE_MAX_AGE='86400000' # in ms, e.g., 1 day
########################
## Database Configuration
## These are assigned in environment variables section of the docker-compose file.
########################
DATABASE_HOST=db
DATABASE_PORT=5432
DATABASE_USER=root
DATABASE_PASSWORD=root
DATABASE_NAME=hub_dev
########################
# ADMIN JS Configuration
########################
[email protected]
SUPER_ADMIN_PASSWORD=adminCommunityPassword
# This is used to config the JOSA contributions api
CONTRIBUTION_API=http://contributions.josa.ngo/api/v1/users
# 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
WIKIPEDIA_API_ENDPOINT='wikipedia.org/w/api.php'
WIKIDATA_API_ENDPOINT='https://www.wikidata.org/w/api.php'
COMMONS_WIKIMEDIA_API_ENDPOINT='https://commons.wikimedia.org/w/api.php'
########################
# Mail Client Configuration
########################
# This is used to send the email url. Should be updated from the tempalte later on and removed from here.
CLIENT_URL=
LIST_MONK_URL=
LIST_MONK_USER=
LIST_MONK_TOKEN=
LIST_MONK_LIST_ID=
LIST_MONK_WELCOME_TEMPLATE_ID=
LIST_MONK_RESET_TEMPLATE_ID=
########################
# Digital Ocean Spaces Configuration
########################
DO_SPACES_ACCESS_KEY_ID=
DO_SPACES_ACCESS_KEY_SECRET=
DO_SPACES_BUCKET_NAME= # example bucket-name/sub-folder
DO_SPACES_BUCKET_SUB_PATH= # destination folder, used for the url, example: commmunity
DO_SPACES_BUCKET_PUBLIC_LINK= # fra1.do.com
DO_SPACES_BUCKET_PUBLIC_LINK_PREFIX= # EXAMPLE: josa-dev-api.fra1.do.com without the fra1.do.com
########################
# Redis Configuration
## These are assigned in environment variables section of the docker-compose file.
########################
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
REDIS_TTL=
###########################
# POSTGRES docker Configuration
###########################
POSTGRES_USER=root
POSTGRES_PASSWORD=root
POSTGRES_DB=hub_dev
9 changes: 9 additions & 0 deletions Dockerfile.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:22.15.0

WORKDIR /app
COPY . .
RUN npm install && npm run build

EXPOSE ${PORT}

CMD [ "npm", "run", "dev" ]
47 changes: 20 additions & 27 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
services:
# Nuxt Frontend
# web:
# container_name: community-web
# build:
# context: .
# environment:
# NUXT_COMMUNITY_API_URL: http://api:8080
# PORT: 3000
# HOST: '0.0.0.0'
# ports:
# - '3000:3000'
# volumes:
# - ./:/app/
# command: npm run dev
web:
container_name: community-web
build:
context: .
dockerfile: Dockerfile.local
env_file:
- .env
ports:
- '3000:3000'
volumes:
- ./:/app/
- /app/node_modules # Ensures node_modules from the image build is used
command: npm run dev

# Nest Backend
api:
container_name: community-api
image: josaorg/community-api:latest
env_file: .env
environment:
- DATABASE_HOST=db
- DATABASE_PORT=5432
- DATABASE_USER=root
- DATABASE_PASSWORD=root
- DATABASE_NAME=hub_dev
- REDIS_HOST=redis
- REDIS_PORT=6379
# - TARGET_ENV='development'
ports:
- '5000:5000'
depends_on:
- db
- redis
# command: npm run start:dev
redis:
image: 'bitnami/redis:latest'
environment:
Expand All @@ -43,7 +35,8 @@ services:
image: postgres:14.3
ports:
- '6543:5432'
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=root
- POSTGRES_DB=hub_dev
env_file: .env
volumes:
- postgres-data:/var/lib/postgresql/data
volumes:
postgres-data: