I am trying to upload a media on twitter with below command from my rails console .
ActiveSupport::JSON.decode(twurl -H upload.twitter.com
"/1.1/media/upload.json" -d
"command=APPEND&media_id=1037245714940747777&segment_index=0" --file
/home/administrator/Downloads/s.mp4 --file-field "media" -t) and
Getting the error-: JSON::ParserError: 822: unexpected token at ''
I am getting error of JSON parsning, Please help me to solve this problem.
That's command is not for Rails console, it's for bash shell command line, you can just paste it to the Rails console and run. You can run it from bash shell:
$> twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=APPEND&media_id=1037245714940747777&segment_index=0" --file /home/administrator/Downloads/s.mp4 --file-field "media" -t
Related
I'm trying to release a web process into a container by using only the API and not the Heroku CLI.
I know that i can do something like heroku container:release web -a <<myApp>>, but use the Heroku CLI is not an option since i'm trying to create a GH Action to do it.
After pushing correctly the image in the heroku registry, i tried to release the container doing as stated from the Heroku docs in the following way:
curl -X PATCH https://api.heroku.com/apps/$APP/formation \
-d '{
"updates": [
{
"type": "web",
"docker_image": "$(docker inspect $IMAGE --format={{.Id}})"
}
]
}' \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.heroku+json; version=3.docker-releases" \
-H "Authorization: Bearer $HEROKU_API_KEY"
However it keeps giving me the same message:
{
"resource": "docker_image",
"id": "not_found",
"message": "Couldn't find that docker image."
}
What am i doing wrong?
NOTES:
In my GH Action i already tried doing heroku login -i and passing username and access token, but it keeps giving me Password: invalid option -s.
Even if i copy the HEROKU_API_KEY environment variable, doing docker push ... fails.
Copying a valid .netrc file fails too with the same error of using the HEROKU_API_KEY.
If someone gets stuck like me in this i'm posting another solution here.
Create the most simple heroku.yml in your repository.
Put the following content inside it:
build:
docker:
web: Dockerfile
For me, there's no need for run section, since the CMD into the Dockerfile is already what i need to get executed.
In this way, heroku platform understand that must build the image and runs the container after the build process has completed
I'm trying to use SOPS to decrypt a file using Jenkins, using this command:
sops -k -d mysecret.yaml > out
But then I get this output and it waits till forever:
Vim: Warning: Output is not to a terminal
I've tried to export some env. vars, but I ended up with the same result
export TERM=xterm-256color
export EDITOR="/usr/bin/vim"
Can anyone please explain to me why that happens?
Update:
By using sops -k -d mysecret.yaml --output OUT with the above env. vars and now I can see file being decrypted but still vim process is not finish and the task stays forever.
I shouldn't use -k as a command argument after removing KMS ARN and replacing it with export SOPS_KMS_ARN="arn:aws:kms:us-east-1:xxxxxx:key/xxx-xxxx-xxxxx"
Correct command is:
export SOPS_KMS_ARN="arn:aws:kms:us-east-1:xxxxxx:key/xxx-xxxx-xxxxx
sops -d rsi-tls-cert.yaml | kubectl apply -f -
I started the Airflow with Postgres as the backend database. The web-servers is started successfully, but when I trying to create the user using the create_user command and full CLI as follow
airflow create_user -r Admin -u admin -e admin#acme.com -f admin -l user -p Password
This CLI is giving an error and it looks like airflow is still looking for SQLite. Full logs as follow
ravi#ravi:~/Desktop/test$ docker exec -it airflow_airflow_webserver_1 sh
$ airflow create_user -r Admin -u admin -e admin#acme.com -f admin -l user -p Pass#123
/home/airflow/.local/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py:813: UserWarning: Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. Defaulting SQLALCHEMY_DATABASE_URI to "sqlite:///:memory:".
'Neither SQLALCHEMY_DATABASE_URI nor SQLALCHEMY_BINDS is set. '
[2020-12-08 11:19:30,734] {manager.py:96} ERROR - DB Creation and initialization failed: Invalid argument(s) 'pool_size','max_overflow' sent to create_engine(), using configuration SQLiteDialect_pysqlite/StaticPool/Engine. Please check that the keyword arguments are appropriate for this combination of components.
The bug is fixed by setting the following in airflow.cfg ref
[webserver]
rbac = True
I have created a declarative jenkins pipeline and one of it's stages is as follows:
stage('Docker Image'){
steps{
bat 'docker build -t HMT/demo-application:%BUILD_NUMBER% --no-cache -f Dockerfile .'
}
}
This is the docker file:
FROM tomcat:alpine
RUN wget -O /usr/local/tomcat/webapps/launchstation04.war http://localhost:8082/artifactory/demoArtifactory/com/demo/0.0.1-SNAPSHOT/demo-0.0.1-SNAPSHOT.war
EXPOSE 9100
CMD /usr/local/tomcat/bin/cataline.bat run
I am getting the below error.:
[91m/bin/sh:
01:33:28 [0mThe command '/bin/sh -c wget -O /usr/local/tomcat/webapps/launchstation04.war http://localhost:8082/artifactory/demoArtifactory/com/demo/0.0.1-SNAPSHOT/demo-0.0.1-SNAPSHOT.war' returned a non-zero code: 127
UPDATE:
I have updated the command to
RUN wget -O /usr/local/tomcat/webapps/launchstation04.war -U jenkinsuser:Learning#% http://localhost:8082/artifactory/demoArtifactory/com/demo/0.0.1-SNAPSHOT/demo-0.0.1-20200823.053346-18.war
There is no problem in my command.Jfrog artifactory was unable to authorize this action.So I added username and password details but it still didn't work.
Error:
wget: server returned error: HTTP/1.1 401 Unauthorized
It didnt work after modifiying the password policy to unsupported.But it worked when I allowed anonymous access.
How to provide access using credentials.
Need more clarification on your question. Not sure where you are using curl command.
Image tomcat:alpine doesn't contains curl command. Unless you install it manually.
bash-4.4# type curl
bash: type: curl: not found
bash-4.4#
If your ask is regarding the sh -c option, if the script is invoked through CMD option, yes it will use sh. Instead you can give a try with ENTRYPOINT.
You can provide username & password via command line:
wget --user user --password pass
Using curl :
curl -u username:password -O
But void using special characters:
Change your password to another once in: [a-z][A-Z][0-9]
Try an API Key instead of password, I have a feeling that "#" may be throwing you off. Quotes can help there too or separating the password with -p
Also look at the request logs for whether the entry comes as 401 for the user, or anonymous/unauthenticated
Lastly, see if you can cURL from outside the image and then ADD the file in, as that will remove any external factors that may vary from the host (where I assume the command works)
Trying to deploy the go-example app from the documentation :
http://docs.deis.io/en/latest/using_deis/using-docker-images/#using-docker-images
I am skipping the "Prepare the application" bit and trying to deploy the example docker app gabrtv/example-go
I run the following to do the deployment :
deis pull gabrtv/example-go:latest
Does not work I get the following :
"GET Image Error (404: {\"error\": \"Tag not found\"})"
Looking at
https://registry.hub.docker.com/u/gabrtv/example-go/tags/manage/
The latest tag is there.
Pulling it with
docker pull gabrtv/example-go
it get's pulled correctly. So I am not really sure what I am doing wrong.
Using the controller API with curl gives me the same result :
curl -i -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d '{"image":"gabrtv/example-go"}' \
http://$IP:$PORT/v1/apps/dummyapp2/builds/
Anyone have any idea?
Are you also skipping the section 'Create an Application'? In Deis an application is a group of container being load balanced to by the routing layer. In the example they have you create a folder named 'example-go', cd into it, and then run 'deis create'. This defaults to the current folders name for the application name. Instead you can run:
deis create example-go
Then you can run the deis pull command with the '-a' flag telling it which application to to associate the container with.
deis pull gabrtv/example-go:latest -a example-go