frontend start

This commit is contained in:
2025-02-15 16:20:54 +01:00
parent 20bf6719e4
commit f2dc298f84
25 changed files with 18536 additions and 46 deletions

View File

@ -9,17 +9,17 @@ logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
# Initialize Flask app # Initialize Flask app
app = Flask(__name__) MyApp = Flask(__name__)
app.config['SECRET_KEY'] = 'your-secret-key-here' MyApp.config['SECRET_KEY'] = 'your-secret-key-here'
class ResourceRouter: class ResourceRouter:
def __init__(self): def __init__(self):
self.resource_mappings = { self.resource_mappings = {
'login': {'backend_url': 'http://beere5:5000/login', 'methods': ['POST']}, 'login': {'backend_url': 'http://linepe.de:5004/login', 'methods': ['POST']},
'logout': {'backend_url': 'http://beere5:5000/logout', 'methods': ['POST']}, 'logout': {'backend_url': 'http://linepe.de:5004/logout', 'methods': ['POST']},
'register': {'backend_url': 'http://beere5:5000/register', 'methods': ['POST']}, 'register': {'backend_url': 'http://linepe.de:5004/register', 'methods': ['POST']},
'listing': {'backend_url': 'http://beere5:5001/listing', 'methods': ['GET', 'POST', 'PUT', 'DELETE']}, 'listing': {'backend_url': 'http://linepe.de:5005/listing', 'methods': ['GET', 'POST', 'PUT', 'DELETE']},
'listings': {'backend_url': 'http://beere5:5001/listings', 'methods': ['GET', 'POST', 'PUT', 'DELETE']} 'listings': {'backend_url': 'http://linepe.de:5005/listings', 'methods': ['GET', 'POST', 'PUT', 'DELETE']}
} }
def get_backend_info(self, resource_path): def get_backend_info(self, resource_path):
@ -59,12 +59,12 @@ def handle_backend_response(response):
logger.error("Failed to decode backend response") logger.error("Failed to decode backend response")
return jsonify({"error": "Invalid response format"}), 500 return jsonify({"error": "Invalid response format"}), 500
@app.route('/') @MyApp.route('/')
def home(): def home():
"""Health check endpoint""" """Health check endpoint"""
return jsonify({'status': 'ok', 'message': 'API gateway is running'}) return jsonify({'status': 'ok', 'message': 'API gateway is running'})
@app.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE']) @MyApp.route('/<path:path>', methods=['GET', 'POST', 'PUT', 'DELETE'])
def generic_proxy(path): def generic_proxy(path):
"""Generic route handler for all API resources""" """Generic route handler for all API resources"""
@ -112,4 +112,4 @@ def generic_proxy(path):
return jsonify({"error": str(e)}), 500 return jsonify({"error": str(e)}), 500
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=True, port=5000) MyApp.run(debug=True, port=5000)

1
api/passenger_wsgi.py Normal file
View File

@ -0,0 +1 @@
from app import MyApp as application

View File

@ -0,0 +1,38 @@
version: "3.9"
services:
mysql:
image: mysql
volumes:
- ./data:/var/lib/mysql
- ./certs:/etc/mysql/certs
environment:
- MYSQL_ROOT_PASSWORD=Abc123
- MYSQL_DATABASE=test
- MYSQL_USER=test
- MYSQL_PASSWORD=test
command:
- --ssl-ca=/etc/mysql/certs/ca.crt
- --ssl-cert=/etc/mysql/certs/mysql.crt
- --ssl-key=/etc/mysql/certs/mysql.key
- --ssl=1
- --bind-address=0.0.0.0
ports:
- 3306:3306
cert-gen:
image: alpine
volumes:
- ./certs:/certs
entrypoint:
- /bin/sh
- -c
- |
apk add --no-cache openssl &&
openssl genpkey -algorithm RSA -out /certs/mysql.key -pkeyopt rsa_keygen_bits:2048 &&
openssl req -new -key /certs/mysql.key -out /certs/mysql.csr -subj "/CN=mysql/O=myorg/C=US" &&
openssl x509 -req -in /certs/mysql.csr -signkey /certs/mysql.key -out /certs/mysql.crt -days 365 &&
openssl genpkey -algorithm RSA -out /certs/ca.key -pkeyopt rsa_keygen_bits:2048 &&
openssl req -new -x509 -key /certs/ca.key -out /certs/ca.crt -days 1095 -subj "/CN=Certificate Authority/O=myorg/C=US" &&
chmod 600 /certs/* && chown 999:999 /certs/*
restart: "no"

77
backend/jenkins/ww_db Normal file
View File

@ -0,0 +1,77 @@
pipeline {
agent {
docker {
image 'python:3'
}
}
stages {
stage('Checkout Code') {
steps {
git url: 'http://linepe.de:5050/volume1/git/workspacewanderers.git',
branch: 'main',
credentialsId: 'cred_nas_git'
}
}
stage('Set Up Dependencies') {
steps {
sh '''
apt-get update && apt-get install -y python3 python3-pip
pip install --upgrade pip
pip install flask pytest
'''
}
}
stage('Build Docker Image') {
steps {
sh '''
docker build -t service1:latest .
'''
}
}
stage('Run Tests') {
steps {
sh '''
pytest --cov tests/
'''
}
}
stage('Push to Local Registry') {
steps {
sh '''
docker login --username your-registry-username \
--password your-registry-password http://localhost:5000
docker tag service1:latest localhost:5000/service1:latest
docker push localhost:5000/service1:latest
'''
}
}
stage('Deploy Service') {
steps {
sh '''
# Replace with your deployment strategy (e.g., Docker Compose)
docker run -d --name service1 localhost:5000/service1:latest
'''
}
}
}
post {
success {
mail to: 'notification@example.com',
subject: 'Jenkins Build Successful for Service 1',
body: 'The build and deployment of Service 1 were successful.'
}
failure {
mail to: 'notification@example.com',
subject: 'Jenkins Build Failed for Service 1',
body: 'The build or deployment of Service 1 failed. Please investigate.'
}
}
}

View File

@ -1,5 +1,5 @@
COMPOSE_PROJECT_NAME=ww_db COMPOSE_PROJECT_NAME=ww_db
DB_HOST=192.168.178.24 # Matches the service name in docker-compose.yml DB_HOST=beere5 # Matches the service name in docker-compose.yml
DB_USER=linepe DB_USER=linepe
DB_PASSWORD=test DB_PASSWORD=test
DB_NAME=workspacewanderers_test DB_NAME=workspacewanderers_test

View File

@ -1,26 +1,12 @@
version: '3' version: '3'
services: services:
db:
image: mysql:8
volumes:
- ./db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
ports:
- "3306:3306"
networks:
- app-network
flask_app: flask_app:
build: . build: .
ports: ports:
- "5001:5001" - "5001:5001"
environment: environment:
DB_HOST: db DB_HOST: ${DB_HOST}
DB_USER: ${DB_USER} DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD} DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME} DB_NAME: ${DB_NAME}

View File

@ -1,5 +1,5 @@
COMPOSE_PROJECT_NAME=ww_db COMPOSE_PROJECT_NAME=ww_db
DB_HOST=192.168.178.24 # Matches the service name in docker-compose.yml DB_HOST=beere5 # Matches the service name in docker-compose.yml
DB_USER=linepe DB_USER=linepe
DB_PASSWORD=test DB_PASSWORD=test
DB_NAME=workspacewanderers_test DB_NAME=workspacewanderers_test

View File

@ -88,6 +88,7 @@ def register_user():
logging.error(f"Registration error: {str(e)}") logging.error(f"Registration error: {str(e)}")
return jsonify({'error': str(e)}), 500 return jsonify({'error': str(e)}), 500
finally: finally:
if 'cursor' in locals():
cursor.close() cursor.close()
connection.close() connection.close()

View File

@ -1,26 +1,12 @@
version: '3' version: '3'
services: services:
db:
image: mysql:8
volumes:
- ./db_data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root_password
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
ports:
- "3306:3306"
networks:
- app-network
flask_app: flask_app:
build: . build: .
ports: ports:
- "5001:5001" - "5001:5001"
environment: environment:
DB_HOST: db DB_HOST: ${DB_HOST}
DB_USER: ${DB_USER} DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD} DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME} DB_NAME: ${DB_NAME}

23
frontend/workspacewanderers/.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -0,0 +1,24 @@
# workspacewanderers
## Project setup
```
yarn install
```
### Compiles and hot-reloads for development
```
yarn serve
```
### Compiles and minifies for production
```
yarn build
```
### Lints and fixes files
```
yarn lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

11676
frontend/workspacewanderers/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
{
"name": "workspacewanderers",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.8.3",
"vue": "^3.2.13",
"vuetify": "^3.7.12"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@mdi/font": "^7.4.47",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"material-design-icons-iconfont": "^6.7.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "@babel/eslint-parser"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@ -0,0 +1,25 @@
<template>
<LandingPage msg="Welcome to Your Vue.js App"/>
</template>
<script>
import LandingPage from './components/LandingPage.vue'
export default {
name: 'App',
components: {
LandingPage
}
}
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1,58 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>

View File

@ -0,0 +1,159 @@
<template>
<v-app>
<!-- Navigation -->
<nav class="primary-color">
<v-container>
<v-row align="center" class="height-100">
<v-col cols="12" md="4">
<h1 class="white--text text-h3 font-weight-bold">Workspace Wanderers</h1>
</v-col>
<v-col cols="12" md="8">
<v-toolbar flat class="nav__toolbar">
<v-spacer></v-spacer>
<v-tabs align-with-content color="white">
<v-tab>Home</v-tab>
<v-tab>Spaces</v-tab>
<v-tab>Pricing</v-tab>
<v-tab>Contact</v-tab>
</v-tabs>
</v-toolbar>
</v-col>
</v-row>
</v-container>
</nav>
<!-- Hero Section -->
<section class="hero">
<v-container>
<v-row align="center" height="80vh">
<v-col cols="12" md="6">
<h1 class="text-h1 font-weight-bold">Find Your Next Workspace</h1>
<p class="text-h5 mt-4">Discover unique co-working spaces around the world.</p>
<v-btn
color="primary"
large
class="mt-6"
@click="scrollToFeatures"
>
Explore Now
</v-btn>
</v-col>
<v-col cols="12" md="6">
<v-img
src="https://images.unsplash.com/photo-1508454977834-887c5b1ab4d7"
class="hero__image"
lazy-src="~@/assets/logo.png"
></v-img>
</v-col>
</v-row>
</v-container>
</section>
<!-- Features Section -->
<section id="features" class="py-16">
<v-container>
<h2 class="text-h2 font-weight-bold text-center mb-12">Why Choose Workspace Wanderers</h2>
<v-row class="mb-16">
<v-col cols="12" md="4">
<v-card class="feature-card pa-6">
<v-icon class="text-5xl mb-4">mdi-earth</v-icon>
<h3 class="text-h4 font-weight-bold">Global Network</h3>
<p class="mt-4 text-h6">Join a worldwide community of remote workers and entrepreneurs.</p>
</v-card>
</v-col>
<v-col cols="12" md="4">
<v-card class="feature-card pa-6">
<v-icon class="text-5xl mb-4">mdi-shield-sky</v-icon>
<h3 class="text-h4 font-weight-bold">Secure Booking</h3>
<p class="mt-4 text-h6">Book with confidence through our secure platform.</p>
</v-card>
</v-col>
<v-col cols="12" md="4">
<v-card class="feature-card pa-6">
<v-icon class="text-5xl mb-4">mdi-star</v-icon>
<h3 class="text-h4 font-weight-bold">Curated Spaces</h3>
<p class="mt-4 text-h6">Handpicked locations for the ultimate work experience.</p>
</v-card>
</v-col>
</v-row>
</v-container>
</section>
<!-- Footer -->
<footer class="bg-color">
<v-container>
<v-row>
<v-col cols="12" md="6">
<h4 class="text-h5 mb-4">Workspace Wanderers</h4>
<p class="text-caption text-white">Connect, Collaborate, Create.</p>
</v-col>
<v-col cols="12" md="6">
<v-btn
color="white"
text
small
class="mr-3"
>
Legal
</v-btn>
<v-btn
color="white"
text
small
>
Privacy
</v-btn>
</v-col>
</v-row>
</v-container>
</footer>
</v-app>
</template>
<script>
import 'vuetify/dist/vuetify.min.css'
export default {
methods: {
scrollToFeatures() {
const element = document.getElementById('features')
if (element) {
element.scrollIntoView({
behavior: 'smooth',
block: 'start'
})
}
}
},
mounted() {
// This is only needed if you're using vue-scroll
// We removed it, so you can delete this too
}
}
</script>
<style>
.primary-color {
background-color: #3498db;
}
.bg-color {
background-color: #2c3e50;
}
.hero {
padding-top: 160px !important;
}
@media (min-width: 960px) {
.hero__image {
height: 600px;
}
}
@media (max-width: 959px) {
.hero__image {
height: 400px;
}
}
</style>

View File

@ -0,0 +1,35 @@
import { createApp } from 'vue';
import App from './App.vue';
import { createVuetify } from 'vuetify';
import * as components from 'vuetify/components';
import * as directives from 'vuetify/directives';
import 'vuetify/styles';
import { aliases, mdi } from "vuetify/lib/iconsets/mdi";
import { fa } from "vuetify/iconsets/fa";
//import { Bar } from 'vue-chartjs';
//import router from './router'; // Import the created router
import "@mdi/font/css/materialdesignicons.css"; // Ensure you are using css-loader
//import "@fortawesome/fontawesome-free/css/all.css"; // Ensure your project is capable of handling css files
//import { createI18n } from 'vue-i18n';
//import store from './stores/store.js'
//import axios from 'axios';
const vuetify = createVuetify({
components: { ...components },
//components: { ...components, Bar },
directives,
theme: {
defaultTheme: 'dark',
},
icons: {
defaultSet: "mdi",
aliases,
sets: {
mdi,
fa,
},
},
});
const app = createApp(App);
app.use(vuetify).mount('#app');

View File

@ -0,0 +1,10 @@
// src/plugins/vuetify.js
import { createVuetify } from 'vuetify';
import 'vuetify/styles'; // Import Vuetify styles
import * as components from 'vuetify/components'; // Import Vuetify components
import * as directives from 'vuetify/directives'; // Import Vuetify directives
export default createVuetify({
components,
directives,
});

View File

@ -0,0 +1,4 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})

File diff suppressed because it is too large Load Diff