I'm currently trying to set up a GAE push-to-deploy from my bitbucket wordpress repo.
Seems like all the needed steps for setting up jenkins on GCE were done, but build failed with OSError: [Errno 13] Permission denied: '/root/.config'
I think shell command: gcloud --project=projectjp01 preview app deploy . added to the build step caused problem. (looks like jenkins user cannot access root folder or log folder )
Could someone help me out successfully accomplishing this push-to-depoly process for GAE?
Any helps will be appreciated.
FYI, below are the console message for the build process:
Started by user User Name Building in workspace
/opt/bitnami/apps/jenkins/jenkins_home/jobs/firstjenkins/workspace
/opt/bitnami/git/bin/git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository
/opt/bitnami/git/bin/git config remote.origin.url https://source.developers.google.com/p/projectjp01 # timeout=10
Fetching upstream changes from
source.developers.google.com/p/projectname
/opt/bitnami/git/bin/git --version # timeout=10 using .gitcredentials to set credentials
/opt/bitnami/git/bin/git config --local credential.helper store --file=/opt/bitnami/apache-tomcat/temp/git2753293187622835876.credentials
timeout=10
/opt/bitnami/git/bin/git fetch --tags --progress
+refs/heads/:refs/remotes/origin/
/opt/bitnami/git/bin/git config --local --remove-section credential # timeout=10
/opt/bitnami/git/bin/git rev-parse refs/remotes/origin/master^{commit} # timeout=10
/opt/bitnami/git/bin/git rev-parse refs/remotes/origin/origin/master^{commit} > # timeout=10 Checking out
Revision 2297db6db06f19198dd3097e8db6b72687e8d433
(refs/remotes/origin/master)
/opt/bitnami/git/bin/git config core.sparsecheckout # timeout=10
/opt/bitnami/git/bin/git checkout -f 2297db6db06f19198dd3097e8db6b72687e8d433
/opt/bitnami/git/bin/git rev-list 2297db6db06f19198dd3097e8db6b72687e8d433 # timeout=10 [workspace] $
/bin/sh -xe
/opt/bitnami/apache-tomcat/temp/hudson1649832068994489242.sh
+ gcloud --project=projectname preview app deploy . Traceback (most recent call last): File
"/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py",
line 177, in
_cli = CreateCLI() File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py",
line 175, in CreateCLI
return loader.Generate() File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py",
line 236, in Generate
return self.__LoadCLIFromGroups() File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py",
line 280, in __LoadCLIFromGroups
cli = self.__MakeCLI(top_group) File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py",
line 442, in __MakeCLI
log.AddFileLogging(self.__logs_dir) File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/core/log.py",
line 532, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir) File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/core/log.py",
line 316, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir) File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/core/log.py",
line 393, in _SetupLogsDir
os.makedirs(day_dir_path) File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode) File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode) File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode) File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode) OSError: [Errno 13] Permission denied: '/root/.config' Build step 'Execute shell' marked build as failure
Finished: FAILURE
I found out myself. All the problem comes from permission setting.
gcloud should be run as sudo but the tomcat (jenkins) configured to disable the sudo by default.
So I ssh to the GCE server where jenkins are running, open(create) file with:
sudo vi /etc/sudoers.d/tomcat
and then put this line:
tomcat ALL=(ALL) NOPASSWD: ALL
that's it. I can build & deploy without problem now.
Related
I followed the guide in laravel document.Run the command
composer require laravel/sail --dev and command php artisan sail:install in my terimal.After that I tried the command ./vendor/bin/sail up, but I got this : No such file or directory.I turn to termial and open an Ubuntu tab to run this command.But I got this
Building laravel.test
[+] Building 27.0s (4/4) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 38B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> ERROR [internal] load metadata for docker.io/library/ubuntu:21.04 26.9s
=> [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
------
> [internal] load metadata for docker.io/library/ubuntu:21.04:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: failed to authorize: rpc error: code = Unknown desc = failed to fetch oauth token: Get "https://auth.docker.io/token?scope=repository%3Alibrary%2Fubuntu%3Apull&service=registry.docker.io": net/http: TLS handshake timeout
ERROR: Service 'laravel.test' failed to build : Build failed
I tried docker login ...failed.
I tried delete the vendor directory and then run command composer update to update my sail file... failed.
Please help me.Great thanks!
I encountered similar problems when I was setting up laravel sail project and here is my solution.
If you get No such file or directory, please confirm that you have Laravel Sail installed successfully and the files are there under vendor/bin/sail
Then, you should check that the DNS is configured correctly. Try ping google.com and see if there's any response. If not, it is probably why you're encountering this problem and there's some work for you. However, we just need to configure the DNS and it is pretty simple.
Create a file sudo vim /etc/wsl.conf
Add the following line
[network]
generateResolvConf=false
Save and exit :wq
sudo vim /etc/resolv.conf
Your file may probably look like this
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.28.32.1
Just replace the nameserver to 8.8.8.8
nameserver 8.8.8.8
Finally go to your project directory and try ./vendor/bin/sail up again
For some reason grumphp not working for me as expected.
First of all my project directory structure is:
.git/
devops/
app/
src/
confing/
bin/
vendor/
grumphp.yml
phpcs.xml
...
so I in the git repo I have some docker related files in the devops folder, and symfony app int the app folder, also in app folder I have grumphp and all linters configs.
I want to run grumphp from inside of the docker container when I commit some changes to check if my code is correct.
Here is my grumphp.yml
grumphp:
environment:
variables:
GRUMPHP_PROJECT_DIR: "."
GRUMPHP_GIT_WORKING_DIR: "../"
GRUMPHP_BIN_DIR: "vendor/bin/"
GRUMPHP_GIT_REPOSITORY_DIR: "../.git/"
git_hook_variables:
EXEC_GRUMPHP_COMMAND: docker exec php-fpm
stop_on_failure: false
ignore_unstaged_changes: false
hide_circumvention_tip: false
process_timeout: 6
tasks:
composer: ~
phpcs:
standard: phpcs.xml
ignore_patterns: [./var/*, ./public/*, ./config/*, ./bin/*]
phpcsfixer2:
config: .php_cs
phpstan:
autoload_file: ./bin/.phpunit/phpunit-9.0.1-0/vendor/autoload.php
memory_limit: "-1"
git_commit_message:
allow_empty_message: false
enforce_capitalized_subject: false
enforce_no_subject_punctuations: false
enforce_no_subject_trailing_period: true
enforce_single_lined_subject: true
type_scope_conventions: []
max_body_width: 0
max_subject_width: 72
matchers:
Must contain JIRA issue number: /^(Merge)|([A-Z_0-9]+-[0-9]+)/
case_insensitive: true
multiline: true
additional_modifiers: ''
yamllint:
whitelist_patterns: [ ]
ignore_patterns:
- /^vendor\/(.*)/
object_support: false
exception_on_invalid_type: false
parse_constant: false
parse_custom_tags: false
testsuites:
pre-commit:
tasks:
- composer
- phpcs
- phpcsfixer2
- phpstan
- yamllint
- git_commit_message
and when I'm running vendor/bin/grumphp git:init from inside of the docker container, pre-commit file generated in the .git/hooks directory, generated pre-commit file content:
#!/bin/sh
#
# Run the hook command.
# Note: this will be replaced by the real command during copy.
#
# Fetch the GIT diff and format it as command input:
DIFF=$(git -c diff.mnemonicprefix=false -c diff.noprefix=false --no-pager diff -r -p -m -M --full-index --no-color --staged | cat)
# Grumphp env vars
export GRUMPHP_GIT_WORKING_DIR="$(git rev-parse --show-toplevel)"
# Run GrumPHP
(cd "app/" && printf "%s\n" "${DIFF}" | docker exec php-fpm 'vendor/phpro/grumphp/bin/grumphp' 'git:pre-commit' '--skip-success-output')
SO what is the issue?
When I run git commit having php files with a broken styles, grumphp telling that all is fine and allowing me to commit this files, but when I run vendor/bin/grumphp run from inside of the container all working fine and I see list of all the issues I need to fix.
So why all linters checks passing on commit when they should not, but when I'm running vendor/bin/grumphp run it's working as expected?
I'm not sure but I think it somehow related to my directory structure, I have .git in the root of repository, but symfony and grumphp.yml in the app directory.
Thanks in advance!
I created a project in jenkins and added the repository url, saved and tried to build and got the following error:
Started by user Ayotunde Salako
Building in workspace /var/lib/jenkins/workspace/project
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://user:pass#bitbucket.org/company/repo.git # timeout=10
Fetching upstream changes from https://user:pass#bitbucket.org/company/repo.git
> git --version # timeout=10
> git fetch --tags --progress https://user:pass#bitbucket.org/company/repo.git +refs/heads/*:refs/remotes/origin/*
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://user#bitbucket.org/companyhttps://user#bitbucket.org/company/repo.gitids/repo.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:797)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1051)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1082)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1278)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:604)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:529)
at hudson.model.Run.execute(Run.java:1720)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:401)
Caused by: hudson.plugins.git.GitException: Command "git fetch --tags --progress https://user#bitbucket.org/company/repo.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
fatal: Authentication failed for 'https://user#bitbucket.org/company/repo.git/'
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImp l.java:1752)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials (CliGitAPIImpl.java:1495)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.jav a:64)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:315)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:795)
... 11 more
ERROR: null
Finished: FAILURE
Please what am I doing wrong? Jenkins was installed on a CentOs server.
We are using Bitbucket to host our Git repositories.
I've configured all my Jenkins jobs with ssh URLs (and not http + user/password).
All my slaves are using the same ssh key and I've declared this key on all my Bitbucket projects.
A useful link to set-up SSH for Bitbucket cloud.
I would recommend to use this method to clone your repositories with Jenkins.
If you prefer using a HTTPS URL, here is a solution:
I hope it will help :)
I hope someone can help me out with this issue I'm facing.
I've made a fully functional project on a local server and would now like to deploy it to Bluemix Cloud Foundry.
I've followed the tutorial: https://console.eu-gb.bluemix.net/docs/starters/upload_app.html
But when I'm trying to push it through terminal with following commands
cf push app_name -b https://github.com/cloudfoundry/php-buildpack.git -s cflinuxfs2
cf push app_name -b https://github.com/cloudfoundry/go-buildpack
cf push app_name -c start_command
cf push app_name -m 512m
But non seems to work, since every single time I get the following error
Staging failed: Buildpack compilation step failed
-----> Composer command failed
FAILED
Error restarting application: BuildpackCompileFailed
It is a PHP app build with PHPStorm on Symfony and Doctrine if that matters.
I am fairly new to all server/setup/deployment configurations as well as command line.
EDIT 1
I figured out this part thanks to this link: https://support.run.pivotal.io/entries/109600943-cf-push-ing-a-symfony-app-fails-with-Composer-command-failed-
It seems that by default the buildpack assumes that you want all of the files you push to be public. Because of this assumption, it takes all of your files and moves them into the doc root of either HTTPD or Nginx.
By creating the file .bp-config/options.json in the root of your project. Then inside options.json add
{
"WEBDIR": "web"
}
This will tell the buildpack that you have a specific directory to use for the doc root, so it will just use that instead of moving everything into the default doc root.
However...
This brings me a new issue and returns the following error
FAILED
Error restarting application: Start unsuccessful
If i enter the recent log the terminal provides me this:
2016-08-25T02:53:40.62+0200 [App/0] OUT Could not open input file: app.php
2016-08-25T02:53:40.62+0200 [App/0] ERR
2016-08-25T02:53:40.69+0200 [DEA/211] ERR Instance (index 0) failed to start accepting connections
2016-08-25T02:53:40.72+0200 [API/9] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"b6c3c871-5484-4f12-9d84-657cf6eacfbf", "instance"=>"c11566bdabe5458d9bfc4965c9c1aa85", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472086420}
2016-08-25T02:53:40.72+0200 [API/3] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"b6c3c871-5484-4f12-9d84-657cf6eacfbf", "instance"=>"c11566bdabe5458d9bfc4965c9c1aa85", "index"=>0, "reason"=>"CRASHED", "exit_status"=>1, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472086420}
2016-08-24T16:41:14.03+0200 [DEA/135] OUT Starting app instance (index 0) with guid abb206b3-b8ea-4269-b248-ec7b35f7098a
2016-08-24T16:41:26.26+0200 [App/0] ERR bash: start_command: command not found
2016-08-24T16:41:26.26+0200 [App/0] OUT
2016-08-24T16:41:26.35+0200 [DEA/135] ERR Instance (index 0) failed to start accepting connections
2016-08-24T16:41:26.38+0200 [API/6] OUT App instance exited with guid abb206b3-b8ea-4269-b248-ec7b35f7098a payload: {"cc_partition"=>"default", "droplet"=>"abb206b3-b8ea-4269-b248-ec7b35f7098a", "version"=>"5ebd6d77-68c4-4901-b9a8-b5cecfa4cddb", "instance"=>"7b5b555ae68645f4a2c09b73c0adbcb3", "index"=>0, "reason"=>"CRASHED", "exit_status"=>127, "exit_description"=>"failed to accept connections within health check timeout", "crash_timestamp"=>1472049686}
EDIT 2 (updated error msg)
Since Monday we can't push our Dreamfactory app to Bluemix, it always fails, error is attached below. The command used to push the app is:
cf push <appname> -s cflinuxfs2
Output:
-----> Downloaded app package (15M)
Cloning into '/tmp/buildpacks/cf-php-build-pack'...
Submodule 'compile-extensions' (https://github.com/cloudfoundry/compile-extensions) registered for path 'compile-extensions'
Cloning into 'compile-extensions'...
Submodule path 'compile-extensions': checked out 'a4b58d8ec6acd35a5b7b6d406e21c590b5686371'
-------> Buildpack version 4.3.0
Installing Nginx
Traceback (most recent call last):
File "/tmp/buildpacks/cf-php-build-pack/scripts/compile.py", line 51, in <module>
.from_build_pack('lib/additional_commands')
File "/tmp/buildpacks/cf-php-build-pack/lib/build_pack_utils/builder.py", line 189, in extensions
process_extension(path, ctx, 'compile', process, args=[self])
File "/tmp/buildpacks/cf-php-build-pack/lib/build_pack_utils/utils.py", line 69, in process_extension
success(getattr(extn, to_call)(*args))
File "/tmp/buildpacks/cf-php-build-pack/lib/nginx/extension.py", line 39, in compile
.package('NGINX')
File "/tmp/buildpacks/cf-php-build-pack/lib/build_pack_utils/builder.py", line 165, in package
self._installer.install_binary(key)
File "/tmp/buildpacks/cf-php-build-pack/lib/build_pack_utils/cloudfoundry.py", line 197, in install_binary
url = self._ctx['%s_DOWNLOAD_URL' % installKey]
File "/tmp/buildpacks/cf-php-build-pack/lib/build_pack_utils/utils.py", line 151, in __getitem__
return self.format(dict.__getitem__(self, key))
File "/tmp/buildpacks/cf-php-build-pack/lib/build_pack_utils/utils.py", line 143, in format
newVal = val.format(**self)
KeyError: u'NGINX_16_LATEST'
Staging failed: Buildpack compilation step failed
FAILED
BuildpackCompileFailed
You can push a php app on bluemix using a custom buildpack.
For new stack cflinuxfs2 I suggest to use "zend-server-php-buildpack-bluemix" that include:
Zend Server 8.5 Enterprise edition
Zend Server 8.5 configuration files
PHP 5.6
Apache web server
usage:
Enter the following command:
cf push your_app_name -m 512M -s cflinuxfs2 -b
https://github.com/zendtech/zend-server-php-buildpack-bluemix.git
Your application is deployed using the Zend Server buildpack
regards.