mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch '1-qr-reader' into 2-create_a_dockerfile_for_the_frontend_application
This commit is contained in:
commit
a30946d74b
108
Dockerfile
Normal file
108
Dockerfile
Normal file
@ -0,0 +1,108 @@
|
||||
##################################################################################
|
||||
# BASE ###########################################################################
|
||||
##################################################################################
|
||||
FROM node:12.19.0-alpine3.10 as base
|
||||
|
||||
# ENVs (available in production aswell, can be overwritten by commandline or env file)
|
||||
## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame
|
||||
ENV DOCKER_WORKDIR="/app"
|
||||
## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0
|
||||
ENV BUILD_DATE="1970-01-01T00:00:00.00Z"
|
||||
## We cannot do $(npm run version).${BUILD_NUMBER} here so we default to 0.0.0.0
|
||||
ENV BUILD_VERSION="0.0.0.0"
|
||||
## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000
|
||||
ENV BUILD_COMMIT="0000000"
|
||||
## SET NODE_ENV
|
||||
ENV NODE_ENV="production"
|
||||
## App relevant Envs
|
||||
ENV PORT="8080"
|
||||
|
||||
# Labels
|
||||
LABEL org.label-schema.build-date="${BUILD_DATE}"
|
||||
LABEL org.label-schema.name="gradido:frontend"
|
||||
LABEL org.label-schema.description="Gradido Vue Webwallet"
|
||||
LABEL org.label-schema.usage="https://github.com/gradido/gradido_vue_wallet/blob/master/README.md"
|
||||
LABEL org.label-schema.url="https://gradido.net"
|
||||
LABEL org.label-schema.vcs-url="https://github.com/gradido/gradido_vue_wallet/tree/master/backend"
|
||||
LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}"
|
||||
LABEL org.label-schema.vendor="gradido Community"
|
||||
LABEL org.label-schema.version="${BUILD_VERSION}"
|
||||
LABEL org.label-schema.schema-version="1.0"
|
||||
LABEL maintainer="support@ogradido.net"
|
||||
|
||||
# Install Additional Software
|
||||
## install: git
|
||||
#RUN apk --no-cache add git
|
||||
|
||||
# Settings
|
||||
## Expose Container Port
|
||||
EXPOSE ${PORT}
|
||||
|
||||
## Workdir
|
||||
RUN mkdir -p ${DOCKER_WORKDIR}
|
||||
WORKDIR ${DOCKER_WORKDIR}
|
||||
|
||||
##################################################################################
|
||||
# DEVELOPMENT (Connected to the local environment, to reload on demand) ##########
|
||||
##################################################################################
|
||||
FROM base as development
|
||||
|
||||
# We don't need to copy or build anything since we gonna bind to the
|
||||
# local filesystem which will need a rebuild anyway
|
||||
|
||||
# Run command
|
||||
# (for development we need to execute npm install since the
|
||||
# node_modules are on another volume and need updating)
|
||||
CMD /bin/sh -c "npm install && npm run dev"
|
||||
|
||||
##################################################################################
|
||||
# BUILD (Does contain all files and is therefore bloated) ########################
|
||||
##################################################################################
|
||||
FROM base as build
|
||||
|
||||
# Copy everything
|
||||
COPY . .
|
||||
# npm install
|
||||
RUN npm install --production=false --frozen-lockfile --non-interactive
|
||||
# npm build
|
||||
RUN npm run build
|
||||
|
||||
##################################################################################
|
||||
# TEST ###########################################################################
|
||||
##################################################################################
|
||||
FROM build as test
|
||||
|
||||
# Run command
|
||||
CMD /bin/sh -c "npm run dev"
|
||||
|
||||
##################################################################################
|
||||
# PRODUCTION (Does contain only "binary"- and static-files to reduce image size) #
|
||||
##################################################################################
|
||||
FROM base as production
|
||||
|
||||
# Copy "binary"-files from build image
|
||||
COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt
|
||||
COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules
|
||||
COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js
|
||||
# Copy static files
|
||||
# TODO - this should be one Folder containign all stuff needed to be copied
|
||||
#COPY --from=build ${DOCKER_WORKDIR}/constants ./constants
|
||||
#COPY --from=build ${DOCKER_WORKDIR}/static ./static
|
||||
#COPY --from=build ${DOCKER_WORKDIR}/locales ./locales
|
||||
# Copy package.json for script definitions (lock file should not be needed)
|
||||
COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json
|
||||
|
||||
# Run command
|
||||
CMD /bin/sh -c "npm run start"
|
||||
|
||||
|
||||
|
||||
## add `/usr/src/app/node_modules/.bin` to $PATH
|
||||
#ENV PATH /usr/src/app/node_modules/.bin:$PATH
|
||||
#
|
||||
## install and cache app dependencies
|
||||
#COPY package.json /usr/src/app/package.json
|
||||
#RUN npm install
|
||||
#RUN npm install -g @vue/cli
|
||||
## start app
|
||||
#CMD ["npm", "run", "serve"]
|
||||
161
README.md
161
README.md
@ -1,6 +1,6 @@
|
||||
# Vue Gradido Wallet
|
||||
|
||||
|
||||
|
||||
# install mit npm
|
||||
```
|
||||
$ git clone https://github.com/gradido/gradido_vue_wallet.git [project-name]
|
||||
@ -43,12 +43,14 @@ ISSUES:
|
||||
|
||||
|
||||
- [ ] 🚀 [Feature] - Create a dockerfile for the frontend application enhancement
|
||||
|
||||
|
||||
**DEMO:** [https://vast-atoll-44277.herokuapp.com/](https://vast-atoll-44277.herokuapp.com/)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
___________
|
||||
|
||||
|
||||
|
||||
# 🌟 [EPIC] - Gradido Web- and App- Client
|
||||
|
||||
@ -63,6 +65,150 @@ https://staging.gradido.net/client
|
||||
Hiermit kann ein Konto anlegt werden:
|
||||
https://staging.gradido.net/account/registerDirect
|
||||
|
||||
# Fehler im Code
|
||||
Wenn etwas nicht stimmt, entweder mit den Input-Paremetern, oder ein Fehler im Code gibt es meistens folgendes als Ergebnis:
|
||||
```
|
||||
{
|
||||
"state": "error",
|
||||
"msg": "<kurze Fehlerbeschreibung>",
|
||||
"details": "<optional zusätzliche Informationen zum Fehler, z.B. Framework Fehlermeldung>"
|
||||
}
|
||||
```
|
||||
|
||||
# csfr Token
|
||||
Bindet das js ein.
|
||||
Stellt folgende js-Variablen zur Verfügung:
|
||||
|
||||
csfr : string
|
||||
csfr Token (https://book.cakephp.org/3/en/controllers/components/csrf.html)
|
||||
user: object
|
||||
|
||||
# Testbenutzer
|
||||
Enthält Daten des aktuell eingeloggten Benutzers, z.B.: mein Testbenutzer:
|
||||
console.log(user);
|
||||
```
|
||||
{
|
||||
"created": 1578688666,
|
||||
"disabled": false,
|
||||
"email": "dervommond@gmail.com",
|
||||
"email_checked": true,
|
||||
"first_name": "Max",
|
||||
"group_alias": "gdd1",
|
||||
"ident_hash": 2928827813,
|
||||
"last_name": "Miau",
|
||||
"public_hex": "2ed28a1cf5e116d83615406bc577152221c2f774a5656f66a0e7540f7576d71b",
|
||||
"role": "admin",
|
||||
"username": "",
|
||||
"balance": 174500, // Gradido Cent, 4 Nachkommastellen (2 Reserve) entspricht 17,45
|
||||
"id": 1,
|
||||
"errorCount": 0
|
||||
}
|
||||
```
|
||||
Das sind im Grunde die Benutzerangaben aus der Login-Server Datenbank.
|
||||
|
||||
session :int
|
||||
Login-Server session id, notwendig für alle ajax-request.
|
||||
|
||||
# Seiten
|
||||
Navigation:
|
||||
Für alle Benutzer:
|
||||
|
||||
Kontoübersicht
|
||||
Startseite
|
||||
Überweisung
|
||||
Mitgliederbereich (externer Link zu elopage: https://elopage.com/s/gradido/sign_in)
|
||||
Rechts oben:
|
||||
Profil
|
||||
Abmelden
|
||||
Startseite:
|
||||
Für alle Benutzer:
|
||||
Kontoübersicht
|
||||
Überweisung
|
||||
Benutzer Suche:
|
||||
http://daten.einhornimmond.de/gradido_mithril_user_search.zip
|
||||
|
||||
# Mobile App
|
||||
Login über eingebundene Login-Seite
|
||||
auslesen der session_id aus dem Session Cookie: GRADIDO_LOGIN
|
||||
Access Token vom Login-Server anfragen:
|
||||
GET https://staging.gradido.net/appRequest/acquireAccessToken?session_id = <GRADIDO_LOGIN>
|
||||
Du kannst auch den Cookie wieder mitschicken, solange die Login-Server Basis-url die gleiche ist, müsste das auch funktionieren.
|
||||
Antwort:
|
||||
```
|
||||
{
|
||||
"state":"success",
|
||||
"access_token" : "<integer>",
|
||||
"group_base_url":"<Community Server Base Url>"
|
||||
}
|
||||
```
|
||||
Unterschied Access Token von der session_id: Access Tokens sind länger gültig
|
||||
Du kannst über eine gültige session_id einen Access Token erhalten der eine Woche gültig ist. Die Client-IP des Aufrufess muss die gleiche sein, mit der eingeloggt wurde.
|
||||
|
||||
|
||||
Mit einem gültigen Access-Token kannst du eine session_id erhalten.
|
||||
GET https://staging.gradido.net/appRequest/appLogin?access_token =
|
||||
Mit jedem Aufruf wird die Gültigkeit der Access-Tokens erneuert.
|
||||
Antwort:
|
||||
```
|
||||
{
|
||||
"state":"success",
|
||||
"session_id" : "<integer>"
|
||||
}
|
||||
```
|
||||
# Kontoübersicht:
|
||||
Liefert den aktuellen Kontostand.
|
||||
Ajax:
|
||||
GET https://staging.gradido.net/state-balances/ajaxGetBalance
|
||||
Antwort:
|
||||
`{"state":"success","balance":<GDD cent (4 Nachkommastellen)>}`
|
||||
|
||||
Listet die letzten Transaktionen auf, mit Paging.
|
||||
Ajax:
|
||||
GET https://staging.gradido.net/state-user-transactions/ajaxListTransactions//
|
||||
page: Seite der Transaktionen, default = 1
|
||||
count: Wie viele Transaktionen pro Seite, default = 20
|
||||
|
||||
Antwort:
|
||||
Wenn alles okay:
|
||||
```
|
||||
{"state":"success", "transactions":
|
||||
[
|
||||
{
|
||||
"name": "<first_name last_name>",
|
||||
"email": "<other_user.email>", //optional, only if send or receive and other user is known
|
||||
"type": "creation|send|receive",
|
||||
"transaction_id": <transaction_id>, // db id not id from blockchain
|
||||
"date": "<date string>",
|
||||
"balance": <GDD balance in GDD cent /10000>,
|
||||
"memo": "<Verwendungszweck>",
|
||||
"pubkey": "<other_user.public_key in hex>"
|
||||
|
||||
}
|
||||
],
|
||||
"transactionExecutingCount": <how many transaction for this user currently pending>,
|
||||
"count": <sum of finished transactions user is involved>
|
||||
}
|
||||
```
|
||||
Holt die aktuelle Summe und Anzahl Einträge vom GDT Server für den Benutzer.
|
||||
Ajax:
|
||||
GET https://staging.gradido.net/state-balances/ajaxGdtOverview
|
||||
```{"state": "success", "gdt": {"sum": <sum of all gdt transactions>, "count":<count of all gdt transactions>}}```
|
||||
|
||||
|
||||
# 🌟 [EPIC] - Gradido Web- and App- Client
|
||||
|
||||
Web-App:
|
||||
Einstiegspunkt:
|
||||
[ ] Login-Server for app-requests (Sollte in der App einstellbar sein) https://staging.gradido.net/appRequest
|
||||
|
||||
[ ] Auch die url für Community-Server requests sollte in einer Variable gespeichert sein.
|
||||
CakePHP Seite auf die der Login-Server nach dem Login weiterleitet.
|
||||
https://staging.gradido.net/client
|
||||
|
||||
Hiermit kann ein Konto anlegt werden:
|
||||
https://staging.gradido.net/account/registerDirect
|
||||
|
||||
|
||||
# Fehler im Code
|
||||
Wenn etwas nicht stimmt, entweder mit den Input-Paremetern, oder ein Fehler im Code gibt es meistens folgendes als Ergebnis:
|
||||
```
|
||||
@ -193,6 +339,8 @@ GET https://staging.gradido.net/state-balances/ajaxGdtOverview
|
||||
|
||||
Holt die letzten 100 GDT-Einträge für den Benutzer
|
||||
|
||||
|
||||
|
||||
Ein GDT Eintrag sieht so aus:
|
||||
```
|
||||
{
|
||||
@ -209,6 +357,7 @@ Ein GDT Eintrag sieht so aus:
|
||||
"gdt": 1000
|
||||
}
|
||||
```
|
||||
|
||||
gdt entry types: (Auf welchen Weg der Eintrag eingetragen wurde)
|
||||
1. Form: einzeln über das Formular, sollte nur wenige Einträg e betreffen
|
||||
2. CVS: CVS Import, betrifft vor allem ältere Einträge von Spenden die weder über Elopage noch über Digistore reinkamen
|
||||
@ -237,4 +386,4 @@ Insbesondere durch den publishersPath, connect enthält einfach nur alle möglic
|
||||
TODO: Update GDT-Server um paging und Zugriff auf alle Einträge zu erhalten, optimierter Zugriff
|
||||
GET https://staging.gradido.net/state-balances/ajaxGdtTransactions
|
||||
Liefert wenn alles in Ordnung ist:
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user