Syncing code Compute Engine with App Engine - google-app-engine

My project use Django, and I need run the Django's ORM in Compute Engine, for this I want sync in one repository both Compute Engine and App Engine with my development server.
When I try:
gcloud init <proyect>
From the Compute Engine, the log is:
ERROR: Unable to initialize project [tcontur2], cleaning up [***].
ERROR: (gcloud.init) Your git version 1.7.10 is older than the minimum version 1.8.1.
Please install a newer version of git.
I try
apt-get update
apt-get upgrade
And nothing.
I too try:
git clone https://source.developers.google.com/myproyect
But the authenication fails. What is the username and password? It is not my gmail user account.
Is possible sync the Compute Engine with the code in App Engine? or only is possible with another repository? This option suppose other payment to Github, I dont want spend more.

I reproduced your issue from my fresh Debian instance and I was able to solve it. I downloaded the new git version from: http://code.google.com/p/git-core/downloads/detail?name=git-1.9.0.tar.gz
Also I needed to install some packages that you may have already installed but just in case I'll let you know which are them.
These are the steps I've taken:
sudo apt-get install libssl-dev libcurl4-openssl-dev libexpat-dev gettext
wget http://git-core.googlecode.com/files/git-1.9.0.tar.gz
tar -xvzf git-1.9.0.tar.gz
cd git-1.9.0
sudo make prefix=/usr all
sudo make prefix=/usr install
After that you can check your git version with:
git --version
Now, if the output of the last command displays "git version 1.9.0", you should be able to create the repository with the command:
gclod init <project>

Related

Running into problems installing MongoDB on MacOS Terminal

I am trying to install mongoDB as a macOS service but I am running to some errors
I first put in the terminal
brew tap mongodb
Nothing really happens.
But, when I run:
brew install mongodb-community#5.0
I receive:
Warning: No available formula with the name "mongosh" (dependency of mongodb/brew/mongodb-community). Did you mean mongocli?
==> Searching for similarly named fo This similarly named formula was found: mongocli ✔
To install it, run: brew install mongocli ✔ It was migrated from mongodb/brew to homebrew/core.
Finally, when I run
brew services start mongodb-community#5.0
I receive
Error: Formula 'mongodb-community' is not installed.
Any advice?
I had the same happen, however my issue was actually with this error:
fatal: could not solve HEAD to a revision
solve it using:
git -C $(brew --repository homebrew/core) checkout master
you can also:
brew update
brew upgrade
brew upgrade --cask
brew cleanup
and then restart the mongodb community edition install process again! Worked for me!
I am experiencing the exact same problem (I am using MacOC version 11.5.1).
The reason why your brew tap mongodb does not seem to be doing anything may be because you have already tapped into mongodb. Try untapping with brew untap mongodband retapping with brew tap mongodb/brew.
After you have established the connection, try installing again with brew install mongodb-community#5.0. At this stage, I could not get the installation to work for version 5.0 so I installed version 4.4 instead (with brew install mongodb-community#4.4).
After that, try running mongo with brew services start mongodb-community#5.0 (or brew services start mongodb-community#4.4 if you have installed 4.4 version) and it should work just fine!
If you have installed version 4.4, be sure to run the command PATH="/usr/local/opt/mongodb-community#4.4/bin" mongo to start the mongo shell.
I was also having the same issue. This solved it for me:
git -C $(brew --repository homebrew/core) checkout master
brew update
brew upgrade
brew upgrade --cask
brew cleanup
Then install the latest version of Mongodb community using:
brew install mongodb-community#6.0
Note: version might be outdated at the time you're reading this
Check with brew list | grep mongo that mongodb-community, mongodb-database-tools, mongosh exist at your PC. If they do not exist, install them with brew.
Recently also installed mongodb V4.4.5 and can not start it with brew services start mongodb-community. For me works starting it manually as a background process as admin sudo mongod --config /usr/local/etc/mongod.conf --fork
And last call mongo to work with mongoDB shell.
Reason: directory/file access issue. Not sure.

Which ChromeDriver & Headless Chrome versions exist that are compatible with ruby 2.7?

The issue
I have a web scraper running in AWS lambda but in a few weeks AWS lambda will stop supporting Ruby 2.7. I built my scraper last year using this tutorial.
I need to find a version of chrome driver & headless chrome that is compatible with Ruby 2.7, But I don't know exactly where to start.
I have looked at the ChromeDriver's downloads portal But I don't see any indication there that Chrome driver will work for ruby 2.7 or any other specific version of ruby for that matter.
The code I have works by accessing the ChromeDriver binary and starting it inside a specific folder
I downloaded the specific binaries I am using by running these commands:
# serverless chrome
wget https://github.com/adieuadieu/serverless-chrome/releases/download/v1.0.0-37/stable-headless-chromium-amazonlinux-2017-03.zip
unzip stable-headless-chromium-amazonlinux-2017-03.zip -d bin/
rm stable-headless-chromium-amazonlinux-2017-03.zip
# chromedriver
wget https://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip
unzip chromedriver_linux64.zip -d bin/
rm chromedriver_linux64.zip
Solution
I found the solution to this problem. Ruby 2.7 that Lambda offers by default runs on top of Amazon Linux 2 (which lacks many important libraries & dependencies), unfortunately, there's nothing you can do to change that.
However, Amazon offers you the ability to run your code in a custom docker image that can be up to 10GB in size.
I fixed this problem by creating my own image using the following Dockerfile
FROM public.ecr.aws/lambda/ruby:2.7
# Install dependencies needed to run MySQL & Chrome
RUN yum -y install libX11
RUN yum -y install dejavu-sans-fonts
RUN yum -y install procps
RUN yum -y install mysql-devel
RUN yum -y install tree
RUN mkdir /var/task/lib
RUN cp /usr/lib64/mysql/libmysqlclient.so.18 /var/task/lib
RUN gem install bundler
RUN yum -y install wget
RUN yum -y groupinstall 'Development Tools'
# Ruby Gems
ADD Gemfile ${LAMBDA_TASK_ROOT}/
ADD Gemfile.lock ${LAMBDA_TASK_ROOT}/
RUN bundle config set path 'vendor/bundle' && \
bundle install
# Install chromedriver & chromium
RUN mkdir ${LAMBDA_TASK_ROOT}/bin
# Chromium
RUN wget https://github.com/adieuadieu/serverless-chrome/releases/download/v1.0.0-37/stable-headless-chromium-amazonlinux-2017-03.zip
RUN unzip stable-headless-chromium-amazonlinux-2017-03.zip -d ${LAMBDA_TASK_ROOT}/bin/
RUN rm stable-headless-chromium-amazonlinux-2017-03.zip
# Chromedriver
RUN wget https://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip
RUN unzip chromedriver_linux64.zip -d ${LAMBDA_TASK_ROOT}/bin/
RUN rm chromedriver_linux64.zip
# Copy function code
COPY app.rb ${LAMBDA_TASK_ROOT}
WORKDIR ${LAMBDA_TASK_ROOT}
RUN tree
RUN ls ${LAMBDA_TASK_ROOT}/bin
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "app.handle" ]
Notes
If your code was previously deployed using a zip file you will have to either destroy the previous function or create a second function with the code update, it all comes down to how you want to handle deployment.
It is possible to automate the deployment process using the serverless framework

How should one configure or install salt-cloud to use the Saltstack py3 repository to install the minion instead of the distribution (apt) repository?

I would like salt-cloud to install the salt-minion using the same sources.list.d/saltstack.list file that is on the saltmaster server, but it uses the Ubuntu APT repository instead.
What I get on a new minion in /etc/apt/sources.list.d/saltstack.list:
deb https://repo.saltstack.com/apt/ubuntu/18.04/amd64/latest bionic main
What I want:
deb https://repo.saltstack.com/py3/ubuntu/18.04/amd64/latest bionic main
I installed salt-master and salt-cloud from the Saltstack repository by doing the following on my saltmaster server:
wget -O - https://repo.saltstack.com/py3/ubuntu/18.04/amd64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
echo "deb https://repo.saltstack.com/py3/ubuntu/18.04/amd64/latest bionic main" > etc/apt/sources.list.d/saltstack.list
apt update
apt install python3-pip salt-master salt-minion salt-cloud
I spin up a server using salt-cloud and the /etc/apt/sources.list.d/saltstack.list without fail uses the apt repository, not the py3 repository.
Is there an option I can set in the saltmaster configuration file that defines which repository salt-cloud should use? Is there a similar option in a salt-cloud profile that can be passed to the salt bootstrap script?
I see in the bootstrap script that salt-cloud runs (found at bootstrap.saltstack.com) a command line option called _CUSTOM_REPO_URL, but I don't know how to pass options to that script when creating a server with salt-cloud -p
Happy to ask elsewhere (please indicate where) if more appropriate.
I can provide applicable parts of my salt-cloud profile if needed.
I found https://docs.saltstack.com/en/latest/topics/cloud/deploy.html#deploy-script-arguments
That led me to add the following to my cloud server profile used with the salt-cloud -p command:
script: bootstrap-salt
script_args: -x python3
Then the correct repository was installed.

Google App Engine PHP SDK - How to install on Ubuntu (15.10)?

Google official documentation is available here:
https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_PHP
But it doesn't provide sufficient information about the following step:
"4 - Build and install the PHP interpreter and App Engine PHP extension. Specify the path to php-cgi and gae_runtime_module.so when running the development server."
I'm using a new Virtualbox machine with Ubuntu 15.10 and PhpStorm to test GAE.
Could someone please provide clear instructions about step 4? What do I need to do to install the php interpreter and the App Engine php extension?
P.s. I've already searched with google but I only found old/confusing tutorials
That GAE PHP extension seems like a quite new thing. Don't remember using it on the SDK in Ubuntu 14.04.
You need to build PHP and that extension from source. You should grab the latest PHP5.5 branch from their source repo (http://php.net/git.php) and build it. That linked page contains instructions on building PHP but the procedure is similar to the following:
$ git clone <php-src>
$ cd ./php-src/
$ git checkout PHP-5.5
$ ./buildconf
$ ./configure --prefix="/opt/php55"
$ sudo make && sudo make install
And remember to pick the modules and packages you want to compile with PHP5.5 to be used in the SDK. I think Google had an official list of modules and extensions they use inside GAE PHP and inside the SDK PHP. The prefix argument tells the compiler where to install the resulting application.
Then you need to get that source for the PHP extension and build it
$ git clone https://github.com/GoogleCloudPlatform/appengine-php-extension
$ cd appengine-php-extension
$ phpize # remember to use the phpize from the just built PHP5.5 binaries
$ ./configure
$ sudo make && sudo make install
(That Git repository contains detailed building instructions so you should probably refer to them when building.)
Enable the resulting .so for the PHP5.5 you just built using the PHP configuration files.
After that you need to install the PHP SDK and configure it to use the newly built PHP binary
$ dev_appserver.py <...> --php_executable_path=/opt/php55/bin/php-cgi
The SDK will let you know if the built PHP binaries are incompatible with the SDK version you use. I remember compiling the PHP from source around 5 times before it worked without any warnings.
But essentially they are telling you to compile PHP from source, then compile their extension from source and then use the built PHP+extension with the downloaded SDK. These instructions are from the top of my head so you may need to adjust the commands and procedures.
The process can be simplified by using Docker, here is an image you can use: https://hub.docker.com/r/mhariri/docker-google-appengine-php/
To run your app, you just need docker installed, and then run the following command in your app directory:
docker run -it -v $(pwd):/app --rm --net=host mhariri/docker-google-appengine-php

Can deb packages from one machine be installed in another?

Install python-netinterfaces on machine1 using apt-get
Copy the python-interfaces deb package cached in /var/cache/apt/archive from machine to machine2
Change the /etc/apt/sources.list to point to the directory where the package is copied in machine2
Run teh following command
sudo apt-get install python-interfaces
It inturn tries to install python-chardet-whl
and I get the error
warning: the following packages cannot be authenticated!
If I install the python-chardlet-whl from command line it fails with the authentication error message. however, it passes with --force-yes message.
I searched in the web for solutions and tried some suggestions like apt-key update, but nothing worked.
Is it possible to install package installed from one machine in another?
note: Both have same hardware and OS/other-software is installed is same
Are you sure destination machine has same repository list as source machine?
apt-cache showpkg python-chardet-whl
After adding repository to destination machine it would show you repository that package belongs to
Then you need to run:
sudo apt-get update
To update the repository list, by doing this you problem should fix
Also make sure that package does not need any dependency that is not installed on the system.

Resources