From 6c14a968c362fa03d608f3343267d6dd3bef0d3a Mon Sep 17 00:00:00 2001 From: smiggiddy Date: Fri, 2 May 2025 16:47:07 +0000 Subject: [PATCH] adding devops used gemini to create the k8s/dockerfiles faster --- .github/workflows/build.yml | 77 +++++++++++++++++++ admin-dashboard/README.md | 53 +++++++++++++ admin-dashboard/devops/Dockerfile | 14 ++++ admin-dashboard/devops/deployment.yaml | 32 ++++++++ auth-expressjs/README.md | 62 +++++++++++++++ auth-expressjs/devops/Dockerfile | 20 +++++ auth-expressjs/devops/deployment.yaml | 41 ++++++++++ battleship/README.md | 57 ++++++++++++++ battleship/devops/Dockerfile | 20 +++++ battleship/devops/deployment.yaml | 32 ++++++++ calculator/README.md | 52 +++++++++++++ calculator/devops/Dockerfile | 14 ++++ calculator/devops/deployment.yaml | 32 ++++++++ csci/README.md | 44 +++++++++++ cv-project/README.md | 12 +-- cv-project/devops/Dockerfile | 35 +++++++++ cv-project/devops/deployment.yaml | 32 ++++++++ cv/README.md | 30 ++++++++ cv/devops/Dockerfile | 16 ++++ cv/devops/deployment.yaml | 32 ++++++++ deploy/chart/Chart.yaml | 6 ++ .../admin-dashboard-application.yaml | 19 +++++ .../templates/auth-expressjs-application.yaml | 18 +++++ .../templates/battleship-application.yaml | 18 +++++ .../templates/calculator-application.yaml | 18 +++++ deploy/chart/templates/cv-application.yaml | 18 +++++ .../templates/cv-project-application.yaml | 19 +++++ .../templates/inventory-application.yaml | 18 +++++ .../chart/templates/library-application.yaml | 18 +++++ .../chart/templates/messages-application.yaml | 18 +++++ ...nodejs-mini-message-board-application.yaml | 20 +++++ .../templates/portfolio-application.yaml | 18 +++++ .../templates/restaurant-application.yaml | 18 +++++ .../templates/shopping-cart-application.yaml | 19 +++++ .../templates/signup-form-application.yaml | 18 +++++ .../templates/tictactoe-application.yaml | 18 +++++ deploy/chart/templates/todo-application.yaml | 19 +++++ .../chart/templates/weather-application.yaml | 18 +++++ deploy/chart/values.yaml | 4 + deploy/root-application.yaml | 20 +++++ inventory/README.md | 49 ++++++++++++ inventory/devops/Dockerfile | 32 ++++++++ inventory/devops/deployment.yaml | 35 +++++++++ library/README.md | 24 ++++++ library/devops/Dockerfile | 20 +++++ library/devops/deployment.yaml | 32 ++++++++ messages/README.md | 49 ++++++++++++ messages/devops/Dockerfile | 20 +++++ messages/devops/deployment.yaml | 36 +++++++++ nodejs-mini-message-board/README.md | 60 +++++++++++++++ nodejs-mini-message-board/devops/Dockerfile | 20 +++++ .../devops/deployment.yaml | 32 ++++++++ portfolio/README.md | 12 +++ portfolio/devops/Dockerfile | 11 +++ portfolio/devops/deployment.yaml | 32 ++++++++ restaurant/README.md | 60 +++++++++++++++ restaurant/devops/Dockerfile | 35 +++++++++ restaurant/devops/deployment.yaml | 32 ++++++++ shopping-cart/README.md | 19 +++-- shopping-cart/devops/Dockerfile | 19 +++++ shopping-cart/devops/deployment.yaml | 32 ++++++++ signup_form/README.md | 20 +++++ signup_form/devops/Dockerfile | 17 ++++ signup_form/devops/deployment.yaml | 33 ++++++++ testing/README.md | 17 +++- tictactoe/README.md | 22 ++++++ tictactoe/devops/Dockerfile | 13 ++++ tictactoe/devops/deployment.yaml | 32 ++++++++ todo/README.md | 60 +++++++++++++++ todo/devops/Dockerfile | 38 +++++++++ todo/devops/deployment.yaml | 32 ++++++++ weather/README.md | 16 +++- weather/devops/Dockerfile | 35 +++++++++ weather/devops/deployment.yaml | 32 ++++++++ 74 files changed, 2061 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 admin-dashboard/README.md create mode 100644 admin-dashboard/devops/Dockerfile create mode 100644 admin-dashboard/devops/deployment.yaml create mode 100644 auth-expressjs/README.md create mode 100644 auth-expressjs/devops/Dockerfile create mode 100644 auth-expressjs/devops/deployment.yaml create mode 100644 battleship/README.md create mode 100644 battleship/devops/Dockerfile create mode 100644 battleship/devops/deployment.yaml create mode 100644 calculator/README.md create mode 100644 calculator/devops/Dockerfile create mode 100644 calculator/devops/deployment.yaml create mode 100644 csci/README.md create mode 100644 cv-project/devops/Dockerfile create mode 100644 cv-project/devops/deployment.yaml create mode 100644 cv/README.md create mode 100644 cv/devops/Dockerfile create mode 100644 cv/devops/deployment.yaml create mode 100644 deploy/chart/Chart.yaml create mode 100644 deploy/chart/templates/admin-dashboard-application.yaml create mode 100644 deploy/chart/templates/auth-expressjs-application.yaml create mode 100644 deploy/chart/templates/battleship-application.yaml create mode 100644 deploy/chart/templates/calculator-application.yaml create mode 100644 deploy/chart/templates/cv-application.yaml create mode 100644 deploy/chart/templates/cv-project-application.yaml create mode 100644 deploy/chart/templates/inventory-application.yaml create mode 100644 deploy/chart/templates/library-application.yaml create mode 100644 deploy/chart/templates/messages-application.yaml create mode 100644 deploy/chart/templates/nodejs-mini-message-board-application.yaml create mode 100644 deploy/chart/templates/portfolio-application.yaml create mode 100644 deploy/chart/templates/restaurant-application.yaml create mode 100644 deploy/chart/templates/shopping-cart-application.yaml create mode 100644 deploy/chart/templates/signup-form-application.yaml create mode 100644 deploy/chart/templates/tictactoe-application.yaml create mode 100644 deploy/chart/templates/todo-application.yaml create mode 100644 deploy/chart/templates/weather-application.yaml create mode 100644 deploy/chart/values.yaml create mode 100644 deploy/root-application.yaml create mode 100644 inventory/README.md create mode 100644 inventory/devops/Dockerfile create mode 100644 inventory/devops/deployment.yaml create mode 100644 library/README.md create mode 100644 library/devops/Dockerfile create mode 100644 library/devops/deployment.yaml create mode 100644 messages/README.md create mode 100644 messages/devops/Dockerfile create mode 100644 messages/devops/deployment.yaml create mode 100644 nodejs-mini-message-board/README.md create mode 100644 nodejs-mini-message-board/devops/Dockerfile create mode 100644 nodejs-mini-message-board/devops/deployment.yaml create mode 100644 portfolio/README.md create mode 100644 portfolio/devops/Dockerfile create mode 100644 portfolio/devops/deployment.yaml create mode 100644 restaurant/README.md create mode 100644 restaurant/devops/Dockerfile create mode 100644 restaurant/devops/deployment.yaml create mode 100644 shopping-cart/devops/Dockerfile create mode 100644 shopping-cart/devops/deployment.yaml create mode 100644 signup_form/README.md create mode 100644 signup_form/devops/Dockerfile create mode 100644 signup_form/devops/deployment.yaml create mode 100644 tictactoe/README.md create mode 100644 tictactoe/devops/Dockerfile create mode 100644 tictactoe/devops/deployment.yaml create mode 100644 todo/README.md create mode 100644 todo/devops/Dockerfile create mode 100644 todo/devops/deployment.yaml create mode 100644 weather/devops/Dockerfile create mode 100644 weather/devops/deployment.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..03f2df3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,77 @@ +name: Build Docker Images + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + + steps: + # Checkout the repository + - name: Checkout code + uses: actions/checkout@v4 + + # Log into the GitHub Container Registry + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Define the list of project directories + - name: Set project list + id: set_projects + run: | + echo "projects<> $GITHUB_OUTPUT + echo "admin-dashboard" >> $GITHUB_OUTPUT + echo "battleship" >> $GITHUB_OUTPUT + echo "calculator" >> $GITHUB_OUTPUT + echo "cv" >> $GITHUB_OUTPUT + echo "cv-project" >> $GITHUB_OUTPUT + echo "inventory" >> $GITHUB_OUTPUT + echo "library" >> $GITHUB_OUTPUT + echo "messages" >> $GITHUB_OUTPUT + echo "nodejs-mini-message-board" >> $GITHUB_OUTPUT + echo "portfolio" >> $GITHUB_OUTPUT + echo "restaurant" >> $GITHUB_OUTPUT + echo "shopping-cart" >> $GITHUB_OUTPUT + echo "signup_form" >> $GITHUB_OUTPUT + echo "tictactoe" >> $GITHUB_OUTPUT + echo "todo" >> $GITHUB_OUTPUT + echo "weather" >> $GITHUB_OUTPUT + echo "auth-expressjs" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + # Build and push Docker images for changed projects + - name: Build and push Docker images + id: build_push + env: + PROJECTS: ${{ steps.set_projects.outputs.projects }} + run: | + # Loop through each project directory + for project in $(cat <<< "$PROJECTS"); do + # Check if the project has changes + if git diff --quiet HEAD^ HEAD -- "$project" || git diff --quiet HEAD^ HEAD -- "${project}/devops"; then + echo "Changes detected in project: $project" + # Set the image name dynamically using github context + image_name="ghcr.io/${{ github.repository_owner }}/$project:${{ github.sha }}" + # Build the docker image + echo "Building image: $image_name" + docker build -t "$image_name" "$project/devops" + # Push the docker image to the github container registry + echo "Pushing image: $image_name" + docker push "$image_name" + else + echo "No changes detected in project: $project" + fi + done \ No newline at end of file diff --git a/admin-dashboard/README.md b/admin-dashboard/README.md new file mode 100644 index 0000000..6d5c7e6 --- /dev/null +++ b/admin-dashboard/README.md @@ -0,0 +1,53 @@ +# Admin Dashboard Project + +## Description + +This project is a web application designed to display an admin dashboard. It utilizes HTML for structure, CSS for styling, and JavaScript for interactivity. The dashboard provides an overview of various metrics and data relevant to an administrator. + +## Project Structure + +- `index.html`: Main HTML file for the dashboard layout. +- `css/`: Directory containing CSS files for styling. + - `style.css`: Main stylesheet for the dashboard. +- `js/`: Directory containing JavaScript files for interactivity. + - `script.js`: JavaScript file for dashboard logic. +- `static/`: Directory containing static assets. + - `logo.png`: Dashboard logo. + +## Local Development + +### Prerequisites + +- A web browser (e.g., Chrome, Firefox, Safari). +- A code editor (e.g., VS Code, Sublime Text). + +### Build and Serve + +This project is a static web application, so there is no build step involved. You can simply open the `index.html` file in your web browser to view the dashboard. + +1. **Navigate to the Project Directory:** +``` +bash + cd admin-dashboard + +``` +2. **Open `index.html` in Your Browser:** + Open `index.html` with your favorite browser. + You can navigate to the `index.html` file in your file explorer and then double click it to open it in your default browser. + +### Development Workflow + +1. **Edit Files:** + - Modify `index.html` to change the structure of the dashboard. + - Edit `css/style.css` to update the look and feel of the dashboard. + - Modify `js/script.js` to add or modify dashboard features. + +2. **View Changes:** + - After making changes to the code, save the files. + - Refresh your browser to see the changes. + +## Additional Notes + +- Since this is a static web application, no server is required for local development. +- All changes made to the HTML, CSS, or JavaScript files will be immediately reflected in the browser upon refresh. +- To use this dashboard, simply open index.html. \ No newline at end of file diff --git a/admin-dashboard/devops/Dockerfile b/admin-dashboard/devops/Dockerfile new file mode 100644 index 0000000..094a3e6 --- /dev/null +++ b/admin-dashboard/devops/Dockerfile @@ -0,0 +1,14 @@ +# Use an official Nginx image as the base image +FROM nginx:alpine + +# Set the working directory to /app inside the container +WORKDIR /app + +# Copy the HTML, CSS, and JS files to the Nginx default directory +COPY . /usr/share/nginx/html + +# Expose port 80 for the Nginx server +EXPOSE 80 + +# Command to start Nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/admin-dashboard/devops/deployment.yaml b/admin-dashboard/devops/deployment.yaml new file mode 100644 index 0000000..264b77d --- /dev/null +++ b/admin-dashboard/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: admin-dashboard-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: admin-dashboard + template: + metadata: + labels: + app: admin-dashboard + spec: + containers: + - name: admin-dashboard + image: admin-dashboard:latest # Replace with your image name and tag + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: admin-dashboard-service +spec: + type: LoadBalancer + selector: + app: admin-dashboard + ports: + - protocol: TCP + port: 80 + targetPort: 80 \ No newline at end of file diff --git a/auth-expressjs/README.md b/auth-expressjs/README.md new file mode 100644 index 0000000..a98e92c --- /dev/null +++ b/auth-expressjs/README.md @@ -0,0 +1,62 @@ +# Auth-ExpressJS Project + +## Description + +This project is a web application built with Express.js and Node.js, serving as an authentication server. It allows users to sign up and log in, managing user sessions and providing basic user authentication functionality. + +## Prerequisites + +- Node.js (v14 or later recommended) +- npm (usually comes with Node.js) +- PostgreSQL + +## Installation + +1. **Clone the repository:** +``` +bash + git clone + cd auth-expressjs + +``` +2. **Install dependencies:** +``` +bash + npm install + +``` +3. **Create database:** + + Create a database in postgres + +4. **Set up the database** +``` +bash + psql -d -f migrations/init.sql + +``` +## Running the Project + +1. **Start the application:** +``` +bash + npm start + +``` +This command starts the server, and you can access the application in your browser at `http://localhost:3000`. + - Make sure you change the db password and username in the app.js file +## Project Structure + +- `src/`: Contains the main application code. + - `app.js`: The main application file where the Express.js server is set up. + - `views/`: Contains the EJS templates for the views. + - `migrations/`: Contains the sql file used to setup the database +- `package.json`: Lists the project dependencies and scripts. +- `package-lock.json`: Ensures consistent dependency versions across installations. +- `migrations`: database configuration files + +## Usage + +- **Sign Up:** Navigate to `http://localhost:3000/sign-up` to create a new account. +- **Log In:** Navigate to `http://localhost:3000/log-in` to log in with your credentials. +- **Home:** Navigate to `http://localhost:3000` to access the home page. \ No newline at end of file diff --git a/auth-expressjs/devops/Dockerfile b/auth-expressjs/devops/Dockerfile new file mode 100644 index 0000000..fd9011b --- /dev/null +++ b/auth-expressjs/devops/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Node.js runtime as the base image +FROM node:18-alpine + +# Set the working directory in the container +WORKDIR /app + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install production dependencies +RUN npm install --omit=dev + +# Copy the rest of the application code to the working directory +COPY . . + +# Expose the port the app runs on +EXPOSE 3000 + +# Define the command to run the application +CMD [ "npm", "start" ] \ No newline at end of file diff --git a/auth-expressjs/devops/deployment.yaml b/auth-expressjs/devops/deployment.yaml new file mode 100644 index 0000000..9203da0 --- /dev/null +++ b/auth-expressjs/devops/deployment.yaml @@ -0,0 +1,41 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: auth-expressjs-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: auth-expressjs + template: + metadata: + labels: + app: auth-expressjs + spec: + containers: + - name: auth-expressjs + image: auth-expressjs:latest # Replace with your image name and tag + ports: + - containerPort: 3000 + env: + - name: NODE_ENV + value: production + volumeMounts: + - mountPath: /app/src/data + name: data + volumes: + - name: data + emptyDir: {} +--- +apiVersion: v1 +kind: Service +metadata: + name: auth-expressjs-service +spec: + selector: + app: auth-expressjs + type: LoadBalancer + ports: + - protocol: TCP + port: 80 + targetPort: 3000 \ No newline at end of file diff --git a/battleship/README.md b/battleship/README.md new file mode 100644 index 0000000..f79defe --- /dev/null +++ b/battleship/README.md @@ -0,0 +1,57 @@ +# Battleship + +## Description + +Battleship is a web-based game where players strategically place ships on a grid and attempt to sink their opponent's ships by guessing their locations. This project is a digital implementation of the classic board game, built using JavaScript. + +## Local Development + +### Prerequisites + +- Node.js (with npm) + +### Installation + +1. **Navigate to the project directory:** +``` +bash + cd battleship + +``` +2. **Install dependencies:** +``` +bash + npm install + +``` +### Build + +1. **Build the project:** + This project uses webpack to bundle the code. +``` +bash + npm run build + +``` +### Run + +1. **Start the development server:** +``` +bash + npm start + +``` +2. **Open the game:** + + Open your web browser and navigate to `http://localhost:8080` to play the game. + +### Tests + +1. **Run the test suite:** + +``` +bash + npm test + +``` +This command will run the test suite using jest. \ No newline at end of file diff --git a/battleship/devops/Dockerfile b/battleship/devops/Dockerfile new file mode 100644 index 0000000..fcdc6d4 --- /dev/null +++ b/battleship/devops/Dockerfile @@ -0,0 +1,20 @@ +# Stage 1: Build the application +FROM node:18-alpine AS builder + +WORKDIR /app + +COPY package*.json ./ +RUN npm install + +COPY . . + +RUN npm run build -- --config webpack.prod.js + +# Stage 2: Serve the application with Nginx +FROM nginx:stable-alpine + +COPY --from=builder /app/dist /usr/share/nginx/html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/battleship/devops/deployment.yaml b/battleship/devops/deployment.yaml new file mode 100644 index 0000000..6a2a864 --- /dev/null +++ b/battleship/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: battleship-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: battleship + template: + metadata: + labels: + app: battleship + spec: + containers: + - name: battleship + image: ghcr.io/smiggiddy/odin-codeprojects/battleship:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: battleship-service +spec: + type: LoadBalancer + selector: + app: battleship + ports: + - protocol: TCP + port: 80 + targetPort: 80 \ No newline at end of file diff --git a/calculator/README.md b/calculator/README.md new file mode 100644 index 0000000..fe161af --- /dev/null +++ b/calculator/README.md @@ -0,0 +1,52 @@ +# Calculator Project + +## Description + +This project is a web-based calculator application built using HTML, CSS, and JavaScript. It allows users to perform basic arithmetic operations like addition, subtraction, multiplication, and division. + +## Features + +- **Basic Operations:** Perform addition, subtraction, multiplication, and division. +- **Clear Functionality:** Clear the display with a press of a button. +- **Responsive Design:** Designed to work on various screen sizes. + +## Local Development + +### Prerequisites + +- Web browser (e.g., Chrome, Firefox, Safari) + +### Setup + +1. **Clone the repository:** + If you haven't already, clone this repository to your local machine. + +2. **Navigate to the project directory:** +``` +bash + cd calculator + +``` +### Running the Project + +1. **Open `index.html`:** + - Open the `index.html` file in your web browser. + - You can do this by right-clicking the file and selecting "Open with" and then your preferred browser. + +2. **Interact with the Calculator:** + - Use your mouse or keyboard to interact with the calculator buttons. + - The result will be displayed on the calculator's display area. + +### File Structure +``` +calculator/ +├── css/ +│ └── style.css # CSS styles for the calculator +├── js/ +│ └── script.js # JavaScript code for calculator logic +├── index.html # Main HTML file +└── faviocon.svg # icon +``` +## Contributing + +Contributions are welcome! If you'd like to contribute, please fork the repository and submit a pull request. \ No newline at end of file diff --git a/calculator/devops/Dockerfile b/calculator/devops/Dockerfile new file mode 100644 index 0000000..08f2fc9 --- /dev/null +++ b/calculator/devops/Dockerfile @@ -0,0 +1,14 @@ +# Use an official Nginx image as the base image +FROM nginx:latest + +# Remove default Nginx files +RUN rm -rf /usr/share/nginx/html/* + +# Copy the project files to the Nginx default directory +COPY . /usr/share/nginx/html + +# Expose port 80 +EXPOSE 80 + +# Start Nginx when the container starts +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/calculator/devops/deployment.yaml b/calculator/devops/deployment.yaml new file mode 100644 index 0000000..d6ffb0d --- /dev/null +++ b/calculator/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: calculator-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: calculator + template: + metadata: + labels: + app: calculator + spec: + containers: + - name: calculator + image: ghcr.io/smiggiddy/odin-codeprojects/calculator:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: calculator-service +spec: + type: LoadBalancer + selector: + app: calculator + ports: + - protocol: TCP + port: 80 + targetPort: 80 \ No newline at end of file diff --git a/csci/README.md b/csci/README.md new file mode 100644 index 0000000..b8579b9 --- /dev/null +++ b/csci/README.md @@ -0,0 +1,44 @@ +# CSCI Project + +This project contains various JavaScript implementations of common computer science algorithms and data structures. + +## Files + +- **fib.js**: Contains code related to the Fibonacci sequence. +- **knightsTravials.js**: Contains code related to the Knight's Travails problem. +- **linkedList.js**: Contains code related to Linked List data structures. +- **mergeSort.js**: Contains code related to the Merge Sort algorithm. +- **projectBTS.js**: Contains code related to Binary Tree Structures +- **projectHashMap.js**: Contains code related to HashMap data structure. +- **projectHashSet.js**: Contains code related to HashSet data structures. + +## Running the Project + +To run the code in this project, you will need to have Node.js installed on your system. + +1. **Install Node.js**: If you do not already have Node.js installed, download it from the official website and follow the installation instructions. + +2. **Navigate to the Directory**: Open your terminal or command prompt and navigate to the `csci` directory. +``` +bash + cd csci + +``` +3. **Run the Files**: You can run each JavaScript file individually using Node.js. For example, to run `fib.js`, use the following command: +``` +bash + node fib.js + +``` +Repeat this step for each file you want to run: +``` +bash + node knightsTravials.js + node linkedList.js + node mergeSort.js + node projectBTS.js + node projectHashMap.js + node projectHashSet.js + +``` +Each file contains its own set of operations and instructions, follow the console output in order to see the results of the operation. \ No newline at end of file diff --git a/cv-project/README.md b/cv-project/README.md index f768e33..318a828 100644 --- a/cv-project/README.md +++ b/cv-project/README.md @@ -1,8 +1,10 @@ -# React + Vite +# CV Project -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. +This project is a web application built using React. It is designed to showcase a digital CV or resume. -Currently, two official plugins are available: +## Local Development + +To run this project locally, follow these steps: + +1. **Clone the repository:** -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh diff --git a/cv-project/devops/Dockerfile b/cv-project/devops/Dockerfile new file mode 100644 index 0000000..26e8d8b --- /dev/null +++ b/cv-project/devops/Dockerfile @@ -0,0 +1,35 @@ +# Use a Node.js image as the base for building the React app +FROM node:18-alpine AS builder + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json to install dependencies +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Build the React app using Vite +RUN npm run build + +# Use an official Nginx image to serve the static files +FROM nginx:stable-alpine + +# Set the working directory +WORKDIR /usr/share/nginx/html + +# Remove default Nginx static files +RUN rm -rf ./* + +# Copy the build output from the builder stage +COPY --from=builder /app/dist . + +# Expose port 80 +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/cv-project/devops/deployment.yaml b/cv-project/devops/deployment.yaml new file mode 100644 index 0000000..8c8eb5e --- /dev/null +++ b/cv-project/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cv-project-deployment +spec: + replicas: 2 + selector: + matchLabels: + app: cv-project + template: + metadata: + labels: + app: cv-project + spec: + containers: + - name: cv-project + image: ghcr.io/smiggiddy/odin-codeprojects/cv-project:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: cv-project-service +spec: + selector: + app: cv-project + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: LoadBalancer \ No newline at end of file diff --git a/cv/README.md b/cv/README.md new file mode 100644 index 0000000..2a7816c --- /dev/null +++ b/cv/README.md @@ -0,0 +1,30 @@ +# CV Project + +This project is a web application designed to display a curriculum vitae (CV) or resume. It's built using HTML, CSS, and JavaScript to provide a dynamic and interactive presentation of personal and professional information. + +## Project Structure + +- `index.html`: The main HTML file that structures the web page content. +- `css/style.css`: The stylesheet used to visually format the CV. +- `js/script.js`: Contains JavaScript code for interactive elements and functionality. +- `assets/`: This folder contains the compiled production react code. +- `icon.svg`: The icon for the project. +- `vite.svg`: The vite logo used in the project. + +## Running the Project Locally + +To view and run this CV project on your local machine, follow these steps: + +1. **Clone the Repository** + If you haven't already, clone the project repository to your local machine using git. +2. **Open `index.html`** + Navigate to the project directory in your file explorer and double-click on the `index.html` file. This will open the CV in your default web browser. + +## Project Overview + +This project provides a clean and modern way to present a CV online. It leverages web technologies to create a visually appealing and functional document. + +## Additional Notes + +- No specific server setup is required to run this project locally, as it is primarily a client-side application. +- All dependencies and code are self-contained within the project directory. \ No newline at end of file diff --git a/cv/devops/Dockerfile b/cv/devops/Dockerfile new file mode 100644 index 0000000..25dce6e --- /dev/null +++ b/cv/devops/Dockerfile @@ -0,0 +1,16 @@ +# Use an official Nginx image as the base image +FROM nginx:latest + +# Set the working directory to /app +WORKDIR /app + +# Copy the HTML, CSS, and JavaScript files to the Nginx default directory +COPY index.html /usr/share/nginx/html/ +COPY css/ /usr/share/nginx/html/css/ +COPY assets/ /usr/share/nginx/html/assets/ + +# Expose port 80 to the outside world +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/cv/devops/deployment.yaml b/cv/devops/deployment.yaml new file mode 100644 index 0000000..564957c --- /dev/null +++ b/cv/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: cv-deployment +spec: + replicas: 1 + selector: + matchLabels: + app: cv + template: + metadata: + labels: + app: cv + spec: + containers: + - name: cv-app + image: ghcr.io/smiggiddy/odin-codeprojects/cv:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: cv-service +spec: + type: LoadBalancer + selector: + app: cv + ports: + - protocol: TCP + port: 80 + targetPort: 80 \ No newline at end of file diff --git a/deploy/chart/Chart.yaml b/deploy/chart/Chart.yaml new file mode 100644 index 0000000..67126fa --- /dev/null +++ b/deploy/chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: odin-projects-root +description: A Helm chart for deploying the root Argo CD application to manage Odin projects. +type: application +version: 0.1.0 +appVersion: "1.0.0" \ No newline at end of file diff --git a/deploy/chart/templates/admin-dashboard-application.yaml b/deploy/chart/templates/admin-dashboard-application.yaml new file mode 100644 index 0000000..49c7fdf --- /dev/null +++ b/deploy/chart/templates/admin-dashboard-application.yaml @@ -0,0 +1,19 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: admin-dashboard + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: admin-dashboard/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true \ No newline at end of file diff --git a/deploy/chart/templates/auth-expressjs-application.yaml b/deploy/chart/templates/auth-expressjs-application.yaml new file mode 100644 index 0000000..d2978d3 --- /dev/null +++ b/deploy/chart/templates/auth-expressjs-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: auth-expressjs + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: auth-expressjs/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/battleship-application.yaml b/deploy/chart/templates/battleship-application.yaml new file mode 100644 index 0000000..c3ac9f2 --- /dev/null +++ b/deploy/chart/templates/battleship-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: battleship + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: battleship/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/calculator-application.yaml b/deploy/chart/templates/calculator-application.yaml new file mode 100644 index 0000000..d4e53cc --- /dev/null +++ b/deploy/chart/templates/calculator-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: calculator + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: calculator/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/cv-application.yaml b/deploy/chart/templates/cv-application.yaml new file mode 100644 index 0000000..99b7616 --- /dev/null +++ b/deploy/chart/templates/cv-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: cv # Updated to match instruction + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} # Updated to match instruction + path: cv/devops + targetRevision: {{ .Values.targetRevision }} # Updated to match instruction + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} # Updated to match instruction + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/cv-project-application.yaml b/deploy/chart/templates/cv-project-application.yaml new file mode 100644 index 0000000..39391bd --- /dev/null +++ b/deploy/chart/templates/cv-project-application.yaml @@ -0,0 +1,19 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: cv-project + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: cv-project/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true \ No newline at end of file diff --git a/deploy/chart/templates/inventory-application.yaml b/deploy/chart/templates/inventory-application.yaml new file mode 100644 index 0000000..96d3aef --- /dev/null +++ b/deploy/chart/templates/inventory-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: inventory # this will be set to the project name + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: inventory/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/library-application.yaml b/deploy/chart/templates/library-application.yaml new file mode 100644 index 0000000..d600969 --- /dev/null +++ b/deploy/chart/templates/library-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: library + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: library/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/messages-application.yaml b/deploy/chart/templates/messages-application.yaml new file mode 100644 index 0000000..672d43a --- /dev/null +++ b/deploy/chart/templates/messages-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: messages # Updated name + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} #Templated repo URL + path: messages/devops + targetRevision: {{ .Values.targetRevision }} # Templated target revision + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} # Templated destination namespace + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/nodejs-mini-message-board-application.yaml b/deploy/chart/templates/nodejs-mini-message-board-application.yaml new file mode 100644 index 0000000..48237e0 --- /dev/null +++ b/deploy/chart/templates/nodejs-mini-message-board-application.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: nodejs-mini-message-board + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: nodejs-mini-message-board/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - CreateNamespace=true \ No newline at end of file diff --git a/deploy/chart/templates/portfolio-application.yaml b/deploy/chart/templates/portfolio-application.yaml new file mode 100644 index 0000000..3ee5092 --- /dev/null +++ b/deploy/chart/templates/portfolio-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: portfolio + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: portfolio/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/restaurant-application.yaml b/deploy/chart/templates/restaurant-application.yaml new file mode 100644 index 0000000..015713d --- /dev/null +++ b/deploy/chart/templates/restaurant-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: restaurant + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: restaurant/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/shopping-cart-application.yaml b/deploy/chart/templates/shopping-cart-application.yaml new file mode 100644 index 0000000..f4c690c --- /dev/null +++ b/deploy/chart/templates/shopping-cart-application.yaml @@ -0,0 +1,19 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: shopping-cart + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: shopping-cart/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + syncOptions: + - CreateNamespace=true \ No newline at end of file diff --git a/deploy/chart/templates/signup-form-application.yaml b/deploy/chart/templates/signup-form-application.yaml new file mode 100644 index 0000000..996b6ec --- /dev/null +++ b/deploy/chart/templates/signup-form-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: signup-form + namespace: argocd +spec: + project: default + source: + repoURL: '{{ .Values.repoUrl }}' + path: signup_form/devops + targetRevision: '{{ .Values.targetRevision }}' + destination: + server: '{{ .Values.targetServer }}' + namespace: '{{ .Values.targetNamespace }}' + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/tictactoe-application.yaml b/deploy/chart/templates/tictactoe-application.yaml new file mode 100644 index 0000000..37cc2f7 --- /dev/null +++ b/deploy/chart/templates/tictactoe-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: tictactoe + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: tictactoe/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/todo-application.yaml b/deploy/chart/templates/todo-application.yaml new file mode 100644 index 0000000..1a67245 --- /dev/null +++ b/deploy/chart/templates/todo-application.yaml @@ -0,0 +1,19 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: todo + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: todo/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/templates/weather-application.yaml b/deploy/chart/templates/weather-application.yaml new file mode 100644 index 0000000..4a437c8 --- /dev/null +++ b/deploy/chart/templates/weather-application.yaml @@ -0,0 +1,18 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: weather + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: weather/devops + targetRevision: {{ .Values.targetRevision }} + destination: + server: {{ .Values.targetServer }} + namespace: {{ .Values.targetNamespace }} + syncPolicy: + automated: + prune: true + selfHeal: true \ No newline at end of file diff --git a/deploy/chart/values.yaml b/deploy/chart/values.yaml new file mode 100644 index 0000000..b5a526b --- /dev/null +++ b/deploy/chart/values.yaml @@ -0,0 +1,4 @@ +repoUrl: https://github.com/smiggiddy/odin-codeprojects +targetRevision: HEAD +targetNamespace: default +targetServer: https://kubernetes.default.svc \ No newline at end of file diff --git a/deploy/root-application.yaml b/deploy/root-application.yaml new file mode 100644 index 0000000..40427ab --- /dev/null +++ b/deploy/root-application.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: odin-projects + namespace: argocd +spec: + project: default + source: + repoURL: {{ .Values.repoUrl }} + path: deploy + targetRevision: {{ .Values.targetRevision }} + destination: + server: https://kubernetes.default.svc + namespace: argocd + syncPolicy: + automated: + prune: true + selfHeal: true + syncOptions: + - PruneLast=true \ No newline at end of file diff --git a/inventory/README.md b/inventory/README.md new file mode 100644 index 0000000..b988a06 --- /dev/null +++ b/inventory/README.md @@ -0,0 +1,49 @@ +# Inventory Project + +## Description + +The Inventory project is a web application built with Node.js and Express.js. It's designed to manage and track inventory items. This application allows users to add, view, edit, and delete items in the inventory. + +## Prerequisites + +- Node.js (v18 or later) +- npm (comes with Node.js) +- PostgreSQL (version 13 or later) + +## Setup + +1. **Clone the repository:** +``` +bash + git clone + cd inventory + +``` +2. **Install dependencies:** +``` +bash + npm install + +``` +3. **Set up the database:** + - Ensure you have PostgreSQL running. + - Create a database named `inventory_db` (or you can name it whatever you want and update the `config.js` file). + - Update the database connection details in `src/config.js`. + - Run the database setup script: +``` +bash + node src/db/setupDb.js + +``` +This will create the table and insert some sample data. + +4. **Run the app** +``` +bash + node src/app.js + +``` +5. **View the App** + + Open a browser and go to: http://localhost:3000 +## Project Structure \ No newline at end of file diff --git a/inventory/devops/Dockerfile b/inventory/devops/Dockerfile new file mode 100644 index 0000000..548d536 --- /dev/null +++ b/inventory/devops/Dockerfile @@ -0,0 +1,32 @@ +# Use an official Node.js runtime as the base image +FROM oven/bun:latest as builder + +# Set the working directory in the container +WORKDIR /app + +# Copy package.json and package-lock.json to the working directory +COPY package.json bun.lockb ./ + +# Install dependencies +RUN bun install --production + +# Copy the rest of the application files to the working directory +COPY . . + +# Build the application +# RUN bun run build + +# Use an official Node.js runtime as the base image +FROM oven/bun:latest + +# Set the working directory in the container +WORKDIR /app + +# Copy the application files from the builder stage +COPY --from=builder /app . + +# Expose the port that the app runs on +EXPOSE 3000 + +# Define the command to run your application +CMD ["bun", "run", "src/app.js"] \ No newline at end of file diff --git a/inventory/devops/deployment.yaml b/inventory/devops/deployment.yaml new file mode 100644 index 0000000..8cd01a3 --- /dev/null +++ b/inventory/devops/deployment.yaml @@ -0,0 +1,35 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: inventory-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: inventory + template: + metadata: + labels: + app: inventory + spec: + containers: + - name: inventory + image: ghcr.io/smiggiddy/odin-codeprojects/inventory:latest + ports: + - containerPort: 3000 + env: + - name: NODE_ENV + value: production +--- +apiVersion: v1 +kind: Service +metadata: + name: inventory-service +spec: + type: LoadBalancer + selector: + app: inventory + ports: + - protocol: TCP + port: 80 + targetPort: 3000 \ No newline at end of file diff --git a/library/README.md b/library/README.md new file mode 100644 index 0000000..3cbe335 --- /dev/null +++ b/library/README.md @@ -0,0 +1,24 @@ +# Library Project + +## Description + +This is a web application that allows users to manage a personal library of books. It's built using HTML, CSS, and JavaScript. + +## How to Run Locally + +1. **Open `index.html`:** Navigate to the `library` directory in your file explorer and open the `index.html` file in your web browser. +2. **View the Application:** The library application will now be running in your browser. You can interact with the application directly from the browser. +3. **Javascript Logic:** The logic for the application is within the `js/script.js` file. +4. **Styling:** The style for the application is in `css/style.css` + +## Project Structure + +* `index.html`: The main HTML file for the application. +* `css/`: Directory containing the CSS files. + * `style.css`: CSS file for styling the application. +* `js/`: Directory containing the JavaScript files. + * `script.js`: JavaScript file containing the application logic. + +## Additional Notes + +* No server or special environment is required to run this application locally. Simply open the `index.html` in your web browser. \ No newline at end of file diff --git a/library/devops/Dockerfile b/library/devops/Dockerfile new file mode 100644 index 0000000..dc79c17 --- /dev/null +++ b/library/devops/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Nginx image as the base image +FROM nginx:latest + +# Remove default Nginx configuration +RUN rm /etc/nginx/conf.d/default.conf + +# Copy custom Nginx configuration +COPY nginx.conf /etc/nginx/conf.d + +# Set the working directory in the container +WORKDIR /usr/share/nginx/html + +# Copy the project files into the container's directory +COPY . . + +# Expose port 80 to the outside world +EXPOSE 80 + +# Start Nginx when the container starts +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/library/devops/deployment.yaml b/library/devops/deployment.yaml new file mode 100644 index 0000000..ea6dd00 --- /dev/null +++ b/library/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: library-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: library + template: + metadata: + labels: + app: library + spec: + containers: + - name: library + image: ghcr.io/smiggiddy/odin-codeprojects/library:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: library-service +spec: + type: LoadBalancer + selector: + app: library + ports: + - protocol: TCP + port: 80 + targetPort: 80 \ No newline at end of file diff --git a/messages/README.md b/messages/README.md new file mode 100644 index 0000000..01619a0 --- /dev/null +++ b/messages/README.md @@ -0,0 +1,49 @@ +# Messages Project + +## Description + +The Messages project is a simple web-based message board application built using Node.js and Express.js. It allows users to create and view messages. + +## Local Development Setup + +Follow these steps to run the project locally: + +1. **Clone the Repository:** +``` +bash + git clone + cd messages + +``` +2. **Install Dependencies:** +``` +bash + npm install + +``` +3. **Database Setup** + + The project utilizes a database to persist messages. + + * Install postgres if not already present. + * Create a database and modify the config.js file accordingly +``` + # In the project directory + psql < src/models/init.sql + +``` +4. **Run the Application:** +``` +bash + node src/app.js + +``` +5. **View the Application:** + + Open your web browser and go to `http://localhost:3000` to see the application. + +## Additional Notes + +* Ensure that Node.js and npm are installed on your machine. +* You can modify the application by editing the files in the `src` directory. +* Make sure to refer to `src/config.js` to configure the correct database and ports. \ No newline at end of file diff --git a/messages/devops/Dockerfile b/messages/devops/Dockerfile new file mode 100644 index 0000000..6de5c57 --- /dev/null +++ b/messages/devops/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Node.js runtime as the base image +FROM node:18-alpine + +# Set the working directory to /app inside the container +WORKDIR /app + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install any dependencies +RUN npm install --production + +# Copy the rest of the application code +COPY . . + +# Expose port 3000 for the Express app +EXPOSE 3000 + +# Define the command to start the application +CMD [ "npm", "start" ] \ No newline at end of file diff --git a/messages/devops/deployment.yaml b/messages/devops/deployment.yaml new file mode 100644 index 0000000..ea4dc4e --- /dev/null +++ b/messages/devops/deployment.yaml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: messages-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: messages + template: + metadata: + labels: + app: messages + spec: + containers: + - name: messages + image: ghcr.io/smiggiddy/odin-codeprojects/messages:latest + ports: + - containerPort: 3000 + env: + - name: NODE_ENV + value: production + # add any other needed environment variables here +--- +apiVersion: v1 +kind: Service +metadata: + name: messages-service +spec: + selector: + app: messages + type: LoadBalancer + ports: + - protocol: TCP + port: 80 + targetPort: 3000 \ No newline at end of file diff --git a/nodejs-mini-message-board/README.md b/nodejs-mini-message-board/README.md new file mode 100644 index 0000000..2148494 --- /dev/null +++ b/nodejs-mini-message-board/README.md @@ -0,0 +1,60 @@ +# Node.js Mini Message Board + +## Description + +This project is a simple message board web application built using Node.js and Express.js. Users can view messages and add their own. + +## Installation and Setup + +1. **Clone the repository:** +``` +bash + git clone + +``` +2. **Navigate to the project directory:** +``` +bash + cd nodejs-mini-message-board + +``` +3. **Install dependencies:** +``` +bash + npm install + +``` +4. **Initialize the database:** +``` +bash + node src/db/seedDb.js + +``` +## Running the Application + +1. **Start the server:** +``` +bash + npm start + +``` +2. **Open in browser:** + Open your web browser and go to `http://localhost:3000` to view the application. + +## Usage + +Once the application is running, you can: + +* View existing messages on the main page. +* Add a new message by clicking the "New Message" button and filling out the form. + +## Project Structure + +* `src/`: Contains the source code of the application. + * `app.js`: The main application file. + * `controllers/`: Contains the controller files. + * `db/`: Contains files related to the database. + * `public/`: Contains static files (CSS, JavaScript). + * `routes/`: Contains the route files. + * `views/`: Contains the view files (EJS templates). +* `package.json`: Contains project metadata and dependencies. \ No newline at end of file diff --git a/nodejs-mini-message-board/devops/Dockerfile b/nodejs-mini-message-board/devops/Dockerfile new file mode 100644 index 0000000..5f87e0c --- /dev/null +++ b/nodejs-mini-message-board/devops/Dockerfile @@ -0,0 +1,20 @@ +# Use an official Node.js runtime as the base image +FROM node:18-alpine + +# Set the working directory to /app inside the container +WORKDIR /app + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install any needed dependencies using production command +RUN npm install --production + +# Copy the rest of the application code to the working directory +COPY . . + +# Expose the port the app runs on +EXPOSE 3000 + +# Define the command to run your app +CMD [ "node", "src/app.js" ] \ No newline at end of file diff --git a/nodejs-mini-message-board/devops/deployment.yaml b/nodejs-mini-message-board/devops/deployment.yaml new file mode 100644 index 0000000..73413ff --- /dev/null +++ b/nodejs-mini-message-board/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nodejs-mini-message-board-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: nodejs-mini-message-board + template: + metadata: + labels: + app: nodejs-mini-message-board + spec: + containers: + - name: nodejs-mini-message-board + image: ghcr.io/smiggiddy/odin-codeprojects/nodejs-mini-message-board:latest + ports: + - containerPort: 3000 +--- +apiVersion: v1 +kind: Service +metadata: + name: nodejs-mini-message-board-service +spec: + type: LoadBalancer + selector: + app: nodejs-mini-message-board + ports: + - protocol: TCP + port: 80 + targetPort: 3000 \ No newline at end of file diff --git a/portfolio/README.md b/portfolio/README.md new file mode 100644 index 0000000..f227566 --- /dev/null +++ b/portfolio/README.md @@ -0,0 +1,12 @@ +# Portfolio Project + +This is a static portfolio website built using HTML and CSS. It showcases my skills and projects. + +## Viewing Locally + +To view the project locally, follow these steps: + +1. **Clone the repository:** If you haven't already, clone the repository to your local machine. +2. **Open `index.html`:** Navigate to the project directory in your file explorer and open the `index.html` file in your preferred web browser. + +That's it! You should now be able to view the portfolio website in your browser. \ No newline at end of file diff --git a/portfolio/devops/Dockerfile b/portfolio/devops/Dockerfile new file mode 100644 index 0000000..15d350f --- /dev/null +++ b/portfolio/devops/Dockerfile @@ -0,0 +1,11 @@ +# Use the official nginx image as the base image +FROM nginx:latest + +# Copy the HTML and CSS files to the default nginx directory +COPY . /usr/share/nginx/html + +# Expose port 80 to the outside world +EXPOSE 80 + +# Start nginx when the container starts +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/portfolio/devops/deployment.yaml b/portfolio/devops/deployment.yaml new file mode 100644 index 0000000..98a292e --- /dev/null +++ b/portfolio/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: portfolio-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: portfolio + template: + metadata: + labels: + app: portfolio + spec: + containers: + - name: portfolio + image: ghcr.io/smiggiddy/odin-codeprojects/portfolio:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: portfolio-service +spec: + selector: + app: portfolio + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: LoadBalancer \ No newline at end of file diff --git a/restaurant/README.md b/restaurant/README.md new file mode 100644 index 0000000..00c7890 --- /dev/null +++ b/restaurant/README.md @@ -0,0 +1,60 @@ +# Restaurant Project + +## Description + +This project is a multi-page web application for a restaurant. It utilizes HTML, CSS, and JavaScript to create a dynamic and interactive user experience. The application features several pages including a menu, contact and a home page. + +## Getting Started + +Follow these instructions to get the project up and running on your local machine. + +### Prerequisites + +- Web Browser (Chrome, Firefox, Safari, etc.) +- Text editor or IDE (VSCode, Sublime Text, Atom, etc.) + +### Installation + +1. **Clone the Repository** +``` +bash + git clone [repository URL] + cd restaurant + +``` +2. **Install Dependencies** +``` +bash + cd app + npm install +``` +### Build + +To build the application: +``` +bash + npm run build +``` +### Running Locally + +To run the application: +``` +bash + npm start +``` +This command will bundle the application with webpack and serve the file to your browser at `http://localhost:8080`. + +## Project Structure + +- `index.html`: The main HTML file. +- `src/`: Contains the JavaScript, CSS, and asset files. +- `src/index.js`: The main javascript file. +- `dist/`: Contains the bundle.js file. + +## Contributing + +Contributions are welcome! Please read the contributing guidelines before getting started. + +## License + +This project is licensed under the MIT License - see the LICENSE.md file for details. \ No newline at end of file diff --git a/restaurant/devops/Dockerfile b/restaurant/devops/Dockerfile new file mode 100644 index 0000000..6725dde --- /dev/null +++ b/restaurant/devops/Dockerfile @@ -0,0 +1,35 @@ +# Use a Node.js base image to build the project +FROM node:18-alpine AS builder + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json (if present) +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Build the application using webpack +RUN npm run build -- --config app/webpack.config.js + +# Use an Nginx base image to serve the static files +FROM nginx:alpine + +# Set the working directory +WORKDIR /usr/share/nginx/html + +# Remove default nginx static files +RUN rm -rf ./* + +# Copy the built files from the builder stage +COPY --from=builder /app/dist . + +# Expose port 80 +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/restaurant/devops/deployment.yaml b/restaurant/devops/deployment.yaml new file mode 100644 index 0000000..c0e8adc --- /dev/null +++ b/restaurant/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: restaurant-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: restaurant + template: + metadata: + labels: + app: restaurant + spec: + containers: + - name: restaurant + image: ghcr.io/smiggiddy/odin-codeprojects/restaurant:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: restaurant-service +spec: + selector: + app: restaurant + type: LoadBalancer + ports: + - protocol: TCP + port: 80 + targetPort: 80 \ No newline at end of file diff --git a/shopping-cart/README.md b/shopping-cart/README.md index f768e33..d130cd0 100644 --- a/shopping-cart/README.md +++ b/shopping-cart/README.md @@ -1,8 +1,17 @@ -# React + Vite +# Shopping Cart Project -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. +## Description + +This project is a web application for an online shopping cart, built using React. It allows users to browse products, add them to a cart, and manage their cart contents. + + +Before you begin, ensure you have the following installed: + +* **Node.js**: Make sure you have Node.js installed. You can download it from [https://nodejs.org/](https://nodejs.org/). +* **npm**: npm comes bundled with Node.js, so you should have it automatically. + +## Getting Started + +1. **Clone the repository**: -Currently, two official plugins are available: -- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh -- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh diff --git a/shopping-cart/devops/Dockerfile b/shopping-cart/devops/Dockerfile new file mode 100644 index 0000000..819c6d7 --- /dev/null +++ b/shopping-cart/devops/Dockerfile @@ -0,0 +1,19 @@ +# Stage 1: Build the React application +FROM node:18-alpine AS build + +WORKDIR /app + +COPY package*.json ./ +RUN npm install + +COPY . . +RUN npm run build + +# Stage 2: Serve the application with Nginx +FROM nginx:alpine + +COPY --from=build /app/dist /usr/share/nginx/html + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/shopping-cart/devops/deployment.yaml b/shopping-cart/devops/deployment.yaml new file mode 100644 index 0000000..61e7af8 --- /dev/null +++ b/shopping-cart/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: shopping-cart-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: shopping-cart + template: + metadata: + labels: + app: shopping-cart + spec: + containers: + - name: shopping-cart + image: ghcr.io/smiggiddy/odin-codeprojects/shopping-cart:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: shopping-cart-service +spec: + selector: + app: shopping-cart + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: LoadBalancer \ No newline at end of file diff --git a/signup_form/README.md b/signup_form/README.md new file mode 100644 index 0000000..55d52a3 --- /dev/null +++ b/signup_form/README.md @@ -0,0 +1,20 @@ +# Signup Form Project + +## Description + +This project is a simple web-based signup form. It's built using HTML for structure, CSS for styling, and JavaScript for interactivity. The form allows users to enter their personal information and submit it. + +## How to View Locally + +1. **Open `index.html`:** Navigate to the project directory in your file explorer and open the `index.html` file in your preferred web browser. +2. **View in browser**: The page should automatically load. + +## Project Structure + +* `index.html`: The main HTML file containing the structure of the form. +* `css/style.css`: The CSS file for styling the form. +* `js/script.js`: The JavaScript file that handles form interactivity. +* `static/`: contains static files like images. + +## Notes +The form does not include backend code to save data. \ No newline at end of file diff --git a/signup_form/devops/Dockerfile b/signup_form/devops/Dockerfile new file mode 100644 index 0000000..d85a2dd --- /dev/null +++ b/signup_form/devops/Dockerfile @@ -0,0 +1,17 @@ +# Use an official Nginx image as the base image +FROM nginx:latest + +# Set the working directory to /app inside the container +WORKDIR /app + +# Copy the HTML, CSS, and JavaScript files from the current directory to /app +COPY . /app + +# Copy the Nginx configuration file to /etc/nginx/conf.d/ +COPY ./nginx.conf /etc/nginx/conf.d/default.conf + +# Expose port 80 for HTTP traffic +EXPOSE 80 + +# Command to run when the container starts +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/signup_form/devops/deployment.yaml b/signup_form/devops/deployment.yaml new file mode 100644 index 0000000..8657cff --- /dev/null +++ b/signup_form/devops/deployment.yaml @@ -0,0 +1,33 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: signup-form-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: signup-form + template: + metadata: + labels: + app: signup-form + spec: + containers: + - name: signup-form + image: ghcr.io/smiggiddy/odin-codeprojects/signup-form:latest + ports: + - containerPort: 80 + imagePullPolicy: IfNotPresent +--- +apiVersion: v1 +kind: Service +metadata: + name: signup-form-service +spec: + selector: + app: signup-form + type: LoadBalancer + ports: + - protocol: TCP + port: 80 + targetPort: 80 \ No newline at end of file diff --git a/testing/README.md b/testing/README.md index a84cc3d..ff4c388 100644 --- a/testing/README.md +++ b/testing/README.md @@ -1,5 +1,16 @@ -# webpack-template +# Testing Project -Vanilla template for webpack +This project is a JavaScript testing suite designed to provide a framework for writing and running tests for JavaScript applications. It leverages Webpack for bundling and utilizes testing libraries for executing tests. + +## Project Structure + +- `src/`: Contains the source code for the application being tested and the test files themselves. +- `tests/`: test files are contained here. +- `webpack.common.js`: Common Webpack configuration. +- `webpack.dev.js`: Webpack configuration for development. +- `webpack.prod.js`: Webpack configuration for production. + +## Setup + +1. **Install Dependencies:** -sets up common utilities needed for vanilla JS/HTML/CSS development diff --git a/tictactoe/README.md b/tictactoe/README.md new file mode 100644 index 0000000..3ccc627 --- /dev/null +++ b/tictactoe/README.md @@ -0,0 +1,22 @@ +# Tic Tac Toe + +## Description + +This is a simple Tic Tac Toe web application built using HTML, CSS, and JavaScript. Players can take turns marking spaces in a 3x3 grid, and the game will automatically detect a win or a draw. + +## How to Run Locally + +1. **Clone the Repository** + If you haven't already, clone the repository to your local machine. + +2. **Open `index.html`** + Navigate to the project directory in your file explorer and open the `index.html` file in your web browser. + +3. **Play** + You can now play Tic Tac Toe in your browser. Click on the empty cells to make your move. + +## Project Structure + +- `index.html`: The main HTML file for the game. +- `css/style.css`: Contains the styling for the game's interface. +- `js/main.js`: Contains the JavaScript code for the game logic. \ No newline at end of file diff --git a/tictactoe/devops/Dockerfile b/tictactoe/devops/Dockerfile new file mode 100644 index 0000000..902db66 --- /dev/null +++ b/tictactoe/devops/Dockerfile @@ -0,0 +1,13 @@ +# Use an official Nginx image as the base image +FROM nginx:latest + +# Set the working directory to /app +WORKDIR /app + +# Copy the HTML, CSS, and JavaScript files to the Nginx default directory +COPY . /usr/share/nginx/html + +# Expose port 80 to allow external access +EXPOSE 80 + +# The Nginx server will start automatically when the container starts \ No newline at end of file diff --git a/tictactoe/devops/deployment.yaml b/tictactoe/devops/deployment.yaml new file mode 100644 index 0000000..5d9b12e --- /dev/null +++ b/tictactoe/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tictactoe-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: tictactoe + template: + metadata: + labels: + app: tictactoe + spec: + containers: + - name: tictactoe-container + image: ghcr.io/smiggiddy/odin-codeprojects/tictactoe:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: tictactoe-service +spec: + selector: + app: tictactoe + type: LoadBalancer + ports: + - protocol: TCP + port: 80 + targetPort: 80 \ No newline at end of file diff --git a/todo/README.md b/todo/README.md new file mode 100644 index 0000000..dd91da4 --- /dev/null +++ b/todo/README.md @@ -0,0 +1,60 @@ +# Todo Project + +This is a web application that allows you to create and manage a todo list. + +## Description + +This project allows you to create, edit, and delete tasks from a todo list. The project utilizes Javascript, HTML, and CSS. + +## Features + +* Add new tasks to the todo list. +* Mark tasks as complete. +* Delete tasks from the todo list. + +## Local Development + +To run this project locally, follow these steps: + +1. **Clone the repository:** +``` +bash + git clone + +``` +2. **Navigate to the project directory:** +``` +bash + cd todo + +``` +3. **Open `index.html`:** Open the `index.html` file in your web browser. + +## Build + +The build of this project is handled through webpack. + +1. **Install Dependencies:** +``` +bash + npm install + +``` +2. **Run Build:** +``` +bash + npm run build + +``` +After running build, a `bundle.js` will be generated. + +## Usage + +Once you have the project running, you can use the interface in your browser to interact with the todo list. + +## Technologies Used + +* HTML +* CSS +* JavaScript +* webpack \ No newline at end of file diff --git a/todo/devops/Dockerfile b/todo/devops/Dockerfile new file mode 100644 index 0000000..416a949 --- /dev/null +++ b/todo/devops/Dockerfile @@ -0,0 +1,38 @@ +# Use an official Node.js runtime as the base image +FROM node:18-alpine as builder + +# Set the working directory in the container +WORKDIR /app + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install any needed dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Build the application +RUN npm run build + +# Use an official Nginx runtime as the base image +FROM nginx:stable-alpine + +# Set the working directory in the container +WORKDIR /usr/share/nginx/html + +# Remove default nginx static files +RUN rm -rf ./* + +# Copy static files from the builder stage +COPY --from=builder /app/dist . + +# Copy the nginx configuration file +COPY ./nginx.conf /etc/nginx/conf.d/default.conf + +# Expose port 80 +EXPOSE 80 + +# Command to run when starting the container +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/todo/devops/deployment.yaml b/todo/devops/deployment.yaml new file mode 100644 index 0000000..e466289 --- /dev/null +++ b/todo/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: todo-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: todo + template: + metadata: + labels: + app: todo + spec: + containers: + - name: todo + image: ghcr.io/smiggiddy/odin-codeprojects/todo:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: todo-service +spec: + selector: + app: todo + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: LoadBalancer \ No newline at end of file diff --git a/weather/README.md b/weather/README.md index a84cc3d..9d5b1a8 100644 --- a/weather/README.md +++ b/weather/README.md @@ -1,5 +1,15 @@ -# webpack-template +# Weather Project -Vanilla template for webpack +This project is a web application that allows you to search for weather information for different locations. It is built using HTML, CSS, and JavaScript. + +## Features + +* Search for weather by city name. +* Displays current weather conditions. + +## Local Development + +To run this project locally, follow these steps: + +1. **Clone the repository:** -sets up common utilities needed for vanilla JS/HTML/CSS development diff --git a/weather/devops/Dockerfile b/weather/devops/Dockerfile new file mode 100644 index 0000000..f85dae4 --- /dev/null +++ b/weather/devops/Dockerfile @@ -0,0 +1,35 @@ +# Use a Node.js base image to build the project +FROM node:18-alpine as builder + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json (or yarn.lock) +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Build the project using webpack +RUN npm run build + +# Use an official nginx image as the base image +FROM nginx:stable-alpine + +# Set the working directory +WORKDIR /var/www/html + +# Remove default nginx content +RUN rm -rf ./* + +# Copy the built files from the builder stage to nginx's html directory +COPY --from=builder /app/dist . + +# Expose port 80 +EXPOSE 80 + +# Start nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/weather/devops/deployment.yaml b/weather/devops/deployment.yaml new file mode 100644 index 0000000..85a7d5c --- /dev/null +++ b/weather/devops/deployment.yaml @@ -0,0 +1,32 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: weather-deployment +spec: + replicas: 3 + selector: + matchLabels: + app: weather + template: + metadata: + labels: + app: weather + spec: + containers: + - name: weather + image: ghcr.io/smiggiddy/odin-codeprojects/weather:latest + ports: + - containerPort: 80 +--- +apiVersion: v1 +kind: Service +metadata: + name: weather-service +spec: + selector: + app: weather + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: LoadBalancer \ No newline at end of file