Cannot Containerize The Sample App In Google Kubernetes Tutorial - google-app-engine

I can't containerize the sample application provided by Google, which means it's either a global issue or something really obvious I'm overlooking.
So. I'm working from the Google PHP Bookshelf Tutorial at https://cloud.google.com/php/tutorials/bookshelf-on-kubernetes-engine with the default Dockerfile, which is to say:
FROM gcr.io/google_appengine/php
# Add our NGINX and php.ini config
ENV DOCUMENT_ROOT=${APP_DIR}/web
# Workaround for AUFS-related permission issue:
# See https://github.com/docker/docker/issues/783#issuecomment-56013588
RUN cp -R ${APP_DIR} ${APP_DIR}-copy; rm -r ${APP_DIR}; mv ${APP_DIR}-copy ${APP_DIR}; chmod -R 550 ${APP_DIR}; chown -R root.www-data ${APP_DIR}
And when I run this command in the directory:
docker build -t gcr.io/{ID}/bookshelf .
I get the following error message that bombs out:
Get:19 http://packages.cloud.google.com/apt gcp-php-runtime-xenial-20181210-1/main amd64 gcp-php72-stackdriver-debugger amd64 0.2.0-7.2.13-1 [16.3 kB]
Fetched 13.1 MB in 3s (3762 kB/s)
W: http://packages.cloud.google.com/apt/pool/gcp-php72-cassandra_1.3.2-7.2.13-1_amd64_ada32d7a11b6c82aaa6b1ac862ef703f9b7fe1c16f640b695465a64457cd4aa4.deb: Automatically disabled Acquire::http::Pipeline-Depth due to incorrect response from server/proxy. (man 5 apt.conf)
E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-apcu_5.1.15-7.2.13-1_amd64_15fbd2c2e40acf5c27e025da6a2a91bae6c5d91474e2bc1d6701a38e1694b141.deb 400 Bad Request
E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-apcu-bc_1.0.4-7.2.13-1_amd64_2df44251c7d74210da6f81d5008759ae05c6a7508bd867641c3e2a5d09c37023.deb 405 Method Not Allowed
E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-cassandra_1.3.2-7.2.13-1_amd64_ada32d7a11b6c82aaa6b1ac862ef703f9b7fe1c16f640b695465a64457cd4aa4.deb Hash Sum mismatch
E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-ev_1.0.4-7.2.13-1_amd64_7070488b0e864419786e936ecb37a1db16b8da2ffe7bb6d477de6efd17fb6033.deb Hash Sum mismatch
E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-event_2.4.3-7.2.13-1_amd64_43ac00ba31d1d0ef2fb882ea1ea8e7734153e764a083547b4670febde058ec18.deb Hash Sum mismatch
E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-grpc_1.17.0-7.2.13-1_amd64_bdd2d379362ab3f30d1360059d73d216ba14e1602ee0e4dd57981da14a7fb08f.deb Hash Sum mismatch
E: Failed to fetch http://packages.cloud.google.com/apt/pool/gcp-php72-imagick_3.4.3-7.2.13-1_amd64_5ade1cea82cf4ac52e7c999e5a93239f12fba76ecf9865a7ad7e9f0fdbd142bd.deb Writing more data than expected (91276 > 85662)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c /build-scripts/composer.sh' returned a non-zero code: 100
This error occurs whenever I try to run the build anywhere - even if I do a test on my local machine, it still bombs.
What gives?

The apt errors Hash Sum mismatch, 400 Bad Request, 405 Method Not Allowed, Writing more data than expected (91276 > 85662) suggest that something was wrong with the apt package repos at that time.
So I am assuming something was broken with the repo at that time (OR a partial response was received due to a blip in networking which might have caused APT to express these errors).
I have now built the Dockerfile of this tutorial successfully. So I think this was a transient issue.

Related

Github deploying issues

When I try to use npm run deploy on github, it throws me the following errors:
fatal: bad object refs/remotes/origin/main
error: github.com:Aris-Empanta/Accountant_landing_page.git did not send all necessary objects
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
error: bad ref for .git/logs/refs/remotes/origin/main
fatal: bad object refs/remotes/origin/main
fatal: failed to run repack
error: task 'gc' failed
Any suggestions?
Though VS code command line, everytime I change my project I push the changes you know, git add, git commit, git push origin. After that when I confirm the merging from github, I write npm run deploy to deploy the changed project to gh-pages. It was working, but suddenly stopped.

opam init fails - unable to create temp file

I have installed opam 2.1.0 on a Linux Virtualbox VM. When I try opam init, I get the following error:
<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><>
[ERROR] Could not update repository "default": OpamDownload.Download_fail(_, "Curl
failed: \"/snap/bin/curl --write-out %{http_code}\\\\n --retry 3
--retry-delay 2 --user-agent opam/2.1.0 -L -o
/tmp/opam-32196-d33843/index.tar.gz.part --
https://opam.ocaml.org/index.tar.gz\" exited with code 23")
[ERROR] Initial download of repository failed.
Running with --disable-sandboxing doesn't help. I know that its a problem creating/writing to /tmp/opam-... directory because if I replace that with my current directory or home directory the command by itself runs fine. It also runs fine with /tmp/opam-... if I use the --create-dirs option in curl but I don't have any way of getting opam init to use that option. Any ideas?
thanks
Update
The reason opam init failed for me was because curl was installed with snap on my system. This exactly what is going on with your VM.
Try to run opam init -verbose and that could reveal more about why you ran into an error.
In my case I needed to install other things with opam and it kept failing every time. So snap uninstall curl and then sudo apt install curl fixed things. (Was only able to figure this out with help from my professor)
Workaround
I ran into the same issue and I found a workaround on the OCaml forum: here. (Credits to UnixJunkie)
You can run:
opam init github git+https://github.com/ocaml/opam-repository.git
This should avoid the certificate issues. This worked for me.
I tried to fix the certificate issues using this answer as well. You could try doing that, but it seems complicated when the workaround is to simply point it to the github repo directly.
This question is similar to this one.

What is the problem with my git when I upload my project to github?

I working a react project, I am trying to push it in GitHub, I don't know where is the problem that it give such kind of an error.
The error is like:
error: RPC failed; curl 18 OpenSSL SSL_read: Connection was reset, errno 10054
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Everything up-to-date
If your repository is large, you may need to increase the buffer size, you increase the git buffer size with the following command,
git config http.postBuffer 524288000
Please read the http.postBuffer parameter in the git documentation, before performing this command,
https://git-scm.com/docs/git-config

Cloud Build fails to build App Engine Python 3.8 app (due to pip bug?)

I have a number of Python 3.7 apps on Google App Engine standard, all building and deploying fine. I'm trying to upgrade some of them to the new Python 3.8 runtime, but when I try to deploy, they fail in Cloud Build.
It looks like they're hitting this open pip bug (more background). Odd that only the Python 3.8 runtime triggers this bug, though, and 3.7 builds fine.
Full log below. (Note that it's happening in Cloud Build, not my local machine, so I can't upgrade pip or otherwise change any of the commands or environment.) Anyone know how I can fix or work around this?
File upload done.
Updating service [default]...failed.
ERROR: (gcloud.beta.app.deploy) Error Response: [9] Cloud build 83e346a0-7e88-43dd-b89c-a4820526e4a1 status: FAILURE
Error ID: f8df99ad
Error type: INTERNAL
Error message: ... (setup.py): started
Building wheel for webapp2 (setup.py): finished with status 'done'
Created wheel for webapp2: filename=webapp2-3.0.0b1-py3-none-any.whl size=68362 sha256=9dd9f3ab6a55404492a88eb9a6bacb00faa37efafbc41f21a24d21cfba0eaea3
Stored in directory: /layers/google.python.pip/pipcache/wheels/55/e9/4d/76b030f418cac0bef4a3dcc15ca95c9671f1e826731ce2bc0f
Building wheel for tlslite-ng (setup.py): started
Building wheel for tlslite-ng (setup.py): finished with status 'done'
Created wheel for tlslite-ng: filename=tlslite_ng-0.7.5-py3-none-any.whl size=199869 sha256=b9ead00f0832041fba1e9d3883e57847995c2d6f83ecb7ea87d09cf82c730e8b
Stored in directory: /layers/google.python.pip/pipcache/wheels/a6/e1/a6/09610854c3405202d0b71d8f869811781e40cd26ffb85eacf8
Successfully built gdata humanize mf2py mf2util python-tumblpy ujson webapp2 tlslite-ng
Installing collected packages: six, ecdsa, tlslite-ng, lxml, gdata, certifi, urllib3, chardet, idna, requests, setuptools, protobuf, googleapis-common-protos, pyasn1, pyasn1-modules, rsa, cachetools, google-auth, pytz, grpcio, google-api-core, google-cloud-core, google-cloud-logging, gunicorn, pbr, extras, linecache2, traceback2, python-mimeparse, argparse, unittest2, testtools, fixtures, mox3, soupsieve, beautifulsoup4, gdata-python3, redis, google-cloud-datastore, google-cloud-ndb, humanize, MarkupSafe, jinja2, webencodings, html5lib, mf2py, mf2util, oauthlib, prawcore, websocket-client, update-checker, praw, requests-oauthlib, python-tumblpy, tweepy, ujson, webob, webapp2, oauth-dropins
Running setup.py develop for oauth-dropins
ERROR: Command errored out with exit status 1:
command: /opt/python3.8/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/workspace/setup.py'"'"'; __file__='"'"'/workspace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --home /tmp/pip-target-zp53suvg
cwd: /workspace/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: option --home not recognized
----------------------------------------
ERROR: Command errored out with exit status 1: /opt/python3.8/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/workspace/setup.py'"'"'; __file__='"'"'/workspace/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --home /tmp/pip-target-zp53suvg Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/opt/python3.8/bin/python3 -m pip install --upgrade pip' command.
Full build logs: https://console.cloud.google.com/cloud-build/builds/83e346a0-7e88-43dd-b89c-a4820526e4a1?project=216076569502
Here's my requirements.txt file. I suspect the -e . might be the problem...but it works with Python 3.7, so if so, that's disappointing.
git+https://github.com/dvska/gdata-python3.git#egg=gdata
google-cloud-logging~=1.14
gunicorn~=20.0
mox3~=0.28
# this includes everything in setup.py's install_requires.
# https://caremad.io/posts/2013/07/setup-vs-requirement/#developing-reusable-things-or-how-not-to-repeat-yourself
-e .
I checked pypi page of oauth-dropins (at which it is failing) and they're mentioning there exactly this issue being caused by -e

Building a container with debootstrap

I'm trying to create a LXC container (lxc-create) and I get this error:
E: Invalid Release file, no entry for main/binary-armhf/Packages
any way to fix this?
This is what happens:
root#raspberrypi:/home/pi# lxc-create -n myfirstcontainer -t debian
Note: Usually the template option is called with a configuration file option too, mostly to configure the network. For more information look at lxc.conf (5)
Downloading minimal system...
I: Retrieving Release
W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg
E: Invalid Release file, no entry for main/binary-armhf/Packages
Failed to download the rootfs, aborting.
Failed to download base system
failed to install system
failed to execute template 'debian'
aborted

Resources