Skip to content

Commit

Permalink
v0.8.2 (#173)
Browse files Browse the repository at this point in the history
* v0.8.2

### Fixed

- Issue that prevented the push of a manifest if the metadata already existed in
  the catalog
- Issue where the delete of a catalog would fail if the ID was used
- Issue with documentation links in the index.md for discord

### Changed

- Added version to all telemetry events
- Added more information to the hardware endpoint

* fixing the projects workflow issue
  • Loading branch information
cjlapao authored Jun 18, 2024
1 parent e268b10 commit 6a3d98a
Show file tree
Hide file tree
Showing 24 changed files with 288 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Assign Projects
env:
repo: ${{ github.head_ref }}
project: "Parallels Desktop DevOps Service"
project: "Parallels DevOps Service"
runs-on: ubuntu-latest
steps:
- name: git checkout
Expand Down
5 changes: 2 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
// Comment out if you do not need to setup environment variables for the module
"envFile": "${workspaceFolder}/.env",
"args": [
"catalog",
"${input:catalog_command}",
"--file=${input:catalog_pdfile}"
"push",
"/tmp/push_test1.pdfile",
]
},
{
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed

## [0.8.1] - 2024-06-03
## [0.8.2] - 2024-06-18

### Fixed

- Issue that prevented the push of a manifest if the metadata already existed in
the catalog
- Issue where the delete of a catalog would fail if the ID was used
- Issue with documentation links in the index.md for discord

### Changed

- Added version to all telemetry events
- Added more information to the hardware endpoint

## [0.8.1] - 2024-06-17

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ get the status of a virtual machine.

## Community

![Discord](./docs/img/discord_join_server.png)
[![Discord Server](./docs/img/discord_join_server.png)](https://discord.gg/pEwZ254C3d)
Join our [Discord server](https://discord.gg/pEwZ254C3d) to ask questions, share
your experience, and get help from the community.

Expand Down
1 change: 1 addition & 0 deletions docs/_data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
link: /examples/orchestrator/
- name: Github Actions
link: /examples/github-actions/

10 changes: 10 additions & 0 deletions docs/_includes/changelog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<ul>
{% for category in site.categories limit:5 %}
{% assign cat = category | first %}
{% if cat == "release" %}
<li><a name="{{ category | first }}">{{ cat }}</a>
</li>
{% endif %}
{% endfor %}
</ul>

9 changes: 9 additions & 0 deletions docs/_includes/latest-release.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<div>
<h1>{{ post.title}}</h1>
<div class="index_release" >
{{ post.content }}
</div>
<footer class="card-footer">
<p class="card-footer-item">Published: {{ post.date | date: "%b %-d, %Y" }}</p>
</footer>
</div>
14 changes: 14 additions & 0 deletions docs/_sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,18 @@ $hero-darken: $dark !default;

.big_padding {
padding: 2rem 16rem !important;
}

.index_release {
h1 {
font-size: 1.6rem;
}

h2 {
font-size: 1.4rem;
}

h3 {
font-size: 1.2rem;
}
}
5 changes: 4 additions & 1 deletion docs/docs/getting-started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ The root object of the configuration file is the environment object, which conta
| DATABASE_SAVE_INTERVAL_MINUTES | The interval in minutes that the database will be saved in minytes | 5 minutes |
| CATALOG_CACHE_FOLDER | The folder where the catalog cache will be stored | /User/Folder/.prl-devops-service/catalog |
| PARALLELS_DESKTOP_REFRESH_INTERVAL | The interval in seconds that the service will refresh the Parallels Desktop virtual machines in seconds | 15 seconds |

| SYSTEM_RESERVED_CPU | The number of cpu cores that will be reserved for the system and not used for Orchestrator | 1 |
| SYSTEM_RESERVED_MEMORY | The amount of memory that will be reserved for the system and not used for Orchestrator in Mb's | 2048 |
| SYSTEM_RESERVED_DISK | The amount of disk space that will be reserved for the system and not used for Orchestrator in Mb's | 20000 |

### Rest API

Expand All @@ -67,6 +69,7 @@ The root object of the configuration file is the environment object, which conta
| ENABLE_PACKER_PLUGIN | Specifies whether the service should enable the packer plugin | false |
| ENABLE_VAGRANT_PLUGIN | Specifies whether the service should enable the vagrant plugin | false |


### Json Web Tokens

| Flag | Description | Default Value |
Expand Down
22 changes: 11 additions & 11 deletions docs/examples/github-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ Fortunately, GitHub allows you to run your own self-hosted runners, which enable

In this guide, we will show you how to use our Parallels Desktop GitHub Action to set up your self-hosted runner on your Mac, Windows, or Linux Vms. This will enable you to run your CI/CD pipeline without any limitations and with no extra costs, all while maintaining the same level of security and isolation as the default Github Actions runners.

If you're interested in learning more about self-hosted runners, then you can read more about them on the [Github documentation](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners).
If you're interested in learning more about self-hosted runners, then you can read more about them on the [Github documentation](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners){:target=\"_blank\"}.

**Let's get started!**

## Requirements

- [Parallels Desktop for Mac](https://www.parallels.com/products/desktop/)
- [Parallels Desktop DevOps Service](https://github.com/Parallels/prl-devops-service)
- [GitHub account and repository](https://github.com)
- [Parallels Desktop for Mac](https://www.parallels.com/products/desktop/){:target=\"_blank\"}
- [Parallels Desktop DevOps Service](https://github.com/Parallels/prl-devops-service){:target=\"_blank\"}
- [GitHub account and repository](https://github.com){:target=\"_blank\"}

{% include notification.html message="You can try **Parallels Desktop** for free before purchasing by clicking this [link](https://www.parallels.com/products/desktop/trial/) and downloading our trial version" status="is-success" icon="comments-dollar" %}
{% include notification.html message="You can try **Parallels Desktop** for free before purchasing by clicking this [link](https://www.parallels.com/products/desktop/trial/){:target=\"_blank\"} and downloading our trial version" status="is-success" icon="comments-dollar" %}

On this guide, we will show you how to set up one of our demo repositories. They are free and open to use, so you can copy the code or take inspiration for your own projects.

Expand Down Expand Up @@ -83,7 +83,7 @@ It's worth noting that while this approach is optional, you can use any of the p

### Create a new Ubuntu Server 24.04 LTS Virtual Machine

1. Download the Ubuntu Server 24.04 LTS ISO file from the [Ubuntu website](https://ubuntu.com/download/server)
1. Download the Ubuntu Server 24.04 LTS ISO file from the [Ubuntu website](https://ubuntu.com/download/server){:target=\"_blank\"}
2. Open Parallels Desktop
3. Click on the "+" button on the top left corner
4. Select "Install Windows or another OS from a DVD or image file"
Expand Down Expand Up @@ -111,11 +111,11 @@ sudo ./install

and flow the installation steps.

You can also see a more detailed guide on how to install Parallel Tools [here](https://kb.parallels.com/en/129740).
You can also see a more detailed guide on how to install Parallel Tools [here](https://kb.parallels.com/en/129740){:target=\"_blank\"}.

### Install the Github Actions Runner

The installation process of the GitHub Actions Runner on the virtual machine can be facilitated by some scripts available on our [Github repository](https://github.com/Parallels/prlctl-scripts/tree/main/github/actions-runner)
The installation process of the GitHub Actions Runner on the virtual machine can be facilitated by some scripts available on our [Github repository](https://github.com/Parallels/prlctl-scripts/tree/main/github/actions-runner){:target=\"_blank\"}

To install the runner, you can run the following commands on the terminal:

Expand Down Expand Up @@ -163,11 +163,11 @@ We should also ensure that our 'Default' runner group is configured to utilize a

## Step 4: Creating our Github Actions Workflow

Now that we have our builder virtual machine and our personal access token, we can create our Github Actions workflow. On this example we will be using a MAUI sample project from [https://github.com/dotnet/maui-samples](https://github.com/dotnet/maui-samples) and create a pipeline that will build the project.
Now that we have our builder virtual machine and our personal access token, we can create our Github Actions workflow. On this example we will be using a MAUI sample project from [https://github.com/dotnet/maui-samples](https://github.com/dotnet/maui-samples){:target=\"_blank\"} and create a pipeline that will build the project.

We selected the Weather Sample Application called WeatherTwentyOne, you can find the repository [here](https://github.com/dotnet/maui-samples/tree/main/8.0/Apps/WeatherTwentyOne/src).
We selected the Weather Sample Application called WeatherTwentyOne, you can find the repository [here](https://github.com/dotnet/maui-samples/tree/main/8.0/Apps/WeatherTwentyOne/src){:target=\"_blank\"}.

You can also find our repository with the Github Actions workflow [here](https://github.com/Locally-build/weather_twenty_one_maui).
You can also find our repository with the Github Actions workflow [here](https://github.com/Locally-build/weather_twenty_one_maui){:target=\"_blank\"}.

### Create a new Github Actions Workflow

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/orchestrator.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The service will run with default values, these are just fine for demos and to q

### Accessing the Orchestrator Service

Once the docker container is working you can access the orchestrator using any rest client, like **Postman** to access the API. Or you can install our **[Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=ParallelsDesktop.parallels-desktop)** to access the API directly from the editor.
Once the docker container is working you can access the orchestrator using any rest client, like **Postman** to access the API. Or you can install our **[Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=ParallelsDesktop.parallels-desktop){:target=\"_blank\"}** to access the API directly from the editor.

## Step 2: Installing the DevOps Service on the Hosts

Expand Down
25 changes: 15 additions & 10 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@ also allow you to manage the hosts that are running the virtual machines.

## Community

![Discord](./docs/img/discord_join_server.png)
Join our [Discord server](https://discord.gg/pEwZ254C3d) to ask questions, share
<a target="_blank" href="https://discord.gg/pEwZ254C3d">
<img src="{{ site.url }}{{ site.baseurl }}/img/discord_join_server.png" />
</a>
<p>
Join our <a target="_blank" href="https://discord.gg/pEwZ254C3d">Discord Server</a> to ask questions, share
your experience, and get help from the community.
</p>

## Schedule a Demo

If you want to schedule a demo, please schedule a meeting with out Solutions
Architect [here](https://outlook.office.com/bookwithme/user/[email protected]/meetingtype/you-CpOV8UyS0sFl9KjSWw2?anonymous&ep=mlink).
Architect [here](https://outlook.office.com/bookwithme/user/[email protected]/meetingtype/you-CpOV8UyS0sFl9KjSWw2?anonymous&ep=mlink){:target=\"_blank\"}.
We will go through the service and answer any questions you may have.

## Licensing
Expand All @@ -38,11 +42,12 @@ service beyond 10 users, you will need to purchase a Parallels Desktop Business
license. The good news is that no extra license is required for this service
once you have purchased the Parallels Desktop Business license.

## Architecture

The Parallels Desktop DevOps is a service that is written in Go and it is a very
light height designed to provide some of the missing remote management
tools for virtual machines running remotely in Parallels Desktop. It uses rest
api to execute the necessary steps. It also has RBAC (Role Based Access Control)
to allow for a secure way of managing virtual machines. You can manage most of
the operations for a Virtual Machine Lifecycle.
<p class="title is-4">Latest Release</p>
<div class="columns is-multiline">
{% for post in site.posts limit:1 %}
<div class="column is-12">
{% include latest-release.html %}
</div>
{% endfor %}
</div>
29 changes: 28 additions & 1 deletion src/catalog/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/Parallels/prl-devops-service/basecontext"
"github.com/Parallels/prl-devops-service/catalog/cleanupservice"
"github.com/Parallels/prl-devops-service/catalog/models"
db_models "github.com/Parallels/prl-devops-service/data/models"
"github.com/Parallels/prl-devops-service/errors"
"github.com/Parallels/prl-devops-service/mappers"
"github.com/Parallels/prl-devops-service/serviceprovider"
Expand Down Expand Up @@ -56,6 +57,30 @@ func (s *CatalogManifestService) Delete(ctx basecontext.ApiContext, catalogId st
}

cleanupService := cleanupservice.NewCleanupRequest()
var foundCatalogIds []db_models.CatalogManifest = make([]db_models.CatalogManifest, 0)

allManifestForCatalogId, _ := db.GetCatalogManifestsByCatalogId(ctx, catalogId)
shouldCleanMainFolder := false

if len(allManifestForCatalogId) > 0 {
for idx, manifest := range allManifestForCatalogId {
isFoundInCleanItems := false
for _, cleanItem := range cleanItems {
if cleanItem.ID == manifest.ID {
isFoundInCleanItems = true
break
}
}

if !isFoundInCleanItems {
foundCatalogIds = append(foundCatalogIds, allManifestForCatalogId[idx])
}
}

if len(foundCatalogIds) == 0 {
shouldCleanMainFolder = true
}
}

for _, cleanItem := range cleanItems {
for _, rs := range s.remoteServices {
Expand All @@ -72,7 +97,9 @@ func (s *CatalogManifestService) Delete(ctx basecontext.ApiContext, catalogId st
packFilePath := filepath.Join(cleanItem.Path, cleanItem.PackFile)
cleanupService.AddRemoteFileCleanupOperation(metadataFilePath, false)
cleanupService.AddRemoteFileCleanupOperation(packFilePath, false)
cleanupService.AddRemoteFileCleanupOperation(cleanItem.Path, true)
if shouldCleanMainFolder {
cleanupService.AddRemoteFileCleanupOperation(cleanItem.Path, true)
}
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/catalog/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,13 @@ func (s *CatalogManifestService) Push(ctx basecontext.ApiContext, r *models.Push
tmpCatalogManifestFilePath := filepath.Join("/tmp", s.getMetaFilename(manifest.Name))
manifest.CleanupRequest.AddLocalFileCleanupOperation(tmpCatalogManifestFilePath, false)
catalogManifest, err = s.readManifestFromFile(tmpCatalogManifestFilePath)

if err != nil {
ctx.LogErrorf("Error reading manifest from file %v: %v", tmpCatalogManifestFilePath, err)
manifest.AddError(err)
break
}

manifest.CreatedAt = catalogManifest.CreatedAt
manifest.RequiredRoles = catalogManifest.RequiredRoles
manifest.RequiredClaims = catalogManifest.RequiredClaims
}
}

Expand Down Expand Up @@ -265,6 +262,10 @@ func (s *CatalogManifestService) Push(ctx basecontext.ApiContext, r *models.Push
manifest.AddError(err)
break
}

manifest.ID = response.ID
manifest.Name = response.Name
manifest.CatalogId = response.CatalogId
} else {
ctx.LogInfof("Manifest pushed successfully, adding it to the database")
db := serviceprovider.Get().JsonDatabase
Expand Down
30 changes: 30 additions & 0 deletions src/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ import (
log "github.com/cjlapao/common-go-logger"
"github.com/cjlapao/common-go/helper"
"github.com/cjlapao/common-go/security"
"github.com/cjlapao/common-go/version"
)

var VersionSvc = version.Get()

var globalConfig *Config

var extensions = []string{
Expand Down Expand Up @@ -371,6 +374,33 @@ func (c *Config) Mode() string {
return c.mode
}

func (c *Config) SystemReservedCpu() int {
val := c.GetIntKey(constants.SYSTEM_RESERVED_CPU_ENV_VAR)
if val > 0 {
return val
}

return constants.DEFAULT_SYSTEM_RESERVED_CPU
}

func (c *Config) SystemReservedMemory() int {
val := c.GetIntKey(constants.SYSTEM_RESERVED_MEMORY_ENV_VAR)
if val > 0 {
return val
}

return constants.DEFAULT_SYSTEM_RESERVED_MEMORY
}

func (c *Config) SystemReservedDisk() int {
val := c.GetIntKey(constants.SYSTEM_RESERVED_DISK_ENV_VAR)
if val > 0 {
return val
}

return constants.DEFAULT_SYSTEM_RESERVED_DISK
}

func (c *Config) OrchestratorPullFrequency() int {
frequency := c.GetKey(constants.ORCHESTRATOR_PULL_FREQUENCY_SECONDS_ENV_VAR)
if frequency == "" {
Expand Down
6 changes: 6 additions & 0 deletions src/constants/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const (
DEFAULT_ORCHESTRATOR_PULL_FREQUENCY_SEC = 30
SOURCE_ENV_VAR = "DEVOPS_SOURCE"
LOCAL_ORCHESTRATOR_DESCRIPTION = "Local Orchestrator"
DEFAULT_SYSTEM_RESERVED_CPU = 1
DEFAULT_SYSTEM_RESERVED_MEMORY = 2048
DEFAULT_SYSTEM_RESERVED_DISK = 20000

API_MODE = "api"
CLI_MODE = "cli"
Expand Down Expand Up @@ -72,6 +75,9 @@ const (
VIRTUAL_MACHINES_FOLDER_ENV_VAR = "VIRTUAL_MACHINES_FOLDER"
EXECUTE_COMMAND_TIMEOUT_ENV_VAR = "EXECUTE_COMMAND_TIMEOUT"
PARALLELS_DESKTOP_REFRESH_INTERVAL_ENV_VAR = "PARALLELS_DESKTOP_REFRESH_INTERVAL"
SYSTEM_RESERVED_CPU_ENV_VAR = "SYSTEM_RESERVED_CPU"
SYSTEM_RESERVED_MEMORY_ENV_VAR = "SYSTEM_RESERVED_MEMORY"
SYSTEM_RESERVED_DISK_ENV_VAR = "SYSTEM_RESERVED_DISK"
)

const (
Expand Down
Loading

0 comments on commit 6a3d98a

Please sign in to comment.