Skip to content

Commit 4056d55

Browse files
authored
Merge pull request #43 from QuickCorp/v2.4-ts
V2.4 ts
2 parents e0d617d + 0b4e81d commit 4056d55

15 files changed

+336
-9
lines changed

CONFIG.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# CONFIG.md
2+
3+
## Overview
4+
This document provides detailed information about the configuration fields used in the `config.yaml` file.
5+
6+
## Configuration Fields
7+
8+
### General Settings
9+
- **devmode**: Specifies the development mode level. Possible values: `info`, `debug`, `warn`, `error`.
10+
- **autodiscover**: Enables or disables the autodiscovery of components. Possible values: `true`, `false`.
11+
- **autodiscover_commands**: Enables or disables the autodiscovery of commands. Possible values: `true`, `false`.
12+
- **autodiscover_handlers**: Enables or disables the autodiscovery of handlers. Possible values: `true`, `false`.
13+
- **documentRoot**: Sets the root directory for serving documents. Example: `"$config(projectPath)public/"`.
14+
- **documentRootFileIndex**: Specifies the default file to serve when accessing the document root. Example: `index.html`.
15+
- **cacheControl**: Defines the cache control policy. Example: `max-age=31536000`.
16+
- **relativeImportPath**: Sets the relative path for importing JavaScript packages. Example: `js/packages/`.
17+
- **serverPortHTTP**: Specifies the port for the HTTP server. Example: `'8080'`.
18+
- **serverPortHTTPS**: Specifies the port for the HTTPS server. Example: `'8443'`.
19+
- **useLocalSDK**: Enables or disables the use of the local SDK. Possible values: `true`, `false`.
20+
- **useLegacyHTTP**: Enables or disables the use of legacy HTTP. Possible values: `true`, `false`.
21+
- **private-key-pem**: Path to the private key PEM file. Example: `"$config(domain)-privkey.pem"`.
22+
- **private-cert-pem**: Path to the private certificate PEM file. Example: `"$config(domain)-cert.pem"`.
23+
- **enableShellCommands**: Enables or disables shell commands. Possible values: `true`, `false`.
24+
25+
### Backend Configuration
26+
- **backend**: Contains backend-specific settings.
27+
- **db_engine**: Database engine configuration.
28+
- **name**: Name of the database engine. Example: `"$ENV(ENGINE_NAME)"`.
29+
- **databaseName**: Name of the database. Example: `"$ENV(DATABASE_NAME)"`.
30+
- **auth**: Authentication settings.
31+
- **enabled**: Enables or disables authentication. Possible values: `true`, `false`.
32+
- **defaultUser**: Default username for authentication. Example: `"$ENV(DEFAULT_USER)"`.
33+
- **defaultPasswd**: Default password for authentication. Example: `"$ENV(DEFAULT_PASSWORD)"`.
34+
- **microsoftapikey**: API key for Microsoft services. Example: `"$ENV(MICROSOFT_API_KEY)"`.
35+
- **googleapikey**: API key for Google services. Example: `"$ENV(GOOGLE_API_KEY)"`.
36+
- **routes**: List of route configurations.
37+
- **name**: Name of the route.
38+
- **description**: Description of the route.
39+
- **path**: Path pattern for the route.
40+
- **microservice**: Microservice handling the route.
41+
- **redirect_to**: Redirection target for the route.
42+
- **responseHeaders**: Headers to include in the response.
43+
- **cors**: CORS settings for the route.
44+
- **allow_origins**: Allowed origins for CORS. Example: `"*"`.
45+
46+
### Package Configuration
47+
- **package**: Contains package-specific settings.
48+
- **source**: Source directories for the package.
49+
- **backend**: Source directory for backend code. Example: `backend`.
50+
- **frontend**: Source directory for frontend code. Example: `src`.
51+
- **build**: Build directory. Example: `build`.
52+
- **dist**: Distribution directory. Example: `dist`.
53+

DOCKER-COMPOSE-TUTORIAL.md

+114
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
### Instructions to Use Docker Compose with QCObjects Docker Image
2+
3+
Based on the provided `docker-compose` file, here are the steps to use Docker Compose to create and build your own Docker image `qcobjects_newapp`:
4+
5+
1. **Create a Dockerfile:**
6+
Ensure you have a `Dockerfile` in your project directory with the following content:
7+
8+
```dockerfile
9+
FROM qcobjects/qcobjects:latest
10+
11+
USER root
12+
13+
ENV XDG_RUNTIME_DIR $(id -u)
14+
ENV container docker
15+
ENV LC_ALL C
16+
ENV DEBIAN_FRONTEND noninteractive
17+
18+
LABEL MAINTAINER "Jean Machuca <[email protected]>"
19+
LABEL Author "Jean Machuca <[email protected]>"
20+
LABEL org.opencontainers.image.authors="Jean Machuca <[email protected]>"
21+
ENV container docker
22+
23+
RUN npm i -g qcobjects qcobjects-sdk qcobjects-cli
24+
25+
# Configure the internal user permissions
26+
RUN mkdir -p /home/qcobjects/app && chown -R qcobjects:qcobjects /home/qcobjects/app
27+
28+
# Setting the work directory
29+
WORKDIR /home/qcobjects/app
30+
ENV DOCUMENT_ROOT /home/qcobjects/app/
31+
ENV DATA_PATH $DOCUMENT_ROOT/data/
32+
COPY package*.json ./
33+
34+
# Run the initial install init scripts for jasmine and cache verify
35+
# RUN jasmine init
36+
RUN npm cache verify
37+
RUN npm i
38+
39+
# Bundle app source
40+
COPY --chown=qcobjects:qcobjects . .
41+
42+
USER qcobjects
43+
44+
EXPOSE 8080:8080
45+
EXPOSE 8443:8443
46+
47+
CMD [ "npm", "start" ]
48+
```
49+
50+
2. **Create a `docker-compose.yml` File:**
51+
Create a `docker-compose.yml` file in your project directory with the following content:
52+
53+
```yaml
54+
version: '3'
55+
services:
56+
qcobjects:
57+
image: qcobjects_newapp:latest
58+
hostname: qcobjects_newapp
59+
command: ["npm", "run", "start"]
60+
privileged: true
61+
build:
62+
context: ./
63+
dockerfile: Dockerfile
64+
volumes:
65+
- ./letsencrypt:/etc/letsencrypt/live/newapp.qcobjects.dev
66+
- ./data:/home/qcobjects/app/data
67+
expose:
68+
- 8080:8080
69+
- 8443:8443
70+
- 10300:10300
71+
ports:
72+
- 8080:8080
73+
- 8443:8443
74+
- 10300:10300
75+
env_file:
76+
- ./.env
77+
```
78+
79+
3. **Environment Variables:**
80+
Create a `.env` file in your project directory to define environment variables. This file might include variables such as:
81+
82+
```env
83+
NODE_ENV=production
84+
PORT=8080
85+
SSL_PORT=8443
86+
```
87+
88+
4. **Build and Run the Docker Compose Setup:**
89+
Open a terminal in your project directory and run the following commands:
90+
91+
```sh
92+
# Build the Docker image
93+
docker-compose build
94+
95+
# Start the services
96+
docker-compose up
97+
```
98+
99+
### Explanation of Environment Variables and Settings:
100+
101+
- **`NODE_ENV`**: Specifies the environment in which the application is running (e.g., `development`, `production`).
102+
- **`PORT`**: The port on which the application will run (default is `8080`).
103+
- **`SSL_PORT`**: The port for SSL connections (default is `8443`).
104+
105+
### Volumes:
106+
- **`./letsencrypt:/etc/letsencrypt/live/newapp.qcobjects.dev`**: Maps the local `letsencrypt` directory to the container's directory for SSL certificates.
107+
- **`./data:/home/qcobjects/app/data`**: Maps the local `data` directory to the container's data directory.
108+
109+
### Ports:
110+
- **`8080:8080`**: Maps port `8080` on the host to port `8080` in the container.
111+
- **`8443:8443`**: Maps port `8443` on the host to port `8443` in the container.
112+
- **`10300:10300`**: Maps port `10300` on the host to port `10300` in the container.
113+
114+
These steps will help you set up and run your QCObjects application using Docker Compose, ensuring a consistent and efficient development environment.

Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM quickcorp/qcobjects:latest
1+
FROM qcobjects/qcobjects:latest
2+
23
###
34
# QCObjects Framework
45
# ________________
@@ -55,9 +56,9 @@ RUN npm i
5556
# Bundle app source
5657
COPY --chown=qcobjects:qcobjects . .
5758

58-
USER qcobjects
59+
RUN apk add --no-cache openssl
5960

61+
USER qcobjects
6062
EXPOSE 8080:8080
6163
EXPOSE 8443:8443
62-
6364
CMD [ "npm", "start" ]

README.md

+25
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ The "coverage" script generates a code coverage report using the "nyc" library.
118118
npm run coverage
119119
```
120120

121+
# Setup ENV Variables
122+
123+
```sh
124+
# Env file .env
125+
export ENGINE_NAME=sqlite3
126+
export DATABASE_NAME=admin.db
127+
# Example: admin
128+
export DEFAULT_USER=admin
129+
# Example: admin123
130+
export DEFAULT_PASSWORD=admin123
131+
export MICROSOFT_API_KEY=<Get the key from Azure Platform>
132+
export GOOGLE_API_KEY=<Get the key from GCP>
133+
```
134+
121135
# Run start
122136

123137
The "start" script runs the "createcert" and "serve" scripts. This is useful for quickly launching the app and getting started with development.
@@ -259,3 +273,14 @@ docker run -p 8080:8080 -p 8443:8443 --name qcobjects-newapp -d qcobjects/qcobje
259273
```
260274

261275
Then go to [https://127.0.0.1:8443/](https://127.0.0.1:8443/)
276+
277+
# Configuration Instructions
278+
279+
To properly configure the application, please refer to the [`CONFIG.md`](CONFIG.md) file for detailed information on each configuration field. Follow these steps:
280+
281+
1. **Open the configuration file**: The main configuration file is `config.json`. QCObjects will prioritize `config.json` if it is present. If `config.json` is not available, it will look for `config.yaml` or `config.yml`. If both JSON and YAML files are present, the YAML file will be considered, and the other files will be dismissed.
282+
2. **Refer to `CONFIG.md`**: For a detailed explanation of each field in the configuration file, consult the [`CONFIG.md`](CONFIG.md) file. This document provides descriptions, possible values, and examples for each configuration option.
283+
3. **Update the settings**: Modify the fields in the configuration file as per your requirements, using the guidance provided in [`CONFIG.md`](CONFIG.md).
284+
4. **Save your changes**: Ensure that all changes are saved before running the application.
285+
286+

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.37
1+
2.4.40-ts

config.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2-
"devmode":"info",
2+
"domain":"$ENV(DOMAIN)",
3+
"certificate_provider":"$ENV(CERTIFICATE_PROVIDER)",
4+
"devmode":"$ENV(DEVMODE)",
35
"autodiscover":true,
46
"autodiscover_commands":true,
57
"autodiscover_handlers":true,

config.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
devmode: info
3+
autodiscover: true
4+
autodiscover_commands: true
5+
autodiscover_handlers: true
6+
documentRoot: "$config(projectPath)public/"
7+
documentRootFileIndex: index.html
8+
cacheControl: max-age=31536000
9+
relativeImportPath: js/packages/
10+
serverPortHTTP: '8080'
11+
serverPortHTTPS: '8443'
12+
useLocalSDK: true
13+
useLegacyHTTP: false
14+
private-key-pem: "$config(domain)-privkey.pem"
15+
private-cert-pem: "$config(domain)-cert.pem"
16+
enableShellCommands: true
17+
backend:
18+
db_engine:
19+
name: "$ENV(ENGINE_NAME)"
20+
databaseName: "$ENV(DATABASE_NAME)"
21+
auth:
22+
enabled: true
23+
defaultUser: "$ENV(DEFAULT_USER)"
24+
defaultPasswd: "$ENV(DEFAULT_PASSWORD)"
25+
microsoftapikey: "$ENV(MICROSOFT_API_KEY)"
26+
googleapikey: "$ENV(GOOGLE_API_KEY)"
27+
routes:
28+
- name: QCObjects-SDK.js for demo folder
29+
description: Redirection of QCObjects SDK
30+
path: "^/demo-tests/QCObjects-SDK.js$"
31+
microservice: com.qcobjects.backend.microservice.static
32+
redirect_to: "./node_modules/qcobjects-sdk/QCObjects-SDK.js"
33+
responseHeaders: {}
34+
cors:
35+
allow_origins: "*"
36+
- name: QCObjects-SDK Components for demo folder
37+
description: Redirection of QCObjects SDK
38+
path: "^/demo-tests/qcobjects-sdk/(.*)$"
39+
microservice: com.qcobjects.backend.microservice.static
40+
redirect_to: "./node_modules/qcobjects-sdk/$1"
41+
responseHeaders: {}
42+
cors:
43+
allow_origins: "*"
44+
- name: Hello World!
45+
description: Hello world Microservice!
46+
path: "^/hello-world"
47+
microservice: qcobjects-handler-hello-world
48+
headers:
49+
content-type: text/html; charset=utf-8
50+
responseHeaders: {}
51+
cors:
52+
allow_origins: "*"
53+
package:
54+
source:
55+
backend: backend
56+
frontend: src
57+
build: build
58+
dist: dist

docker-compose.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: '3'
2+
services:
3+
qcobjects:
4+
image: qcobjects_newapp:latest
5+
hostname: qcobjects_newapp
6+
command: ["npm","run", "start"]
7+
privileged: true
8+
build:
9+
context: ./
10+
dockerfile: Dockerfile
11+
volumes:
12+
- ./letsencrypt:/etc/letsencrypt/live/newapp.qcobjects.dev
13+
- ./data:/home/qcobjects/app/data
14+
expose:
15+
- 8080:8080
16+
- 8443:8443
17+
- 10300:10300
18+
ports:
19+
- 8080:8080
20+
- 8443:8443
21+
- 10300:10300
22+
env_file:
23+
- ./.env

package-lock.json

+10-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "qcobjectsnewapp",
3-
"version": "2.4.37",
3+
"version": "2.4.40-ts",
44
"description": "App template for New App in QCObjects",
55
"targets": {
66
"default": {
@@ -50,6 +50,7 @@
5050
"do-server": "npm start",
5151
"minify:css": "(npx esbuild build/css/*.css build/css/**/*.css --outdir=public/css --keep-names --minify --global-name=global --sourcemap --loader:.svg=file --target=es2021)",
5252
"build:docker": "docker build -t qcobjects/qcobjects-newapp:latest .",
53+
"build:docker-compose": "docker-compose -f docker-compose.yml build --no-cache --force-rm --pull -q qcobjects",
5354
"build:static": "npx qcobjects-cli publish:static src/ build/ --exclude js --exclude=.DS_Store",
5455
"build:ts": "npm test && npx tsc",
5556
"build:ts-types": "npx tsc --project tsconfig.d.json",
@@ -65,6 +66,8 @@
6566
"publish:docker": "docker push qcobjects/qcobjects-newapp:latest",
6667
"deploy:docker": "npm run build:docker && npm run publish:docker",
6768
"docker-server": "docker run -p 8080:8080 -p 8443:8443 -d --name qcobjects-newapp qcobjects/qcobjects-newapp",
69+
"docker-compose-server": "docker-compose -f docker-compose.yml up --quiet-pull -d qcobjects",
70+
"start:docker-compose": "npm run build:docker-compose && npm run docker-compose-server",
6871
"prepare": "node -e \"if(!require('fs').existsSync('.git')){process.exit(0)}\" || npx -y husky install",
6972
"prestart": "npm run publish:web",
7073
"cli:help": "qcobjects --help",

src/css/components/card.css

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
border-radius: 30px;
3333
}
3434

35+
.title{
36+
padding-top: 5px;
37+
padding-bottom: 15px;
38+
}
39+
.description {
40+
padding-top: 15px;
41+
padding-bottom: 10px;
42+
}
43+
3544
.img, .title, .description {
3645
overflow: hidden;
3746
}

src/css/desktop/components/github-grid.css

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
grid-template-columns: repeat(4, 170px);
44
grid-template-rows: repeat(auto, 100px);
55
grid-gap: 0.5%;
6+
column-gap: 12px;
67
}

0 commit comments

Comments
 (0)