I've set up a Jenkins instance in Google Compute Engine to build and deploy an App Engine Java project following this page from Google.
I've configured Jenkins to run the following shell command only when the Maven build succeeds: gcloud --project=decent-ellipse-843 preview app deploy target/*-SNAPSHOT/
When I attempt a build, the deployment fails with the following trace:
+ gcloud --project=decent-ellipse-843 preview app deploy target/backend-api-0.0.1-SNAPSHOT/
Traceback (most recent call last):
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 183, in <module>
main()
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 179, in main
_cli.Execute()
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 488, in Execute
post_run_hooks=self.__post_run_hooks)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1016, in Run
result = command_instance.Run(args)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py", line 86, in TryFunc
return func(*args, **kwargs)
File "/usr/local/share/google/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 158, in Run
stage_dir = self.__MakeStagingDir(project, args, deployable)
File "/usr/local/share/google/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 268, in __MakeStagingDir
java_app_update = appcfg_java.JavaAppUpdate(deployable, args)
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 146, in __init__
self.app_engine_web_xml = self._ReadAppEngineWebXml()
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 205, in _ReadAppEngineWebXml
parser=app_engine_web_xml_parser.AppEngineWebXmlParser)
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 217, in _ReadAndParseXml
return parser().ProcessXml(file_handle.read())
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/app_engine_web_xml_parser.py", line 71, in ProcessXml
xml_root = ElementTree.fromstring(xml_str)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML
parser = XMLParser(target=TreeBuilder())
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1466, in __init__
"No module named expat; use SimpleXMLTreeBuilder instead"
ImportError: No module named expat; use SimpleXMLTreeBuilder instead
Build step 'Execute shell' marked build as failure
Finished: FAILURE
The Maven build is successful, and I can deploy the project by issuing the gcloud command manually.
Even when I run the exact same gcloud command from the same directory and under the same user (tomcat), the deployment succeeds without errors.
I have re-installed python and updated the Google Cloud SDK without any results.
The instance is running Python 2.7.3, Jenkins 1.598, JDK 7u76 and Maven 3.2.2.
I hope someone can help me out with this!
I ran into a similar issue running my jobs on the cloud-dev-python slave. The images are missing build tools that you may need in order to build and deploy properly. My solution was to connect to the docker image and install the tools manually the first time around.
# on docker host, connect to java image
CONTAINER_ID=$(docker ps | grep cloud-dev-java | awk '{print $1}');
docker exec -i -t $CONTAINER_ID bash
# on docker image, install crap to build lxml, etc
gcloud -q components update preview app && apt-get update \
&& apt-get install -y build-essential libz-dev libxml2-dev \
libxslt1-dev python-dev python-pip && apt-get autoremove
Give that a whirl and see if it helps. I'm currently stuck with the service account not authenticating even though it is set up properly...
Related
I have been trying to install microsoft SQL server on my lInux machine but it keeps throwing the same error, even after following the instructions given here on this platform.
When I run:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
It throws this error:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 95, in <module>
sp = SoftwareProperties(options=options)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 103, in __init__
self.sourceslist = SourcesList()
File "/usr/lib/python3/dist-packages/aptsources/sourceslist.py", line 276, in __init__
self.refresh()
File "/usr/lib/python3/dist-packages/aptsources/sourceslist.py", line 292, in refresh
self.matcher.match(source)
File "/usr/lib/python3/dist-packages/aptsources/sourceslist.py", line 484, in match
if (re.search(template.match_uri, source.uri) and
File "/usr/lib/python3.9/re.py", line 201, in search
return _compile(pattern, flags).search(string)
File "/usr/lib/python3.9/re.py", line 304, in _compile
p = sre_compile.compile(pattern, flags)
File "/usr/lib/python3.9/sre_compile.py", line 764, in compile
p = sre_parse.parse(p, flags)
File "/usr/lib/python3.9/sre_parse.py", line 948, in parse
p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
File "/usr/lib/python3.9/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.9/sre_parse.py", line 834, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "/usr/lib/python3.9/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.9/sre_parse.py", line 834, in _parse
p = _parse_sub(source, state, sub_verbose, nested + 1)
File "/usr/lib/python3.9/sre_parse.py", line 443, in _parse_sub
itemsappend(_parse(source, state, verbose, nested + 1,
File "/usr/lib/python3.9/sre_parse.py", line 668, in _parse
raise source.error("nothing to repeat",
re.error: nothing to repeat at position 2
and when I run:
sudo apt install mssql-server
It throws the following error:
The following packages have unmet dependencies:
mssql-server : Depends: libssl1.0.0 but it is not installable
E: Unable to correct problems, you have held broken packages.
I am unable to install libssl1.0.0 since its already in its latest version, libssl1.1
What do I do??
The output for cat /etc/debian_version is parrot
And output of cat /etc/os-release is
PRETTY_NAME="Parrot OS 5.0 (Electro Ara)"
NAME="Parrot OS"
VERSION_ID="5.0"
VERSION="5.0 (Electro Ara)"
VERSION_CODENAME=ara
ID=parrot
ID_LIKE=debian
HOME_URL="https://www.parrotsec.org/"
SUPPORT_URL="https://community.parrotsec.org/"
BUG_REPORT_URL="https://community.parrotsec.org/"
ParrotOS is a Linux distribution based on Debian with a focus on security, privacy and development. You might want to check your reasons for installing SQL Server on it, perhaps you might wish to use a different distro.
The following shows how you can install Microsoft SQL Server 2019 on a ParrotOS 5.0 (ara) Docker container...
./docker-compose.yml:
version: "3.8"
services:
parrot:
build: parrot
container_name: parrot
environment:
- "ACCEPT_EULA=Y"
- "SA_PASSWORD=StrongPassw0rd"
ports:
- "1433:1433"
./parrot/Dockerfile:
# REFs:
# 1. Parrot on Docker
# https://parrotsec.org/docs/parrot-on-docker.html
# 2. SQL Server on Linux
# https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-overview
# 3. Quickstart: Install SQL Server and create a database on Ubuntu
# https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu
FROM parrotsec/core:5.0.0
RUN apt-get update
RUN apt-get install --yes wget
RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
RUN wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list > /etc/apt/sources.list.d/mssql-server-2019.list
RUN apt-get update
RUN apt-get install --yes mssql-server
USER mssql
EXPOSE 1433
ENTRYPOINT [ "/opt/mssql/bin/sqlservr" ]
After running docker-compose up --build you can connect to the running container (in this case, from the Docker host computer) to execute SQL queries...
$ sqlcmd -S localhost,1433 -U sa -P StrongPassw0rd
1> SELECT GETDATE()
2> GO
-----------------------
2022-05-28 11:36:37.783
(1 rows affected)
I'm running google cloud sdk in my local environment (windows 10) and deploy the apps to cloud projects. I can run php55 projects but when I try to run php72 project I get below errors.
INFO 2019-10-12 09:22:00,588 devappserver2.py:278] Skipping SDK update check.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 96, in <module>
_run_file(__file__, globals())
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 90, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 600, in <module>
main()
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 588, in main dev_server.start(options)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 301, in start
raise PhpPathError('For php72, --php_executable_path must be specified.')
__main__.PhpPathError: For php72, --php_executable_path must be specified.
In app.yaml:
runtime: php72
It appears you are using dev_appserver.py to run your project locally, but according to the Google App Engine documentation here, you cannot use dev_appserver.py with PHP7.
Specifically it says:
dev_appserver.py is not supported
with the PHP 7.2 and PHP 7.3 runtimes. To test your application and
run it locally, you must download and install PHP 7.2 or PHP 7.3 and
set up a web server.
For example, start the HTTP server by running the following command:
php -S localhost:8080
Then, view your application in your web browser
at http://localhost:8080.
Traceback (most recent call last):
File "./odoo-bin", line 5, in
import odoo
File "/opt/odoo/odoo/odoo/init.py", line 73, in
import babel
ModuleNotFoundError: No module named 'babel'
In Odoo should install first all requirements
Navigate to your project folder then try to run this command in terminal
pip install -r requirements.txt
If get any error while this command execution, resolve that errors then only Odoo server work.
If you use multi version of python
Check version:
python --version
e.g For me: Python 3.7.7
py -3.7 -m pip install -r requirements.txt
I have installed PHP App Engine SDK first. Then, I installed Google Cloud SDK using:
sudo curl https://sdk.cloud.google.com | bash
but it's showing error while installing.
Then, I installed Google Cloud SDK from a zip file, but it shows an error at the final stage of installation:
/home/nikhil/google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/install.py", line 20, in <module>
from googlecloudsdk.gcloud import gcloud
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/gcloud/gcloud.py", line 190, in <module>
_cli = CreateCLI()
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/gcloud/gcloud.py", line 188, in CreateCLI
return loader.Generate()
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/calliope/cli.py", line 304, in Generate
cli = self.__MakeCLI(top_group)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/calliope/cli.py", line 467, in __MakeCLI
log.AddFileLogging(self.__logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 547, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 331, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 408, in _SetupLogsDir
os.makedirs(day_dir_path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/nikhil/.config/gcloud/logs/2015.07.03'
What should I do to complete installation?
Then, I tried gcloud info on terminal, but it's showing the error below:
nikhil#nikhil-Aspire-S3-391:~$ gcloud info
Traceback (most recent call last):
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 190, in <module>
_cli = CreateCLI()
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 188, in CreateCLI
return loader.Generate()
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 304, in Generate
cli = self.__MakeCLI(top_group)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 467, in __MakeCLI
log.AddFileLogging(self.__logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 547, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 331, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 408, in _SetupLogsDir
os.makedirs(day_dir_path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/nikhil/.config/gcloud/logs/2015.07.04'
This looks like a file permissions error in creating the directory /home/nikhil/.config/gcloud/logs/2015.07.04. Can you check the existence and file permissions for all of the parent directories?
ls -ld /home/nikhil/
ls -ld /home/nikhil/.config
ls -ld /home/nikhil/.config/gcloud
ls -ld /home/nikhil/.config/gcloud/logs
ls -ld /home/nikhil/.config/gcloud/logs/2015.07.04
Then upload the output to this question.
My hunch is that you've run a Cloud SDK command as the root user (generally not recommended), which created the /home/nikhil/.config/gcloud directory with root as the owner. If this is the case, the command:
sudo chown -R nikhil /home/nikhil/.config/gcloud
may fix the issue.
As an aside, the command sudo curl https://sdk.cloud.google.com | bash will not do what you want it to do; it executes curl as root, but the actual install will not happen as the root user. The Cloud SDK can be installed without root privileges, so I recommend simply curl https://sdk.cloud.google.com | bash.
Following instructions on this page, Accessing the datastore remotely with remote_api:
I edited app.yaml to include these lines:
builtins:
- remote_api: on
I opened up a Terminal:
$ cd /path/to/app
$ python2.5 /usr/local/google_appengine/remote_api.shell.py\
-s localhost:8082 -p /_ah/remote_api
At the root of my app folder structure, I have a module named foobar.py, as well as a package named data_models. After gaining access to the remote_api Python interpreter, I try the following lines:
import foobar
import data_models
But I get an error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named foobar
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named data_models
How do I access the interactive console through the Terminal? Am I missing something? The same thing happens even if I login to the cloud server:
$ python2.5 /usr/local/google_appengine/remote_api.shell.py\
-s my-app.appspot.com -p /_ah/remote_api
remote_api just makes it possible to make RPC calls from a local task to a remote instance of an App Engine app. The Python console itself is still local, and everything you do executes locally. That means that any modules you try and import must exist on your local machine, somewhere your Python instance can find them - probably by adding your app's directory to PYTHONPATH, like this:
$ PYTHONPATH=/my/app/dir python2.5 /usr/local/google_appengine/remote_api.shell.py\
-s my-app.appspot.com -p /_ah/remote_api
I added the following lines to my .bash_profile so that I won't have to edit PYTHONPATH every time I fire up the Terminal.
PYTHONPATH = "/path/to/app"
export PYTHONPATH
It seems that the remote_api is in a different path than your app so it curpwd is that of the remote_api so your app's code is not available