Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tacxou authored Aug 3, 2023
0 parents commit 87219ea
Show file tree
Hide file tree
Showing 42 changed files with 8,784 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/
.DS_Store/
.idea/
.env
npm-debug.log*
yarn-debug.log*
yarn-error.log*
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120

[Makefile]
indent_style = tab

[*.md]
trim_trailing_whitespace = false
21 changes: 21 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
APPNAME=template

MONGOOSE_URL=mongodb://template-mongodb:27017/myreport
IOREDIS_URL=redis://template-redis:6379/1

JWT_SECRET=1212974
CRYPT_SECURITYKEY=78987946

PASSPORT_LDAP_URL=ldap://template-openldap:389
PASSPORT_LDAP_BINDDN=cn=admin,dc=test,dc=local
PASSPORT_LDAP_BINDCREDENTIALS=
PASSPORT_LDAP_SEARCHBASE=dc=test,dc=local
LDAP_LOG_LEVEL=trace

MAILER_TRANSPORT_HOST=template-maildev
MAILER_TRANSPORT_PORT=1025
MAILER_TRANSPORT_SECURE=0
MAILER_TRANSPORT_IGNORETLS=0
MAILER_TRANSPORT_AUTHUSER=''
MAILER_TRANSPORT_AUTHPASS=''
MAILER_DEFAULTS_FROM="'test' <[email protected]>"
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
root: true,
env: {
node: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'no-console': 0,
'comma-dangle': [2, 'always-multiline'],
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-inferrable-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
},
};
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
23 changes: 23 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Docker Image CI

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout the code
uses: actions/checkout@v2

- name: Build docker Nuxt
uses: Libertech-FR/lt-actions/docker-image@main
with:
repository: ${{ github.repository }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
18 changes: 18 additions & 0 deletions .github/workflows/issue-spend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Update Time Spent On Issues

on:
issue_comment:
types: [created, edited]

jobs:
get-comments:
if: ${{ startsWith(github.event.comment.body, '!spend') }}
runs-on: ubuntu-latest
outputs:
comments: ${{ steps.generate-matrix.outputs.comments }}

steps:
- name: Time spent control
uses: Libertech-FR/lt-actions/issue-spend@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Release

on:
workflow_dispatch:
inputs:
version_increment:
description: 'La version a incrémenter (major, minor, patch)'
required: true
default: 'patch'
type: choice
options:
- 'major'
- 'minor'
- 'patch'
build_docker_image:
description: "Construire l'image docker ?"
required: true
default: true
type: boolean
latest:
description: "Tagger l'image docker avec le tag 'latest' ?"
required: true
default: true
type: boolean

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Build docker
uses: Libertech-FR/lt-actions/release@main
with:
version_increment: ${{ github.event.inputs.version_increment }}
build_docker_image: ${{ github.event.inputs.build_docker_image }}
latest: ${{ github.event.inputs.latest }}
repository: ${{ github.repository }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
access_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# Optional parameters, thoses are default values :
registry: 'ghcr.io'
context: .
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/
.DS_Store/
.idea/
.env
npm-debug.log*
yarn-debug.log*
yarn-error.log*
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/
.DS_Store/
.idea/
.env
npm-debug.log*
yarn-debug.log*
yarn-error.log*
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "always",
"printWidth": 120,
"bracketSpacing": true
}
44 changes: 44 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM node:18.14.0-alpine AS builder

WORKDIR /usr/src/app

COPY . .

RUN apk add git && yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive \
--production=false

RUN yarn run build

FROM node:18.14.0-alpine AS production

ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}

WORKDIR /usr/src/app

ADD Makefile .
ADD package.json .
ADD *.lock .

RUN apk add --no-cache \
openssl \
git \
jq \
nano

RUN yarn install \
--prefer-offline \
--pure-lockfile \
--non-interactive \
--production=true

#COPY . .

COPY --from=builder /usr/src/app/dist ./dist

EXPOSE 4000

CMD ["yarn", "start:prod"]
109 changes: 109 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
IMGNAME?=exemple
APPNAME?=exemple
APPPORT?=4500

LDAPORGANISATION?=exemple
LDAPDOMAIN?=exemple.local
LDAPPASSWORD?=
OPENLDAP_PORT?=389

MAILDEVPORTWEB?=1080
MAILDEVPORTMAIL?=1025

init:
@docker build -t $(IMGNAME) .
@docker exec -it $(APPNAME) yarn install

build:
docker build -t $(IMGNAME) .

push:
docker push $(IMGNAME)

compile:
docker exec -it $(APPNAME) yarn build

dev:
@docker run -it --rm \
-e NODE_ENV=development \
-e NODE_TLS_REJECT_UNAUTHORIZED=0 \
--add-host host.docker.internal:host-gateway \
--name $(APPNAME) \
--network dev \
-p $(APPPORT):4000 \
-v $(CURDIR):/usr/src/app \
$(IMGNAME) yarn start:dev

exec:
@docker run -it --rm \
--add-host host.docker.internal:host-gateway \
-e NODE_ENV=development \
--network dev \
-v $(CURDIR):/usr/src/app \
$(IMGNAME) sh

generate:
@docker exec -it $(APPNAME) yarn generate

dbs:
@docker run --rm -d \
--name $(APPNAME)-openldap \
-e LDAP_ORGANISATION=$(LDAPORGANISATION) \
-e LDAP_DOMAIN=$(LDAPDOMAIN) \
-e LDAP_ADMIN_PASSWORD=$(LDAPPASSWORD) \
--network dev \
-v $(CURDIR)/openldap/custom:/container/service/slapd/assets/config/bootstrap/ldif/custom \
-p $(OPENLDAP_PORT):389 \
osixia/openldap:1.5.0 --loglevel debug --copy-service

@docker volume create $(APPNAME)-redis
@docker run -d --rm \
--name $(APPNAME)-redis \
--network dev \
-p 6379:6379 \
redis
@docker volume create $(APPNAME)-mongodb
@docker run -d --rm \
--name $(APPNAME)-mongodb \
-v $(APPNAME)-mongodb:/data/db \
-p 27017:27017 \
--network dev \
mongo:5.0 --wiredTigerCacheSizeGB 1.5 --quiet || true

@docker run --rm -d \
--name $(APPNAME)-ldapadmin \
-e PHPLDAPADMIN_LDAP_HOSTS=ga.service.usermanager.openldap \
-e PHPLDAPADMIN_LDAP_HOSTS="#PYTHON2BASH:[{'$(APPNAME)-openldap': [{'login': [{'bind_id': 'cn=admin,dc=test,dc=local'}]}]}]" \
-v $(CURDIR)/phpldapadmin/exemples/:/data/exemples \
-p 6443:443 \
--network dev \
osixia/phpldapadmin || true

@docker run --rm -d --name $(APPNAME)-maildev \
-p $(MAILDEVPORTWEB):1080 \
-p $(MAILDEVPORTMAIL):1025 \
--network dev \
maildev/maildev || true

stop:
@docker stop $(APPNAME)-maildev || true
@docker stop $(APPNAME)-ldapadmin || true
@docker stop $(APPNAME)-mongodb || true
@docker stop $(APPNAME)-redis || true
@docker stop $(APPNAME)-openldap || true
@docker stop $(APPNAME) || true

rm:
docker rm $(shell docker ps -a -q -f name=$(APPNAME))


openldap:
docker run --rm -it \
--name $(APPNAME)-openldap \
-e LDAP_ORGANISATION=$(LDAPORGANISATION) \
-e LDAP_DOMAIN=$(LDAPDOMAIN) \
-e LDAP_ADMIN_PASSWORD=$(LDAPPASSWORD) \
--network dev \
-v $(CURDIR)/openldap/custom:/container/service/slapd/assets/config/bootstrap/ldif/custom \
-p $(OPENLDAP_PORT):389 \
osixia/openldap:1.5.0 --loglevel trace --copy-service
Loading

0 comments on commit 87219ea

Please sign in to comment.