My pulumi stack was created with an older plugin version that I can't install on M1 mac - pulumi

I have a Pulumi project which I haven't touched (deployed etc) for a while.
Now I need to make some changes but I get the "403 HTTP error fetching plugin" described here
The description in the docs makes sense: I have bought a new Apple M1 laptop since last time I worked on it, my stack was built with the digitalocean provider v3.1.1 but I can't install that version on my new laptop.
The docs say that if you have access to an Intel system, set up your project there, update the providers and run pulumi up. The implication is that you can install both old and latest versions of the provider plugin, pulumi up will update the stack using the latest version. After that I should be able to manage the stack from my new laptop using the latest provider version.
I asked on Pulumi Slack about this and confirmed the above.
But it doesn't seem to work for me.
First I started a Docker container with --platform=linux/amd64 to emulate Intel. Inside that I checked out my project, installed pulumi and the old and new provider versions.
In my docker container pulumi plugin ls shows:
NAME KIND VERSION SIZE INSTALLED LAST USED
cloudflare resource 4.7.0 38 MB n/a 1 day ago
cloudflare resource 2.8.0 46 MB n/a 1 day ago
digitalocean resource 4.14.0 42 MB n/a 1 day ago
digitalocean resource 3.1.1 45 MB n/a 1 day ago
From there I successfully ran pulumi up.
However if I go back to my local shell and try pulumi preview I get:
error: could not load plugin for digitalocean provider 'urn:pulumi:staging::myproject::pulumi:providers:digitalocean::default': no resource plugin 'pulumi-resource-digitalocean' found in the workspace at version v3.1.1 or on your $PATH, install the plugin using pulumi plugin install resource digitalocean v3.1.1
So despite updating the stack Pulumi is still trying to use the old provider version that I can't install.
How do I get around this?

You also need to update your pulumi program's dependencies.
Simply installing the new plugin isn't enough.
If you do pulumi stack export you'll see a JSON file with all your resources. Those resources have a provider attached to them with a specific version of the plugin. As an example:
{
"version": 3,
"deployment": {
"manifest": {
"time": "2022-06-23T12:03:30.071863-07:00",
"magic": "eccb7d9cc1cab43d7465783c52b0648063d5e7228dd3bb2fc7600583a8bca5d5",
"version": "v3.34.1"
},
"secrets_providers": {
"type": "service",
"state": {
"url": "https://api.pulumi.com",
"owner": "jaxxstorm",
"project": "s3_event_bridge",
"stack": "dev"
}
},
"resources": [
{
"urn": "urn:pulumi:dev::s3_event_bridge::pulumi:pulumi:Stack::s3_event_bridge-dev",
"custom": false,
"type": "pulumi:pulumi:Stack",
"outputs": {
"bucketName": "test001-c86ab36"
},
"sequenceNumber": 1
},
{
"urn": "urn:pulumi:dev::s3_event_bridge::pulumi:providers:aws::default_5_9_1",
"custom": true,
"id": "484b75ed-d5cd-4ee1-96d1-b3f641236ab6",
"type": "pulumi:providers:aws",
"inputs": {
"region": "us-west-2",
"version": "5.9.1"
},
"outputs": {
"region": "us-west-2",
"version": "5.9.1"
},
"sequenceNumber": 1
},
{
"urn": "urn:pulumi:dev::s3_event_bridge::aws:s3/bucket:Bucket::test001",
"custom": true,
"id": "test001-c86ab36",
"type": "aws:s3/bucket:Bucket",
"inputs": {
"__defaults": [
"bucket",
"forceDestroy"
],
"acl": "private",
"bucket": "test001-c86ab36",
"forceDestroy": false,
"tags": {
"Environment": "Dev",
"Name": "My bucket",
"__defaults": []
}
},
"outputs": {
"accelerationStatus": "",
"acl": "private",
"arn": "arn:aws:s3:::test001-c86ab36",
"bucket": "test001-c86ab36",
"bucketDomainName": "test001-c86ab36.s3.amazonaws.com",
"bucketRegionalDomainName": "test001-c86ab36.s3.us-west-2.amazonaws.com",
"corsRules": [],
"forceDestroy": false,
"grants": [],
"hostedZoneId": "Z3BJ6K6RIION7M",
"id": "test001-c86ab36",
"lifecycleRules": [],
"loggings": [],
"objectLockConfiguration": null,
"region": "us-west-2",
"replicationConfiguration": null,
"requestPayer": "BucketOwner",
"serverSideEncryptionConfiguration": null,
"tags": {
"Environment": "Dev",
"Name": "My bucket"
},
"tagsAll": {
"Environment": "Dev",
"Name": "My bucket"
},
"versioning": {
"enabled": false,
"mfaDelete": false
},
"website": null
},
"parent": "urn:pulumi:dev::s3_event_bridge::pulumi:pulumi:Stack::s3_event_bridge-dev",
"provider": "urn:pulumi:dev::s3_event_bridge::pulumi:providers:aws::default_5_9_1::484b75ed-d5cd-4ee1-96d1-b3f641236ab6",
"propertyDependencies": {
"acl": null,
"tags": null
},
"sequenceNumber": 1
},
{
"urn": "urn:pulumi:dev::s3_event_bridge::aws:s3/bucketNotification:BucketNotification::bucketNotification",
"custom": true,
"id": "test001-c86ab36",
"type": "aws:s3/bucketNotification:BucketNotification",
"inputs": {
"__defaults": [],
"bucket": "test001-c86ab36",
"eventbridge": false
},
"outputs": {
"bucket": "test001-c86ab36",
"eventbridge": false,
"id": "test001-c86ab36",
"lambdaFunctions": [],
"queues": [],
"topics": []
},
"parent": "urn:pulumi:dev::s3_event_bridge::pulumi:pulumi:Stack::s3_event_bridge-dev",
"dependencies": [
"urn:pulumi:dev::s3_event_bridge::aws:s3/bucket:Bucket::test001"
],
"provider": "urn:pulumi:dev::s3_event_bridge::pulumi:providers:aws::default_5_9_1::484b75ed-d5cd-4ee1-96d1-b3f641236ab6",
"propertyDependencies": {
"bucket": [
"urn:pulumi:dev::s3_event_bridge::aws:s3/bucket:Bucket::test001"
],
"eventbridge": null
},
"sequenceNumber": 1
}
]
}
}
If you look at my BucketNotification resource, you can see a provider field which has a version in it for the AWS provider I've used:
"provider": "urn:pulumi:dev::s3_event_bridge::pulumi:providers:aws::default_5_9_1::484b75ed-d5cd-4ee1-96d1-b3f641236ab6"
Which in this case is 5.9.1
So, in order to fix this problem, you need to update your resources to have a new version of the provider.
To do this, it depends on the language you're using with Pulumi.
If you're using TypeScript or JavaScript, update your #pulumi/digitalocean dependency in your package.json
If you're using Python, update pulumi_digitalocean in your requirements.txt
Make sure you update with your package manager with npm update or pip3 upgrade
The same applies if you're using DotNet, Go and Java.
then you need to run a successful pulumi up. Pulumi will update the provider version associated with each resource as you saw above, you can verify this by again doing a pulumi stack export
From here, you should be able to successfully use your M1 mac without the legacy plugins.

Related

Execute SQL script with Azure ARM template

I'm deploying PostgreSQL server with a database and trying to seed this database with SQL script. I've learned that the best way to execute SQL script from ARM template is to use deployment script resource. Here is part of a template:
{
"type": "Microsoft.DBforPostgreSQL/flexibleServers/databases",
"apiVersion": "2021-06-01",
"name": "[concat(parameters('psqlServerName'), '/', parameters('psqlDatabaseName'))]",
"dependsOn": [
"[resourceId('Microsoft.DBforPostgreSQL/flexibleServers', parameters('psqlServerName'))]"
],
"properties": {
"charset": "[parameters('psqlDatabaseCharset')]",
"collation": "[parameters('psqlDatabaseCollation')]"
},
"resources": [
{
"type": "Microsoft.Resources/deploymentScripts",
"apiVersion": "2020-10-01",
"name": "deploySQL",
"location": "[parameters('location')]",
"kind": "AzureCLI",
"dependsOn": [
"[resourceId('Microsoft.DBforPostgreSQL/flexibleServers/databases', parameters('psqlServerName'), parameters('psqlDatabaseName'))]"
],
"properties": {
"azCliVersion": "2.34.1",
"storageAccountSettings": {
"storageAccountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2019-06-01').keys[0].value]",
"storageAccountName": "[parameters('storageAccountName')]"
},
"cleanupPreference": "Always",
"environmentVariables": [
{
"name": "psqlFqdn",
"value": "[reference(resourceId('Microsoft.DBforPostgreSQL/flexibleServers', parameters('psqlServerName')), '2021-06-01').fullyQualifiedDomainName]"
},
{
"name": "psqlDatabaseName",
"value": "[parameters('psqlDatabaseName')]"
},
{
"name": "psqlAdminLogin",
"value": "[parameters('psqlAdminLogin')]"
},
{
"name": "psqlServerName",
"value": "[parameters('psqlServerName')]"
},
{
"name": "psqlAdminPassword",
"secureValue": "[parameters('psqlAdminPassword')]"
}
],
"retentionInterval": "P1D",
"scriptContent": "az config set extension.use_dynamic_install=yes_without_prompt\r\naz postgres flexible-server execute --name $env:psqlServerName --admin-user $env:psqlAdminLogin --admin-password $env:psqlAdminPassword --database-name $env:psqlDatabaseName --file-path test.sql --debug"
}
}
]
}
Azure does not show any errors regarding the syntax and starts the deployment. However, deploySQL deployment gets stuck and then fails after 1 hour due to agent execution timeout. PostgreSQL server itself, database and firewall rule (not shown in the code above) are deployed without any issues, but SQL script is not executed. I've tried to add --debug option to Azure CLI commands, but got nothing new from pipeline output. I've also tried to execute these commands in Azure CLI pipeline task and they worked perfectly. What am I missing here?

Parse error Unexpected token '�' at 1:1 ��{ on flutter app when running firebase deploy

encounter the below message when trying to firebase deploy from root project
Error: Parse Error in ...\firestore.indexes.json
Unexpected token '�' at 1:1
��{
I have a flutter app, upon which I also have a functions folder. Below is the file position:
AppFolder
functions
.eslintrc.js
index.js
package.json
etc
lib
files relative to flutter app
test
test files relative to flutter app
web firestore.indexes.json
firebase.json
etc
I am running on windows 11 in a newly built pc (so maybe sth is missing?), other devs are running on mac, I have changed the EOF sequence to LF on the 3 files of the functions folder, I have also run these two commands inside the functions folder
npm install firebase-functions#latest firebase-admin#latest --save
npm install -g firebase-tools
npm version is 8.1.2
node version is v16.13.1
firestore.indexes.json is:
{
"indexes": [
{
"collectionGroup": "something1",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "created",
"order": "DESCENDING"
},
{
"fieldPath": "something2",
"order": "DESCENDING"
}
]
},
{
"collectionGroup": "something3",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "something4",
"order": "ASCENDING"
},
{
"fieldPath": "something5",
"order": "DESCENDING"
}
]
}
],
"fieldOverrides": []
}
.elslint.js is
module.exports = {
"root": true,
"env": {
es6: true,
node: true,
},
"extends": [
"eslint:recommended",
"google",
],
"rules": {
quotes: ["error", "double"],
},
"parserOptions": {
"ecmaVersion": 2020,
},
};
and package.json is
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "14"
},
"main": "index.js",
"dependencies": {
"axios": "^0.24.0",
"device-detector-js": "^3.0.0",
"firebase": "^9.2.0",
"firebase-admin": "^10.0.1",
"firebase-functions": "^3.16.0"
},
"devDependencies": {
"eslint": "^8.1.0",
"eslint-config-google": "^0.14.0",
"firebase-functions-test": "^0.3.3"
},
"private": true
}
Please keep in mind that in an older pc running windows 10 and I can deploy by changing only to the LF and running the above commands.
Just try to make a new text file and copy the content of generated file inside the new one. Then override the new file with firestore.indexes.json
Its obvious that the generated json file has some formatting problem.
I recently had this problem and found that it was resolved by changes to the firebase.json file:
Seek "predeploy":
Delete the code so that the outcome is "predeploy": []
After this, run the firebase deploy function again, and everything should be fine.
Thank you to Max for sharing this solution with me : )

Add github repository to my composer project

I like to create a new composer project. I will include code, that is not on packagist. It is a github repository. Concretely I like to include this release.
https://github.com/joomla/joomla-cms/releases/tag/4.0.0-alpha12
I expected with this composer.json to fetch the release 4.0.0-alpha12:
{
"name": "vendor/my_joomla_website",
"description": "Testing to install joomla with extensions via composer",
"type": "project",
"license": "GNU",
"authors": [
{
"name": "vendor",
"email": "myemail"
}
],
"repositories": [
{
"type": "git",
"url": "https://github.com/joomla/joomla-cms.git"
}
],
"require": {
"joomla/joomla-cms": "dev-4.0-dev#4.0.0-alpha12"
}
}
But the command comoser install did not run to the end. This is my message
composer install
Loading composer repositories with package information
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "git clone --mirror 'https://github.com/joomla/joomla-cms.git' '/home/astrid/.composer/cache/vcs/htt
ps---github.com-joomla-joomla-cms.git/'" exceeded the timeout of 300 seconds.
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
In the end I have a vendor directory in my project folder. The content of the github repository is not there.
What do I have to do if I want to add code - hosted on github - to my Composer project?
Update
I just changed my composer.json to
{
"name": "astrid/my_joomla_website",
"description": "Testing to install joomla with extensions via composer",
"type": "project",
"license": "GNU",
"authors": [
{
"name": "vendor",
"email": "myemail"
}
],
"repositories": [
{
"type": "package",
"package": {
"name": "joomla/joomla-cms",
"version": "4.0.0-alpha12",
"source": {
"type": "git",
"url": "git://github.com/joomla/joomla-cms.git",
"reference": "4.0-dev"
},
"dist": {
"url": "https://github.com/joomla/joomla-cms/releases/download/4.0.0-alpha12/Joomla_4.0.0-alpha12-Alpha-Full_Package.zip",
"type": "zip"
}
}
}
],
"require": {
"joomla/joomla-cms": "dev-4.0-dev#4.0.0-alpha12"
}
}
Now I get this error.
composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package joomla/joomla-cms dev-4.0-dev#4.0.0-alpha12 exists as joomla/joomla-cms[4.0.0-alpha12] but these are rejected by your constraint.
What am I doing wrong? I haven't assigned any dependencies or restrictions yet.
I'm not sure what exactly causes your "rejected by your constraint" exception, but I'm guessing it's because you're using the branch#ref version requirement which the docs say isn't actively supported. I think you could rather just use the 4.0.0-alpha12 tag since a tag isn't tied to a branch.
To fix your first issue, change your repository type to vcs (or github). Composer will detect the the repository is a Github repository and will then use the Github API to fetch the correct version of the package. The joomla-cms repository looks really big so it will probably take longer than the allowed 300 seconds to clone.
"repositories": [
{
"type": "vcs",
"url": "https://github.com/joomla/joomla-cms.git"
}
]
For your second issue, set your version to 4.0.0-alpha12:
"require": {
"joomla/joomla-cms": "4.0.0-alpha12"
}
The 4.0.0-alpha12 version of joomla-cms requires a dev version of joomla/application (joomla/application[2.0.x-dev]) so you would have to set your package's minimum stability to dev:
"minimum-stability": "dev",

Azure REST API does not return encryption settings for Virtual Machine

I have a 16.04-LTS Ubuntu Virtual Machine in my Azure account and I am trying Azure Disk Encryption for this virtual machine making use of this azure cli sample script. On running the encryption script, the azure portal shows its OS disk is encrypted. There is Enabled under Encryption header.
However, the Azure REST API (api link) for getting information about the virtual machine does not return the encryptionSettings under properties.storageProfile.osDisk. I tried both Model View and Model View and Instance View for the api-version 2017-03-30 as well as 2017-12-01. Here is the partial response from the API:
{
"name": "ubuntu",
"properties": {
"osProfile": {},
"networkProfile": {},
"storageProfile": {
"imageReference": {
"sku": "16.04-LTS",
"publisher": "Canonical",
"version": "latest",
"offer": "UbuntuServer"
},
"osDisk": {
"name": "ubuntu-OsDisk",
"diskSizeGB": 30,
"managedDisk": {
"storageAccountType": "Premium_LRS",
"id": "..."
},
"caching": "ReadWrite",
"createOption": "FromImage",
"osType": "Linux"
},
"dataDisks": []
},
"diagnosticsProfile": {},
"vmId": "",
"hardwareProfile": {
"vmSize": "Standard_B1s"
},
"provisioningState": "Succeeded"
},
"location": "eastus",
"type": "Microsoft.Compute/virtualMachines",
"id": ""
}
But for my other encrypted windows virtual machine, I get the correct response which contains encryptionSettings in properties.storageProfile.osDisk:
{
"name": "win1",
"properties": {
"osProfile": {},
"networkProfile": {},
"storageProfile": {
"imageReference": {
"sku": "2016-Datacenter-smalldisk",
"publisher": "MicrosoftWindowsServer",
"version": "latest",
"offer": "WindowsServer"
},
"osDisk": {
"name": "win1_OsDisk_1",
"diskSizeGB": 31,
"managedDisk": {
"storageAccountType": "Premium_LRS",
"id": "..."
},
"encryptionSettings": {
"diskEncryptionKey": {
"secretUrl": "...",
"sourceVault": {
"id": "..."
}
},
"keyEncryptionKey": {
"keyUrl": "...",
"sourceVault": {
"id": "..."
}
},
"enabled": true
},
"caching": "ReadWrite",
"createOption": "FromImage",
"osType": "Windows"
},
"dataDisks": []
},
"diagnosticsProfile": {},
"vmId": "...",
"hardwareProfile": {
"vmSize": "Standard_B1s"
},
"provisioningState": "Succeeded"
},
"location": "eastus",
"type": "Microsoft.Compute/virtualMachines",
"id": "..."
}
Why is the Virtual Machine Get API not returning the encryptionSettings for some VMs? Any help would be greatly appreciated.
I create VM using following command.
az vm create \
--resource-group shuivm \
--name shuivm \
--image Canonical:UbuntuServer:16.04-LTS:latest \
--admin-username azureuser \
--generate-ssh-keys
When I use the following API, I could get encryption setting.
https://management.azure.com/subscriptions/**********/resourceGroups/shuivm/providers/Microsoft.Compute/virtualMachines/shuivm?api-version=2017-03-30"
Note: When OS is encrypted successful, I could use API to get encryption setting.
This is because there are two types of at-rest disk encryption for Azure VMs and they are not reported in the same part of the Azure Management API:
Server-Side Encryption: that you can see in the encryptionSettings section of the VM/compute API when you get a vm details. It will show whether you are encypting with a customer managed key or a platform managed key
ADE: Azure Disk Encryption is actually a VM extension and so you can find it in the VM Extension API instead.
see: https://learn.microsoft.com/en-us/rest/api/compute/virtualmachineextensions/list

"Error getting chaincode package bytes" when deploying chaincode on hyperledger via REST

I'm trying to deploy chaincode on hyperledger (Bluemix service) via POST/REST to
/chaincode
QuerySpec
{ "jsonrpc": "2.0", "method": "deploy", "params": { "type": 1,
"chaincodeID": { "path":
"https://github.com/romeokienzler/learn-chaincode/tree/master/finished"
}, "ctorMsg": { "function": "init", "args": [ "hi there" ] },
"secureContext": "user_type1_0" }, "id": 1 }
I've also tried those links
https://github.com/romeokienzler/learn-chaincode/blob/master/finished/chaincode_finished?raw=true
https://raw.githubusercontent.com/romeokienzler/learn-chaincode/master/finished/chaincode_finished.go
I always get
{ "jsonrpc": "2.0", "error": {
"code": -32001,
"message": "Deployment failure",
"data": "Error when deploying chaincode: Error getting chaincode package bytes: Error getting code 'go get' failed with error: 'exit
status 1'\npackage
github.com/romeokienzler/learn-chaincode/tree/master/finished: cannot
find package
'github.com/romeokienzler/learn-chaincode/tree/master/finished' in any
of:\n\t/usr/local/go/src/github.com/romeokienzler/learn-chaincode/tree/master/finished
(from
$GOROOT)\n\t/go/usercode/552962906/src/github.com/romeokienzler/learn-chaincode/tree/master/finished
(from
$GOPATH)\n\t/go/src/github.com/romeokienzler/learn-chaincode/tree/master/finished\n"
}, "id": 1 }
Any idea?
Considering that you are playing with Bluemix service, I assume you are following "Implementing your first chain code tutorial"
If your forked repository you will see instructions to use branch v1.0 for Bluemix Blockchain Services (link) IBM BMX Service is (still) using Fabric v0.5.
Once you have Registered with one of the available Enroll ID you should be able to deploy your chaincode using DeploySpec (note the path: "https://github.com/romeokienzler/learn-chaincode/tree/v1.0/finished")
{
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID": {
"path": "https://github.com/romeokienzler/learn-chaincode/tree/v1.0/finished"
},
"ctorMsg": {
"function": "init",
"args": [
"hi there"
]
},
"secureContext": "user_type1_0"
},
"id": 1
}
First of all deploy command should be changed to ( the value for path variable was changed):
{
"jsonrpc": "2.0",
"method": "deploy",
"params": {
"type": 1,
"chaincodeID": {
"path": "https://github.com/romeokienzler/learn-chaincode/finished"
},
"ctorMsg": {
"function": "init",
"args": ["hi there"]
},
"secureContext": "user_type1_0"
},
"id": 1
}
P.S. As #Mil4n correctly mentioned, IBM Bluemix still works with Fabric v0.5. Chaincode romeokienzler/learn-chaincode/finished should be adopted to this version.
For example shim.ChaincodeStubInterface is not available yet and should be replaced with *shim.ChaincodeStub.