diff --git a/client/public/global.css b/client/public/global.css index 51f2128b6..dd6ecee4c 100644 --- a/client/public/global.css +++ b/client/public/global.css @@ -339,3 +339,40 @@ h1, h2, h3, h4, h5, h6 { .stop-scroll{ overflow: hidden!important; } + +.event__public_holiday{ + text-align: center; + color: white; + margin-top: 15px; +} +.event__meeting{ + text-align: center; + color: white; + margin-top: 67px; +} +.event__vacation{ + text-align: center; + color: white; + margin-top: 39px !important; +} +.event__event{ + text-align: center; + color: white; + margin-top: 20px !important; +} +.event__birthday{ + text-align: center; + color: white; + margin-top: -95px !important; + width: 30px; + border-radius: 50%; + height: 30px; + display: flex; + align-items: center; + justify-content: center; + margin-left: 125px; + /* padding: 20px; */ +} +.p-relative{ + position: relative; +} \ No newline at end of file diff --git a/client/src/componants/calendar/CalendarDatePicker.svelte b/client/src/componants/calendar/CalendarDatePicker.svelte index b52c4b338..d0d875dba 100644 --- a/client/src/componants/calendar/CalendarDatePicker.svelte +++ b/client/src/componants/calendar/CalendarDatePicker.svelte @@ -63,7 +63,7 @@ style={` opacity: ${isLoading ? '0.1' : '1'}`} > {#if errorMessage} -
+
- import type { eventNameType } from '../../utils/types'; - export let eventNames: Set; - - function eventChanger(event: eventNameType) { - if (eventNames.has(event)) { - eventNames.delete(event); - eventNames = new Set([...eventNames]); - - } else { - eventNames.add(event); - eventNames = new Set([...eventNames]); - } + import type { eventNameType } from '../../utils/types'; + import { CalenderEventEmojeTyoe } from "../../utils/enums" + export let eventNames: Set; + + function eventChanger(event: eventNameType) { + if (eventNames.has(event)) { + eventNames.delete(event); + eventNames = new Set([...eventNames]); + + } else { + eventNames.add(event); + eventNames = new Set([...eventNames]); } + } - -
-
+ +
+
+ Calendar Filters +
+ Click on any filter to hide the value of it from the calendar +
+
+
{eventChanger('meeting');}} > - 💼 Meeting + Meetings {CalenderEventEmojeTyoe.meeting} {eventNames.has('meeting') ? '✔️' : '❌'}
-
+
{ eventChanger('event'); }} > - 🎉 Event + Events {CalenderEventEmojeTyoe.event} {eventNames.has('event') ? '✔️' : '❌'}
-
+
- 🌴 Vacation + Vacations {CalenderEventEmojeTyoe.vacation} {eventNames.has('vacation') ? '✔️' : '❌'}
-
+
+ +
{ + eventChanger('public_holiday'); + }} + > + Public-Holidays {CalenderEventEmojeTyoe.publicHoliday} + {eventNames.has('public_holiday') ? '✔️' : '❌'} +
+
+
- 🎂 Birthday + Birthday {CalenderEventEmojeTyoe.birthday} {eventNames.has('birthday') ? '✔️' : '❌'}
+
- - \ No newline at end of file diff --git a/client/src/componants/calendar/CalendarForm.svelte b/client/src/componants/calendar/CalendarForm.svelte index 36389a48c..e1ee21258 100644 --- a/client/src/componants/calendar/CalendarForm.svelte +++ b/client/src/componants/calendar/CalendarForm.svelte @@ -22,7 +22,7 @@ let datePickerDisabled = false; let VacationCalculator: number; - const handleVacationCalculator = (event: { detail: { text: number; }; }) => { + const handleVacationCalculator = (event: { detail: { text: number; }; }) => { VacationCalculator = event.detail.text; }; @@ -32,7 +32,7 @@ -
+
{ + + const capitalize = (name: string) => { + if(name.includes("_")){ + name = name.replace("_", " ") + } + return name[0].toLocaleUpperCase()+name.slice(1) + } + const clickedItem = (item: calendarItemsType) => { clickedItemOnModal = item showModal = true } @@ -68,7 +74,7 @@ {#if isLoading} -
+
{#each [1,2,3,4,5,6,7] as row}
{#each [1,2,3,4,5] as col } @@ -78,7 +84,7 @@ {/each}
{:else} -
+

@@ -105,33 +111,96 @@ {#if items.length > 0} {#each items as item} - {#if eventNames.has(item.eventName)} + {#if eventNames.has(item.eventName) && item.eventName === 'public_holiday'} + +
dispatch('itemClick',item)} + class="task event__public_holiday {item.className}" + style="grid-column: {item.startCol} / span {item.len}; + grid-row: {item.startRow}; + align-self: {item.isBottom?'end':'center'};" + > + +
+ {:else if eventNames.has(item.eventName) && item.eventName === 'meeting'} + +
dispatch('itemClick',item)} + class="task event__meeting {item.className}" + style="grid-column: {item.startCol} / span {item.len}; + grid-row: {item.startRow}; + align-self: {item.isBottom?'end':'center'};" + > + + + + + +
+ {:else if eventNames.has(item.eventName) && item.eventName === "vacation"}
dispatch('itemClick',item)} - class="task {item.className}" + on:click={()=>dispatch('itemClick',item)} + class="task event__vacation {item.className}" style="grid-column: {item.startCol} / span {item.len}; - grid-row: {item.startRow}; - align-self: {item.isBottom?'end':'center'};" - > - + {capitalize(item.title)} {CalenderEventEmojeTyoe.vacation} + +
+ {:else if eventNames.has(item.eventName) && item.eventName === "event"} + +
dispatch('itemClick',item)} + class="task event__event {item.className}" + style="grid-column: {item.startCol} / span {item.len}; + grid-row: {item.startRow}; + align-self: {item.isBottom?'end':'center'};" + > + +
+ {:else if eventNames.has(item.eventName) && item.eventName === "birthday"} + +
dispatch('itemClick',item)} + class="task event__birthday {item.className}" + style="grid-column: {item.startCol} / span {item.len}; + grid-row: {item.startRow}; + align-self: {item.isBottom?'end':'center'};" + > +
- {/if} {/each} {/if} @@ -287,16 +356,7 @@ } .task { - border-left-width: 3px; - padding: 8px 12px; - margin: 10px; - border-left-style: solid; - font-size: 14px; - position: relative; - align-self: center; z-index: 2; - border-radius: 15px; - text-align: left; cursor: pointer; } .task:hover { @@ -316,9 +376,15 @@ :global(.task--warning) { border-left-color: #fdb44d; background: #fef0db; - color: #fc9b10; + color: #fc9b10 !important; align-self: flex-start!important; - margin-top: 5px!important; + } + :global(.task--success) { + border-left-color: #fef0db; + background: #5f84d0; + color: white !important; + /* align-self: flex-start!important; */ + /* margin-top: 55px; */ } :global(.task--danger) { border-left-color: #fa607e; diff --git a/client/src/componants/compensations/CompensationForm.svelte b/client/src/componants/compensations/CompensationForm.svelte index 722bc3832..8a3f5959a 100644 --- a/client/src/componants/compensations/CompensationForm.svelte +++ b/client/src/componants/compensations/CompensationForm.svelte @@ -82,9 +82,7 @@ try { CompensationData.from_date = startDate; CompensationData.end_date = endDate; - const axios = await CompensationsDataService.post(CompensationData); - console.log(axios.data.results); - + const axios = await CompensationsDataService.post(CompensationData); dispatch('message', { postedCompensation: axios.data.results }); diff --git a/client/src/pages/Calendar.svelte b/client/src/pages/Calendar.svelte index 1e8fa19b6..263011634 100644 --- a/client/src/pages/Calendar.svelte +++ b/client/src/pages/Calendar.svelte @@ -2,10 +2,10 @@ import Calendar from "../componants/calendar/Calender.svelte"; import CalendarEventsFilter from "../componants/calendar/CalendarEventsFilter.svelte"; import CalendarEventForm from "../componants/calendar/CalendarForm.svelte"; - import { dayNames, monthNames, initMonthItems, initMonth} from "../utils/calendar" - import { findRowCol } from "../utils/calendar" - import type { calendarItemsType, eventItemType, eventNameType, meetingItemType, userDataType, vacationItemType } from '../utils/types'; - import Sidebar from "../componants/sidebar/Sidebar.svelte" + import { dayNames, initMonthItems, initMonth} from "../utils/calendar" + import { findRowCol } from "../utils/calendar" + import type { calendarItemsType, eventNameType } from '../utils/types'; + import Sidebar from "../componants/sidebar/Sidebar.svelte" export let isLoading: boolean = false; @@ -23,8 +23,8 @@ async function initContent() { isLoading = true; headers = dayNames; - days = initMonth(days, month, year); - items = await initMonthItems(isLoading, month, year, items, days); + days = initMonth(days, month, year); + items = await initMonthItems(isLoading, month, year, items, days); isLoading = false; } @@ -33,19 +33,18 @@ 'vacation', 'meeting', 'birthday', + 'public_holiday' ]); $: month, year, initContent(); - +
-
-
-
- +
+
+
+ { if (event.detail.postedVacation){ @@ -75,27 +74,23 @@ }} />
- { - if (items != undefined) { - items = items.filter((item) => item.id !== event.detail.id); - } // TODO: delete from server - }} - /> +
+ { + if (items != undefined) { + items = items.filter((item) => item.id !== event.detail.id); + } // TODO: delete from server + }} + /> +
- - diff --git a/client/src/utils/calendar.ts b/client/src/utils/calendar.ts index 44e55fcbf..8e1efaeb9 100644 --- a/client/src/utils/calendar.ts +++ b/client/src/utils/calendar.ts @@ -71,10 +71,11 @@ export async function initMonthItems( export function initMonth(days: any[], month: number, year: number) { days = []; let monthAbbrev = monthNames[month].slice(0,3); - let nextMonthAbbrev = monthNames[(month+1)%12].slice(0,3); + let nextMonthAbbrev = monthNames[(month+1)%12].slice(0,3); // find the last Monday of the previous month var firstDay = new Date(year, month, 1).getDay(); + var daysInThisMonth = new Date(year, month+1, 0).getDate(); var daysInLastMonth = new Date(year, month, 0).getDate(); @@ -114,8 +115,8 @@ export function initMonth(days: any[], month: number, year: number) { ); }; - // show any days to fill up the last row (disabled) - always less than 7 - for (let i = 0; days.length % 7; i++) { + // show any days to fill up the last row (disabled) - always less than 10 + for (let i = 0; days.length % 10; i++) { let d = new Date( (month == 11 ? year + 1 : year), ( month + 1 ) % 12, i + 1 diff --git a/client/src/utils/enums.ts b/client/src/utils/enums.ts index 7c74efe10..5248b33f8 100644 --- a/client/src/utils/enums.ts +++ b/client/src/utils/enums.ts @@ -6,10 +6,11 @@ export enum CalenderEventTyoe { } export enum CalenderEventEmojeTyoe { - vacation = "🌴", - event = "🎉", - birthday = "🎂", - meeting = "💼" + vacation = "🌴", + event = "🎉", + birthday = "🎂", + publicHoliday = "💒", + meeting = "💼" } export enum UserTypeEnum { diff --git a/client/src/utils/types.ts b/client/src/utils/types.ts index 681ae8da4..2e6cab8d8 100644 --- a/client/src/utils/types.ts +++ b/client/src/utils/types.ts @@ -13,7 +13,8 @@ export type eventNameType = | "vacation" | "meeting" | "event" - | "birthday"; + | "birthday" + | "public_holiday"; export interface GeneralUserInterface { id: number; diff --git a/client/src/utils/validations.ts b/client/src/utils/validations.ts index a62cf72f8..62230743e 100644 --- a/client/src/utils/validations.ts +++ b/client/src/utils/validations.ts @@ -136,9 +136,7 @@ export function isValidDate(d: any) { } else { try { const date = new Date(d); - console.log("date is: ", date); - - return true; + return date.getDate() ? true : false } catch { return false; }; diff --git a/server/cshr/migrations/0071_publicholiday.py b/server/cshr/migrations/0071_publicholiday.py new file mode 100644 index 000000000..ff7b20448 --- /dev/null +++ b/server/cshr/migrations/0071_publicholiday.py @@ -0,0 +1,43 @@ +# Generated by Django 4.1.2 on 2023-11-01 12:39 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ("cshr", "0070_alter_office_weekend"), + ] + + operations = [ + migrations.CreateModel( + name="PublicHoliday", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("created_at", models.DateTimeField(auto_now_add=True, db_index=True)), + ("modified_at", models.DateTimeField(auto_now=True)), + ("date", models.DateField()), + ("days", models.JSONField(default=list)), + ( + "location", + models.OneToOneField( + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="cshr.office", + ), + ), + ], + options={ + "unique_together": {("date", "location")}, + }, + ), + ] diff --git a/server/cshr/migrations/0072_rename_date_publicholiday_holiday_date_and_more.py b/server/cshr/migrations/0072_rename_date_publicholiday_holiday_date_and_more.py new file mode 100644 index 000000000..848036fe6 --- /dev/null +++ b/server/cshr/migrations/0072_rename_date_publicholiday_holiday_date_and_more.py @@ -0,0 +1,41 @@ +# Generated by Django 4.1.2 on 2023-11-01 16:58 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ("cshr", "0071_publicholiday"), + ] + + operations = [ + migrations.RenameField( + model_name="publicholiday", + old_name="date", + new_name="holiday_date", + ), + migrations.AlterUniqueTogether( + name="publicholiday", + unique_together=set(), + ), + migrations.AlterField( + model_name="publicholiday", + name="location", + field=models.ForeignKey( + default="", + on_delete=django.db.models.deletion.CASCADE, + to="cshr.office", + ), + preserve_default=False, + ), + migrations.AlterUniqueTogether( + name="publicholiday", + unique_together={("holiday_date", "location")}, + ), + migrations.RemoveField( + model_name="publicholiday", + name="days", + ), + ] diff --git a/server/cshr/models/vacations.py b/server/cshr/models/vacations.py index a78c33446..b64b98df4 100644 --- a/server/cshr/models/vacations.py +++ b/server/cshr/models/vacations.py @@ -1,8 +1,11 @@ from django.db import models +from server.cshr.models.abstracts import TimeStamp +from server.cshr.models.office import Office from server.cshr.models.users import User from server.cshr.models.requests import Requests +from django.core.exceptions import ValidationError class REASON_CHOICES(models.TextChoices): @@ -56,3 +59,13 @@ class VacationBalance(models.Model): def __str__(self): return str(self.user.email) + +class PublicHoliday(TimeStamp): + location = models.ForeignKey(Office, on_delete=models.CASCADE) + holiday_date = models.DateField() + + class Meta: + unique_together = ('holiday_date', 'location',) + + def __str__(self): + return str(f"{self.location.country} - {self.holiday_date}") diff --git a/server/cshr/serializers/public_holidays.py b/server/cshr/serializers/public_holidays.py new file mode 100644 index 000000000..eb8f8c83e --- /dev/null +++ b/server/cshr/serializers/public_holidays.py @@ -0,0 +1,17 @@ +from rest_framework.serializers import ModelSerializer, SerializerMethodField +from server.cshr.models.vacations import PublicHoliday +from server.cshr.serializers.office import OfficeSerializer + + +class PublicHolidaySerializer(ModelSerializer): + """ + This class will be used to get all info about Public Holidays + """ + location = SerializerMethodField() + + class Meta: + model = PublicHoliday + fields = ["id", "location", "holiday_date"] + + def get_location(self, obj: PublicHoliday): + return OfficeSerializer(obj.location).data diff --git a/server/cshr/services/landing_page.py b/server/cshr/services/landing_page.py index c30fabb51..0474525ab 100644 --- a/server/cshr/services/landing_page.py +++ b/server/cshr/services/landing_page.py @@ -1,16 +1,19 @@ """This file contains everything related to the landing page functionalty.""" import datetime +import json from server.cshr.api.response import CustomResponse from server.cshr.models.event import Event from server.cshr.models.meetings import Meetings from server.cshr.models.users import User -from server.cshr.models.vacations import Vacation +from server.cshr.models.vacations import PublicHoliday, Vacation from server.cshr.serializers.event import EventSerializer from server.cshr.serializers.meetings import MeetingsSerializer +from server.cshr.serializers.public_holidays import PublicHolidaySerializer from server.cshr.serializers.users import BaseUserSerializer from server.cshr.serializers.vacations import LandingPageVacationsSerializer from server.cshr.services.event import filter_events_by_month_and_year from server.cshr.services.meetings import filter_meetings_by_month_and_year +from server.cshr.services.public_holidays import filter_public_holidays_by_month_and_year from server.cshr.services.users import filter_users_by_berithday_month from server.cshr.services.vacations import filter_vacations_by_month_and_year from typing import Any, List, Dict, Union @@ -20,12 +23,14 @@ class LandingPageTypeEnum(Enum): VACATION = "vacation" + PUBLIC_HOLIDAY = "public_holiday" BIRTHDAY = "birthday" MEETING = "meeting" Event = "event" class LandingPageClassNameEnum(Enum): + PUBLIC_HOLIDAY = "task--success" VACATION = "task--warning" BIRTHDAY = "task--primary" MEETING = "task--danger" @@ -48,9 +53,12 @@ def landing_page_calendar_functionality(user: User, month: str, year: str): users_birthdates: List[User] = filter_users_by_berithday_month(month).order_by( "-created_at" ) + public_holidays: PublicHoliday = filter_public_holidays_by_month_and_year(user, year, month).order_by( + "-created_at" + ) objects: Union[List[Any], None] = list( - chain(vacations, events, meetings, users_birthdates) + chain(public_holidays, vacations, events, meetings, users_birthdates) ) response: List[Any] = [] @@ -69,6 +77,13 @@ def landing_page_calendar_functionality(user: User, month: str, year: str): ), many=True, ).data + elif isinstance(object, PublicHoliday): + obj["title"] = LandingPageTypeEnum.PUBLIC_HOLIDAY.value + obj["className"] = LandingPageClassNameEnum.PUBLIC_HOLIDAY.value + obj["eventName"] = LandingPageTypeEnum.PUBLIC_HOLIDAY.value + obj["holidays"] = PublicHolidaySerializer(public_holidays, many=True,).data + obj["date"] = object.holiday_date + obj["len"] = 1 elif isinstance(object, Meetings): obj["title"] = LandingPageTypeEnum.MEETING.value obj["date"] = object.date diff --git a/server/cshr/services/public_holidays.py b/server/cshr/services/public_holidays.py new file mode 100644 index 000000000..817982707 --- /dev/null +++ b/server/cshr/services/public_holidays.py @@ -0,0 +1,12 @@ + +from server.cshr.models.office import Office +from server.cshr.models.users import User +from server.cshr.models.vacations import PublicHoliday + + +def filter_public_holidays_by_month_and_year(user: User, year: str, month: str): + """ + Filter holidays based on user location and the year and month to be displayed on the calander. + """ + location: Office = user.location + return PublicHoliday.objects.filter(location=location, holiday_date__year=year, holiday_date__month=month) \ No newline at end of file diff --git a/server/cshr/utils/vacation_balance.json b/server/cshr/utils/vacation_balance.json index ec235ad8a..661f9bedf 100644 --- a/server/cshr/utils/vacation_balance.json +++ b/server/cshr/utils/vacation_balance.json @@ -1 +1 @@ -{"annual_leaves": 12, "sick_leaves": 100, "compensation": 100, "unpaid": 100, "emergency_leaves": 5, "leave_excuses": 10, "public_holidays": ["2022-10-13"], "year": 2022} \ No newline at end of file +{"annual_leaves": 12, "sick_leaves": 100, "compensation": 100, "unpaid": 100, "emergency_leaves": 12, "leave_excuses": 12, "public_holidays": ["2023-11-2"], "year": 2023} \ No newline at end of file diff --git a/server/cshr/utils/vacation_balance_helper.py b/server/cshr/utils/vacation_balance_helper.py index a05468bf5..10135862a 100644 --- a/server/cshr/utils/vacation_balance_helper.py +++ b/server/cshr/utils/vacation_balance_helper.py @@ -144,6 +144,9 @@ def remove_weekends(self, user: User, start_date: datetime, end_date: datetime): if not day.strftime("%A") in weekend: actual_days.append(day) return len(actual_days) + + def remove_holidays(self, user: User, start_date: datetime, end_date: datetime): + pass def vacation_update_balance(self, vacation: Vacation): """ diff --git a/server/cshr/views/vacations.py b/server/cshr/views/vacations.py index 3980f1794..7426a5593 100644 --- a/server/cshr/views/vacations.py +++ b/server/cshr/views/vacations.py @@ -128,7 +128,7 @@ def post(self, request: Request) -> Response: set_notification_request_redis(serializer.data) - send_email_for_request(request.user.id, msg, "Vacation request") + # send_email_for_request(request.user.id, msg, "Vacation request") # if not sent: # return CustomResponse.bad_request(message="Error in sending email, can not sent email with this request.") response_date: Dict = send_vacation_to_calendar(saved) @@ -389,7 +389,7 @@ def get(self, request: Request) -> Response: balance = v.check(user) request.data["user"] = TeamSerializer(user).data return CustomResponse.success( - message="Baance founded.", data=CalculateBalanceSerializer(balance).data + message="Sucess found balance.", data=CalculateBalanceSerializer(balance).data ) def put(self, request: Request) -> CustomResponse: @@ -450,4 +450,7 @@ def get(self, request: Request) -> Response: actual_days: int = v.remove_weekends( user, converted_from_date, converted_end_date ) - return CustomResponse.success(message="Baance founded.", data=actual_days) + actual_days: int = v.remove_holidays( + user, converted_from_date, converted_end_date + ) + return CustomResponse.success(message="Balance calculated.", data=actual_days) diff --git a/terraform/.terraform.lock.hcl b/terraform/.terraform.lock.hcl index 8221fa34d..13ef2aebd 100644 --- a/terraform/.terraform.lock.hcl +++ b/terraform/.terraform.lock.hcl @@ -1,9 +1,17 @@ # This file is maintained automatically by "terraform init". # Manual edits may be lost in future updates. -provider "threefoldtechdev.com/providers/grid" { - version = "0.2.0" +provider "registry.terraform.io/threefoldtech/grid" { + version = "1.9.2" hashes = [ - "h1:a+rj5fgrvu7r8C7pkWqBywn18h0qrB1c8CFLPiKD1Lo=", + "h1:Esup6X6dLYAbB0s4P1Z1gRSuFwdKbgpvVouel8xTL68=", + "zh:06c87d8c51748522179771c98ea0751b3200c02b6a49f1c3e24a897a83fde3ec", + "zh:09ff3345f62874675c40a4b219be53e8281d3c953407c7124d57a03e645bc73d", + "zh:3e9ee0dfe8571bc681890b8e87b7f924c82bfbf53f7d22adda7de1fa728ae7bf", + "zh:8714060c00a6305625dacd9e11f6112825fbf24e6d7cce5bf9d00695df7b6a95", + "zh:874f4a5ed8acff4f262e54e4b53182ab5b45b516deeadbb6c44eff431e6e0147", + "zh:a87dc788e9e69bf88ff7e9e71c519e7e07446b5bbfeef3a12e900d7609dd36d2", + "zh:c735cc12670a1d31b679855814e7b1658e3a8ce26a2e91d2d70f7c521a3178fb", + "zh:e4681c1c2fbf09948b90966ad4be47d371082528e0dc3c219aec1ad1ab164a4c", ] } diff --git a/terraform/main.tf b/terraform/main.tf index 93379f103..f8655a010 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { grid = { source = "threefoldtech/grid" - version = "1.9.1-dev" + # version = "1.9.3-dev" } } } @@ -14,30 +14,30 @@ provider "grid" { data "grid_gateway_domain" "server_domain" { node = 11 - name = "cshrserver" + name = "newcshrserver" } data "grid_gateway_domain" "client_domain" { node = 11 - name = "cshr" + name = "newcshr" } -resource "grid_network" "net1" { +resource "grid_network" "net2" { nodes = [11] ip_range = "10.1.0.0/16" - name = "cshrnetwork1" + name = "newcshrnetwork" description = "newer network" add_wg_access = true } resource "grid_deployment" "d1" { node = 11 - network_name = grid_network.net1.name + network_name = grid_network.net2.name vms { name = "cshrservervm" flist = "https://hub.grid.tf/omda.3bot/codescalersinternship-cshr_server-latest.flist" cpu = 2 - memory = 1024 + memory = 4096 publicip = false planetary = true entrypoint = "/sbin/zinit init" @@ -58,14 +58,14 @@ resource "grid_deployment" "d1" { resource "grid_deployment" "d2" { node = 11 - network_name = grid_network.net1.name + network_name = grid_network.net2.name vms { - name = "cshrclientvm" + name = "cshrclientvmnew" publicip = false planetary = true flist = "https://hub.grid.tf/omda.3bot/codescalersinternship-cshr_client-latest.flist" - cpu = 1 - memory = 1024 + cpu = 2 + memory = 4096 entrypoint = "/sbin/zinit init" env_vars = { SSH_KEY = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCF3JezThwSchTvkF2oPtn8X6chevNsfE58dIY3/eg5zK9tKgNYIB2saoFh12a0AJU424sAeLO0HghhNhe/Co62xkzHhk6EpXWNSFkrlzw+FVn1FKDZbbOZH47sC3n6p5a3YhM4dALssZ/aZdpaKBgXkzk91usJ+GVa+eOnpMRBlHgi9PpvowyzPSKeH9ZcVRBPnVU+nQGyV+kd6RahNBoNgNrHu/QFI92yg/y/7Szus1IS0U92cWKf/K/Sot7O10kSjmj06lMGOO8zdENk/xrtUtRHzemCj+mq0Q/3KUMCGvdb/tH0TDeNenxvibummiym4VTcnYqbm+RDXWG8HUc/RPfEVBl8p1NGZnkBt6QJl5hddHaYwx8CCmf3maSrQFcmrWYtlUDBXYkPyrv0qmy2gM1PScntF/X9zhIfnELlyAVAKXfzVwixrBh7oOIAqefydSVcwWtCXoH38F5q/zo9bQv+eHntI83mZrUUT7JGirQF64fpJKbCZPhv0kUm9bF7DVQMiyRZdk748cgVp7dEzMVlrfZ2eIvZag5zmuJTPB7bw00+Ik9jNaOIhEoCWEaYBw7KmrLonesV8rWUkEAwWPe28bXCVmUZlgZbWJi7BFWCst2Z/j2WgScHbdAv28gAcneDW4yQmt2YaYqXqmwgSVCaD/irq5FSO4upmo5u0Q== mahmmoud.hassanein@gmail.com" @@ -76,14 +76,14 @@ resource "grid_deployment" "d2" { resource "grid_name_proxy" "p1" { node = 11 - name = "cshrserver" + name = "newcshrserver" backends = [format("http://[%s]:8000", grid_deployment.d1.vms[0].ygg_ip)] tls_passthrough = false } resource "grid_name_proxy" "p2" { node = 11 - name = "cshr" + name = "newcshr" backends = [format("http://[%s]:6000", grid_deployment.d2.vms[0].ygg_ip)] tls_passthrough = false } diff --git a/terraform/state.json b/terraform/state.json index 634724d83..1e3357e94 100644 --- a/terraform/state.json +++ b/terraform/state.json @@ -1 +1 @@ -{"networks":{"network":{"Subnets":{"14":"10.1.3.0/24"},"NodeDeploymentHostIDs":{"14":{"25465":"Ag==","25466":"Ag=="}}}}} \ No newline at end of file +{"networks":{"newcshrnetwork":{"Subnets":{"11":"10.1.3.0/24"},"NodeDeploymentHostIDs":{"11":{"44499":"Ag==","44500":"Ag=="}}}}} \ No newline at end of file