Initial Commit
This commit is contained in:
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
||||
.tmp
|
||||
bin
|
||||
node_modules
|
||||
.dockerignore
|
||||
.env
|
||||
Dockerfile
|
||||
Jenkinsfile
|
||||
post-install-setup.txt
|
||||
3
.eslintignore
Normal file
3
.eslintignore
Normal file
@@ -0,0 +1,3 @@
|
||||
.cache
|
||||
build
|
||||
**/node_modules/**
|
||||
27
.eslintrc
Normal file
27
.eslintrc
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"parser": "babel-eslint",
|
||||
"extends": "eslint:recommended",
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"node": true,
|
||||
"browser": false
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"experimentalObjectRestSpread": true,
|
||||
"jsx": false
|
||||
},
|
||||
"sourceType": "module"
|
||||
},
|
||||
"globals": {
|
||||
"strapi": true
|
||||
},
|
||||
"rules": {
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"no-console": 0,
|
||||
"quotes": ["error", "single"],
|
||||
"semi": ["error", "always"]
|
||||
}
|
||||
}
|
||||
114
.gitignore
vendored
Normal file
114
.gitignore
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
############################
|
||||
# OS X
|
||||
############################
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
Icon
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
._*
|
||||
|
||||
|
||||
############################
|
||||
# Linux
|
||||
############################
|
||||
|
||||
*~
|
||||
|
||||
|
||||
############################
|
||||
# Windows
|
||||
############################
|
||||
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
$RECYCLE.BIN/
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
|
||||
############################
|
||||
# Packages
|
||||
############################
|
||||
|
||||
*.7z
|
||||
*.csv
|
||||
*.dat
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.seed
|
||||
*.so
|
||||
*.swo
|
||||
*.swp
|
||||
*.swn
|
||||
*.swm
|
||||
*.out
|
||||
*.pid
|
||||
|
||||
|
||||
############################
|
||||
# Logs and databases
|
||||
############################
|
||||
|
||||
.tmp
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
|
||||
|
||||
############################
|
||||
# Misc.
|
||||
############################
|
||||
|
||||
*#
|
||||
ssl
|
||||
.idea
|
||||
nbproject
|
||||
public/uploads/*
|
||||
!public/uploads/.gitkeep
|
||||
|
||||
############################
|
||||
# Node.js
|
||||
############################
|
||||
|
||||
lib-cov
|
||||
lcov.info
|
||||
pids
|
||||
logs
|
||||
results
|
||||
node_modules
|
||||
.node_history
|
||||
|
||||
############################
|
||||
# Tests
|
||||
############################
|
||||
|
||||
testApp
|
||||
coverage
|
||||
|
||||
############################
|
||||
# Strapi
|
||||
############################
|
||||
|
||||
.env
|
||||
license.txt
|
||||
exports
|
||||
*.cache
|
||||
build
|
||||
.strapi-updater.json
|
||||
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM node:16-alpine
|
||||
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN npm install --only=production
|
||||
|
||||
ENTRYPOINT npm start
|
||||
EXPOSE 3000
|
||||
65
Jenkinsfile
vendored
Normal file
65
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
#!groovy
|
||||
|
||||
node {
|
||||
stage('Checkout') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('Prepare') {
|
||||
sh 'git rev-parse --verify HEAD > GIT_COMMIT'
|
||||
env.GIT_COMMIT = readFile('GIT_COMMIT').trim().substring(0, 10)
|
||||
sh 'rm GIT_COMMIT'
|
||||
def jobName = env.JOB_NAME.tokenize('/')
|
||||
print env.jobName
|
||||
|
||||
// set env
|
||||
env.DOCKER_NAME="${jobName[0]}/${jobName[1]}:${env.BRANCH_NAME}-${env.GIT_COMMIT}"
|
||||
env.DOCKER_REGISTRY="docker.sebse.de"
|
||||
|
||||
env.NODEJS_HOME = "${tool 'node16'}"
|
||||
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
|
||||
|
||||
def customImage
|
||||
}
|
||||
|
||||
/*stage('Test') {
|
||||
env.NODE_ENV = "test"
|
||||
print "Environment will be : ${env.NODE_ENV}"
|
||||
sh 'node -v'
|
||||
sh 'npm prune'
|
||||
sh 'npm install'
|
||||
sh 'npm test'
|
||||
}*/
|
||||
|
||||
stage('Build Prod') {
|
||||
env.NODE_ENV = "production"
|
||||
print "Environment will be : ${env.NODE_ENV}"
|
||||
|
||||
sh 'node -v'
|
||||
sh 'npm prune'
|
||||
sh 'npm install --production=false'
|
||||
sh 'npm run build'
|
||||
sh 'rm node_modules -rf'
|
||||
}
|
||||
|
||||
stage('Build Docker') {
|
||||
customImage = docker.build(env.DOCKER_NAME)
|
||||
}
|
||||
|
||||
stage('Deploy') {
|
||||
echo 'Push to Repo'
|
||||
docker.withRegistry("https://${DOCKER_REGISTRY}", 'docker-registry-robot-web-development') {
|
||||
/* Push the container to the custom Registry */
|
||||
customImage.push()
|
||||
}
|
||||
}
|
||||
|
||||
stage('Cleanup') {
|
||||
echo 'prune and cleanup'
|
||||
sh 'npm prune'
|
||||
sh 'rm node_modules -rf'
|
||||
sh "docker rmi ${env.DOCKER_NAME} ${DOCKER_REGISTRY}/${env.DOCKER_NAME}"
|
||||
sh 'docker image prune -f'
|
||||
sh 'docker rmi $(docker images -a | grep "<none>" | awk "{print \$3}") &2>/del/null || exit 0'
|
||||
}
|
||||
}
|
||||
57
README.md
Normal file
57
README.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# 🚀 Getting started with Strapi
|
||||
|
||||
Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html) (CLI) which lets you scaffold and manage your project in seconds.
|
||||
|
||||
### `develop`
|
||||
|
||||
Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-develop)
|
||||
|
||||
```
|
||||
npm run develop
|
||||
# or
|
||||
yarn develop
|
||||
```
|
||||
|
||||
### `start`
|
||||
|
||||
Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-start)
|
||||
|
||||
```
|
||||
npm run start
|
||||
# or
|
||||
yarn start
|
||||
```
|
||||
|
||||
### `build`
|
||||
|
||||
Build your admin panel. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-build)
|
||||
|
||||
```
|
||||
npm run build
|
||||
# or
|
||||
yarn build
|
||||
```
|
||||
|
||||
## ⚙️ Deployment
|
||||
|
||||
Strapi gives you many possible deployment options for your project. Find the one that suits you on the [deployment section of the documentation](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment.html).
|
||||
|
||||
## 📚 Learn more
|
||||
|
||||
- [Resource center](https://strapi.io/resource-center) - Strapi resource center.
|
||||
- [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation.
|
||||
- [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community.
|
||||
- [Strapi blog](https://docs.strapi.io) - Official Strapi blog containing articles made by the Strapi team and the community.
|
||||
- [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements.
|
||||
|
||||
Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome!
|
||||
|
||||
## ✨ Community
|
||||
|
||||
- [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team.
|
||||
- [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
|
||||
- [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi.
|
||||
|
||||
---
|
||||
|
||||
<sub>🤫 Psst! [Strapi is hiring](https://strapi.io/careers).</sub>
|
||||
70
bin/postinstall.js
Normal file
70
bin/postinstall.js
Normal file
@@ -0,0 +1,70 @@
|
||||
const fs = require("fs/promises")
|
||||
|
||||
;(async () => {
|
||||
const PATH_BOOTSTRAP = './node_modules/@strapi/plugin-users-permissions/server/bootstrap/index.js'
|
||||
if (await fs.access(PATH_BOOTSTRAP).then(() => true, () => false)) {
|
||||
let data = await fs.readFile(PATH_BOOTSTRAP, 'utf8')
|
||||
data = data.replace(` const grantConfig = {
|
||||
email: {`, ` const grantConfig = {
|
||||
keycloak: {
|
||||
enabled: false,
|
||||
icon: 'key',
|
||||
key: '',
|
||||
secret: '',
|
||||
oauth: 2,
|
||||
subdomain: '',
|
||||
callback: \`\${baseURL}/keycloak/callback\`,
|
||||
scope: ['profile', 'email', 'roles', 'openid'],
|
||||
},
|
||||
email: {`)
|
||||
await fs.writeFile(PATH_BOOTSTRAP, data, 'utf8')
|
||||
} else {
|
||||
console.log("File not found:", PATH_BOOTSTRAP)
|
||||
}
|
||||
|
||||
|
||||
const PATH_SERVICES = './node_modules/@strapi/plugin-users-permissions/server/services/providers.js'
|
||||
if (await fs.access(PATH_SERVICES).then(() => true, () => false)) {
|
||||
let data = await fs.readFile(PATH_SERVICES, 'utf8')
|
||||
data = data.replace(` switch (provider) {
|
||||
case 'discord': {`, ` switch (provider) {
|
||||
case 'keycloak': {
|
||||
const keycloak = purest({
|
||||
provider: 'keycloak',
|
||||
config: {
|
||||
'keycloak': {
|
||||
'https://auth.sebse.de/auth/realms/public': {
|
||||
'__domain': {
|
||||
'auth': {
|
||||
'auth': {
|
||||
'bearer': '[0]'
|
||||
}
|
||||
},
|
||||
},
|
||||
'{endpoint}': {
|
||||
'__path': {
|
||||
'alias': '__default',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
keycloak.query().get('protocol/openid-connect/userinfo').auth(access_token).request((err, res, body) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, {
|
||||
username: body.preferred_username,
|
||||
email: body.email
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'discord': {`)
|
||||
await fs.writeFile(PATH_SERVICES, data, 'utf8')
|
||||
} else {
|
||||
console.log("File not found:", PATH_SERVICES)
|
||||
}
|
||||
})()
|
||||
5
config/admin.js
Normal file
5
config/admin.js
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = ({ env }) => ({
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET', '1788c16dbca0d54e6990d8dce6a2cf3b'),
|
||||
},
|
||||
});
|
||||
7
config/api.js
Normal file
7
config/api.js
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = {
|
||||
rest: {
|
||||
defaultLimit: 25,
|
||||
maxLimit: 100,
|
||||
withCount: true,
|
||||
},
|
||||
};
|
||||
29
config/database.js
Normal file
29
config/database.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const path = require('path');
|
||||
|
||||
const sqlDb = (env, client) => ({
|
||||
host: env('DATABASE_HOST', '127.0.0.1'),
|
||||
port: env.int('DATABASE_PORT', client === 'postgres' ? 5432 : 3306),
|
||||
database: env('DATABASE_NAME', 'strapi'),
|
||||
user: env('DATABASE_USERNAME', 'strapi'),
|
||||
password: env('DATABASE_PASSWORD', 'strapi'),
|
||||
schema: client === 'postgres' ? env('DATABASE_SCHEMA', 'public') : undefined,
|
||||
ssl: {
|
||||
rejectUnauthorized: env.bool('DATABASE_SSL_SELF', false), // For self-signed certificates
|
||||
}
|
||||
})
|
||||
|
||||
const sqlLite = (env) => ({
|
||||
filename: path.join(__dirname, '..', env('DATABASE_FILENAME', '.tmp/data.db')),
|
||||
})
|
||||
|
||||
module.exports = ({ env }) => {
|
||||
const client = env('DATABASE_CLIENT', 'sqlite')
|
||||
return ({
|
||||
connection: {
|
||||
client,
|
||||
connection: client === 'sqlite' ? sqlLite(env) : sqlDb(env, client),
|
||||
useNullAsDefault: true,
|
||||
debug: env('NODE_ENV', 'development') === 'development'
|
||||
},
|
||||
});
|
||||
};
|
||||
12
config/middlewares.js
Normal file
12
config/middlewares.js
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = [
|
||||
'strapi::errors',
|
||||
'strapi::security',
|
||||
'strapi::cors',
|
||||
'strapi::poweredBy',
|
||||
'strapi::logger',
|
||||
'strapi::query',
|
||||
'strapi::body',
|
||||
'strapi::session',
|
||||
'strapi::favicon',
|
||||
'strapi::public',
|
||||
];
|
||||
8
config/server.js
Normal file
8
config/server.js
Normal file
@@ -0,0 +1,8 @@
|
||||
module.exports = ({ env }) => ({
|
||||
host: env('HOST', '0.0.0.0'),
|
||||
port: env.int('PORT', 3000),
|
||||
url: env('URL', ''),
|
||||
app: {
|
||||
keys: env.array('APP_KEYS'),
|
||||
},
|
||||
});
|
||||
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.6 KiB |
30725
package-lock.json
generated
Normal file
30725
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
28
package.json
Normal file
28
package.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "my-project",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"description": "A Strapi application",
|
||||
"scripts": {
|
||||
"develop": "strapi develop",
|
||||
"start": "strapi start",
|
||||
"build": "strapi build",
|
||||
"strapi": "strapi",
|
||||
"postinstall": "node ./bin/postinstall.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@strapi/plugin-graphql": "^4.0.6",
|
||||
"@strapi/plugin-i18n": "4.0.6",
|
||||
"@strapi/plugin-users-permissions": "4.0.6",
|
||||
"@strapi/strapi": "4.0.6",
|
||||
"sqlite3": "5.0.2"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.x.x <=16.x.x",
|
||||
"npm": ">=6.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
73
post-install-setup.txt
Normal file
73
post-install-setup.txt
Normal file
@@ -0,0 +1,73 @@
|
||||
# setup on admin page
|
||||
|
||||
client: web
|
||||
secret: <client secret>
|
||||
subdomain: auth.sebse.de/auth/realms/public
|
||||
redirect after login: / <somewhere in the app>
|
||||
|
||||
|
||||
# remove uuid from package.json
|
||||
|
||||
|
||||
|
||||
|
||||
# add strapi user to mongo
|
||||
|
||||
sudo docker-compose exec mongo mongo -u root --authenticationDatabase admin -p
|
||||
use admin
|
||||
db.createUser({user: "strapi" , pwd: "<DB USER PW>", roles: [ "userAdminAnyDatabase","readWriteAnyDatabase" ]})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# strapi-data/node_modules/strapi-plugin-users-permissions/config/functions/bootstrap.js
|
||||
|
||||
keycloak: {
|
||||
enabled: false,
|
||||
icon: 'key',
|
||||
key: '',
|
||||
secret: '',
|
||||
oauth: 2,
|
||||
subdomain: '',
|
||||
callback: `${strapi.config.server.url}/auth/keycloak/callback`,
|
||||
scope: ['profile', 'email', 'roles', 'openid'],
|
||||
},
|
||||
|
||||
|
||||
# strapi-data/node_modules/strapi-plugin-users-permissions/services/Providers.js
|
||||
|
||||
case 'keycloak': {
|
||||
const keycloak = purest({
|
||||
provider: 'keycloak',
|
||||
config: {
|
||||
'keycloak': {
|
||||
'https://auth.sebse.de/auth/realms/public': {
|
||||
'__domain': {
|
||||
'auth': {
|
||||
'auth': {
|
||||
'bearer': '[0]'
|
||||
}
|
||||
},
|
||||
},
|
||||
'{endpoint}': {
|
||||
'__path': {
|
||||
'alias': '__default',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
keycloak.query().get('protocol/openid-connect/userinfo').auth(access_token).request((err, res, body) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, {
|
||||
username: body.preferred_username,
|
||||
email: body.email
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
3
public/robots.txt
Normal file
3
public/robots.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
|
||||
# User-Agent: *
|
||||
# Disallow: /
|
||||
0
public/uploads/.gitkeep
Normal file
0
public/uploads/.gitkeep
Normal file
35
src/admin/app.example.js
Normal file
35
src/admin/app.example.js
Normal file
@@ -0,0 +1,35 @@
|
||||
export default {
|
||||
config: {
|
||||
locales: [
|
||||
// 'ar',
|
||||
// 'fr',
|
||||
// 'cs',
|
||||
// 'de',
|
||||
// 'dk',
|
||||
// 'es',
|
||||
// 'he',
|
||||
// 'id',
|
||||
// 'it',
|
||||
// 'ja',
|
||||
// 'ko',
|
||||
// 'ms',
|
||||
// 'nl',
|
||||
// 'no',
|
||||
// 'pl',
|
||||
// 'pt-BR',
|
||||
// 'pt',
|
||||
// 'ru',
|
||||
// 'sk',
|
||||
// 'sv',
|
||||
// 'th',
|
||||
// 'tr',
|
||||
// 'uk',
|
||||
// 'vi',
|
||||
// 'zh-Hans',
|
||||
// 'zh',
|
||||
],
|
||||
},
|
||||
bootstrap(app) {
|
||||
console.log(app);
|
||||
},
|
||||
};
|
||||
9
src/admin/webpack.config.example.js
Normal file
9
src/admin/webpack.config.example.js
Normal file
@@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
module.exports = (config, webpack) => {
|
||||
// Note: we provide webpack above so you should not `require` it
|
||||
// Perform customizations to webpack config
|
||||
// Important: return the modified config
|
||||
return config;
|
||||
};
|
||||
0
src/api/.gitkeep
Normal file
0
src/api/.gitkeep
Normal file
0
src/extensions/.gitkeep
Normal file
0
src/extensions/.gitkeep
Normal file
20
src/index.js
Normal file
20
src/index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* An asynchronous register function that runs before
|
||||
* your application is initialized.
|
||||
*
|
||||
* This gives you an opportunity to extend code.
|
||||
*/
|
||||
register(/*{ strapi }*/) {},
|
||||
|
||||
/**
|
||||
* An asynchronous bootstrap function that runs before
|
||||
* your application gets started.
|
||||
*
|
||||
* This gives you an opportunity to set up your data model,
|
||||
* run jobs, or perform some special logic.
|
||||
*/
|
||||
bootstrap(/*{ strapi }*/) {},
|
||||
};
|
||||
Reference in New Issue
Block a user