Installing the Framework (Problem cURL error 6: Could not resolve host: cache-proxy) - api-platform.com

I tried to install api-platform: https://api-platform.com/docs/distribution/
after starting I see in the log "api-platform-242_cache-proxy_1"
│ Error: │
│ Message from VCC-compiler: │
│ Expected return action name. │
│ ('/usr/local/etc/varnish/default.vcl' Line 67 Pos 13) │
│ return (miss); │
│ ------------####-- │
│ Running VCC-compiler failed, exited with 2 │
│ VCL compilation failed
If I use the api (post greeting), the response code is 500
"hydra:description": "cURL error 6: Could not resolve host: cache-proxy (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)",
"trace": [
Nevertheless the entity is still inserted.
Furthermore I tried the api-platform without docker (Apache).
I removed the line VARNISH_URL=http://cache-proxy in the .env file.
Then the return code is 500 with
"cURL error 3: malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"
Do you have any idea?
Kind regards
Ludi

Remove varnish from api_platform.yaml

I believe you should remove or comment out VARNISH_URL=http://cache-proxy from .env file not from api_platform.yaml as your .env can change and is/should be host dependent and configuration (.yaml) should not.
See: https://symfony.com/doc/current/configuration.html#the-env-file-environment-variables
There is also a .env file which is loaded and its contents become environment variables. This is useful during development, or if setting environment variables is difficult for your deployment.
In api_platform.yaml you SHOULD comment out whole http_cache section or you will keep getting cURL errors about malformed from guzzle.
{
"#context": "/api-platform/api/public/contexts/Error",
"#type": "hydra:Error",
"hydra:title": "An error occurred",
"hydra:description": "cURL error 3: <url> malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)",
"trace": [
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "...\\api-platform\\api\\vendor\\guzzlehttp\\guzzle\\src\\Handler\\CurlFactory.php",
"line": 186,
"args": []
},
Effect is the same.

I had the same problem, and I resolved it!
As specified here: https://github.com/api-platform/api-platform/issues/777, the problem is the directories/files rights, so instead of downloading the zip or tar.gz archive, I cloned the repo,
All commands I made (after installing Docker for Windows and enabling Shared Drives in Docker for Windows settings):
cd my_parent_directory
git clone https://github.com/api-platform/api-platform.git
cd api-platform
docker-compose pull
docker-compose up -d
And when I go on https://localhost:8443 all work!!
I hope this helps you :)

Related

Spring + Vault Secret Engine Database Connection

I've stumbled across a problem with Spring and Vault Secret Engine. I do have a set database connection, for which the lease can be generated succesfully via vault cli (vault read database/creds/my-role)
Now, I do have a spring service deployed via Terraform and a vault policy document:
data "vault_policy_document" "this" {
rule {
path = "/database/creds/my-role"
capabilities = ["read"]
description = "Allow service to write and read into/from it's vault database path"
}
}
The service logs:
{"type":"application","service":"identcheck-service","timestamp":"2022-02-17 11:54:29,822","level":"WARN","message":"[RequestedSecret [path='database/creds/my-role', mode=RENEW]] Lease │
│ [leaseId='database/creds/my-role/ej2iuCzhcO8gToGjX3mFeOgg', leaseDuration=PT5M, renewable=true] Status 403 Forbidden: 1 error occurred:\n\t* permission denied\n\n; nested exception is o │
│ rg.springframework.web.client.HttpClientErrorException$Forbidden: 403 Forbidden: \"{\"errors\":[\"1 error occurred:\\n\\t* permission denied\\n\\n\"]}<EOL>\"","thread":"main","process_id":"8","logger":"org.s │
│ pringframework.vault.core.lease.SecretLeaseEventPublisher$LoggingErrorListener","class":"org.springframework.boot.logging.DeferredLog","method":"logTo"}
If, however, I change the path to "*" and grant all capabilities it works just fine.I'd really like to reduce the capabilities for the service to the specific db path.
Any ideas what could cause this?
Thanks in advance

pm2 stop id command is not working in jenkins pipeline

When try to run pm2 stop command by id is not working in jenkins pipeline(shell script)
pm2 stop 8
When i have run the same command directly in machine its working fine. Try to run in jenkins pipeline its not working, facing error. Could you suggest solution for this. Id details is fine and also i have tried with app name thats also not working
pm2 stop Testing Webhook
Error details:
> Building on master in workspace
> /Jenkins/workspace/Test-Job [Test-Job] $ /bin/sh
> -xe /tmp/jenkins206901532071257719.sh
> + cd /usr/lib/Webhook
> + pm2 stop 8 [PM2] Spawning PM2 daemon with pm2_home=/var/lib/jenkins/.pm2 [PM2] PM2 Successfully daemonized [PM2]
> Applying action stopProcessId on app [8](ids: 8) [PM2][ERROR] Process
> 8 not found
> ┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────────┐
> │ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │
> watching │
> └──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────────┘
> Use `pm2 show <id|name>` to get more details about an app Build step
> 'Execute shell' marked build as failure [BFA] Scanning build for known
> causes...
>
> [BFA] No failure causes found [BFA] Done. 0s Finished: FAILURE

Specified query type "Query" not found in document when deploying to heroku

I am trying to deploy a typescript-graphql-postgres server onto heroku. The build was successful, however, when run I get the following from heroku logs:
UnhandledPromiseRejectionWarning: Error: Specified query type "Query"
not found in document. 2018-11-08T08:54:52.660051+00:00 app[web.1]: at
/app/node_modules/graphql/utilities/buildASTSchema.js:184:15
Anyone encountered and know the fix?
btw, when I run on my computer, the code works
Resolved. I need to copy graphql files into the relevant modules folders
below is what I added to my package.json for those who run into the same issue
"build": "rimraf dist && tsc && copyfiles -u 1 src/**/*.graphql dist",

chef-client local mode not able to create action on template resource on windows machine

I am executing the chef cookbook recipe in local mode, I have placed the template .erb file under cookbooks templates folder.
It giving error and Chef::Exceptions::CookbookNotFound
attaching execution log
PS C:\chef-repo> chef-client -z -r "recipe[my_cookbook::test1]"
Starting Chef Client, version 12.18.31
resolving cookbooks for run list: ["my_cookbook::test1"]
Synchronizing Cookbooks:
- test (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 1 resources
Recipe: test::test1
* template[c:\test-template.txt] action create
================================================================================
Error executing action `create` on resource 'template[c:\test-template.txt]'
================================================================================
Chef::Exceptions::CookbookNotFound
----------------------------------
Cookbook test not found. If you're loading test from another cookbook, make sure you configure the dependency in you
r metadata
Resource Declaration:
---------------------
# In c:/chef-repo/.chef/local-mode-cache/cache/cookbooks/test/recipes/test1.rb
1: template "c:\\test-template.txt" do
2: source "test-template.txt.erb"
3: mode '0755'
4: variables({
5: test: node['cloud']['public_ipv4']
6: })
7: end
Compiled Resource:
------------------
# Declared in c:/chef-repo/.chef/local-mode-cache/cache/cookbooks/test/recipes/test1.rb:1:in `from_file'
template("c:\test-template.txt") do
action [:create]
retries 0
retry_delay 2
default_guard_interpreter :default
source "test-template.txt.erb"
variables {:test=>"1.1.1.1"}
declared_type :template
cookbook_name "test"
recipe_name "test1"
mode "0755"
path "c:\\test-template.txt"
end
Platform:
---------
x64-mingw32
Running handlers:
[2017-03-08T12:32:35+00:00] ERROR: Running exception handlers
Running handlers complete
[2017-03-08T12:32:35+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 05 seconds
[2017-03-08T12:32:35+00:00] FATAL: Stacktrace dumped to c:/chef-repo/.chef/local-mode-cache/cache/chef-stacktrace.out
[2017-03-08T12:32:35+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2017-03-08T12:32:35+00:00] FATAL: Chef::Exceptions::CookbookNotFound: template[c:\test-template.txt] (test::test1 line
1) had an error: Chef::Exceptions::CookbookNotFound: Cookbook test not found. If you're loading test from another cookbo
ok, make sure you configure the dependency in your metadata
test1.rb
template "c:\\test-template.txt" do
source "test-template.txt.erb"
mode '0755'
variables({
test: node['cloud']['public_ipv4']
})
end
My chef-repo tree :
C:.
├───.chef
│ └───local-mode-cache
│ └───cache
│ └───cookbooks
│ └───test
│ ├───attributes
│ ├───recipes
│ └───templates
| |___test-template.txt.erb
├───cookbooks
│ └───my_cookbook
│ ├───attributes
│ ├───definitions
│ ├───files
│ │ └───default
│ ├───libraries
│ ├───providers
│ ├───recipes
│ ├───resources
│ └───templates
│ └───default
| |___test-template.txt.erb
├───data_bags
│ └───example
├───environments
├───nodes
└───roles
Just a guess but here's what I think is wrong:
The template resource looks for a source file in c:/chef-repo/.chef/local-mode-cache/cache/cookbooks/test/templates/test-template.txt.erb.
With those log line:
resolving cookbooks for run list: ["my_cookbook::test1"]
...
Converging 1 resources
Recipe: test::test1
This makes me think taht either:
Your actual cookbook template is at "c:/chef-repo/.chef/local-mode-cache/cache/cookbooks/my_cookbook/templates/test-template.txt.erb" and your metadata.rb use the wrong name attribute.
You have a typo somewhere in the template name or location while playing with a wrapper cookbook.

mup setup/deploy - ECONNREFUSED on 127.0.0.1

I'm trying to mup deploy the todos example of Meteor to a Vagrant VM running Ubuntu 14.04 LTS x64.
Meteor Up supports Windows (I'm on Windows 7):
You can use install and use Meteor Up from Linux, Mac and Windows.
This is my c:\code\todos\mup.json:
{
"servers": [
{
"host": "127.0.0.1",
"port": 2222,
"username": "vagrant",
"password": "vagrant"
}
],
"setupMongo": true,
"setupNode": true,
"nodeVersion": "0.12.4",
"setupPhantom": true,
"enableUploadProgressBar": false,
"appName": "todos-app",
"app": "/code/todos",
"env": {
"ROOT_URL": "http://127.0.0.1",
"PORT": "3001", // The port you want to bind to on your server.
"UPSTART_UID": "vagrant" // The user you want to run meteor as.
},
"deployCheckWaitTime": 30
}
My Vagrant VM is up and PuTTYTray is connected via vagrant:vagrant#127.0.0.7:2222. Yet mup deploy fails:
C:\code\todos>mup deploy
Meteor Up: Production Quality Meteor Deployments
------------------------------------------------
" Checkout Kadira!
It's the best way to monitor performance of your app.
Visit: https://kadira.io/mup "
Building Started: /code/todos
? Can't build for mobile on Windows. Skipping the following platforms:
android, ios
Started TaskList: Deploy app 'todos-app' (linux)
[127.0.0.1] - Uploading bundle
events.js:85
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED
at exports._errnoException (util.js:746:11)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
Same for mup setup. And in the VM mup deploy encounters a "weird error".
Should I downgrade mup?
Downgrading mup doesn't help:
C:\code\todos>npm install -g mup#0.9.7
C:\Users\Cees.Timmerman\AppData\Roaming\npm\mup -> C:\Users\Cees.Timmerman\AppData\Roaming\npm\node_modules\mup\bin\mup
mup#0.9.7 C:\Users\Cees.Timmerman\AppData\Roaming\npm\node_modules\mup
├── colors#0.6.2
├── underscore#1.7.0
├── uuid#1.4.2
├── async#0.9.2
├── rimraf#2.4.0 (glob#4.5.3)
├── cjson#0.3.1 (jsonlint#1.6.0)
└── nodemiral#0.3.11 (debug#0.7.4, ejs#0.8.8, handlebars#1.0.12)
C:\code\todos>mup -v
Meteor Up: Production Quality Meteor Deployments
------------------------------------------------
sshpass required for password based authentication: refer http://git.io/_vHbvQ
C:\code\todos>mup deploy
Meteor Up: Production Quality Meteor Deployments
------------------------------------------------
sshpass required for password based authentication: refer http://git.io/_vHbvQ
SSHPass doesn't work on Windows.
Manually setting up my Meteor app worked with help from this answer.

Resources