I am trying to build an ASP.NET5 application via Bluemix Pipeline using a shell script to configure a runtime that supports .NET builds with DNVM. When building the application we need to get dependencies from Mono 4.0 (such as kestrel) but the latest Mono available via apt-get is 3.2. I tried to resolve this by adding the Mono deb repository in /etc/apt/sources.list so that an apt-get update would fetch the latest Mono package but due to a permission error we are not allowed to alter sources.list nor add or alter any files in /etc/apt/sources.list.d/*.
For example, running:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo -i tee /etc/apt/sources.list.d/mono-xamarin.list
Will result in:
sudo: no tty present and no askpass program specified
Not using sudo will give a permission issue and I think we have exhausted all possible workarounds such as ssh -t -t and forth.
Does anyone have any suggestions on a workaround for this or an alternative method to run a shell script where a .NET build with DNVM and all dependencies would be supported? Using another language or cf push in this case is not an option, we really want to push .NET through pipeline at any cost.
When experimenting with the pipeline I wasn't able to get it working with Mono either, but if you can get away with just the CoreCLR on Linux then you should be able to. Kestrel, for example, doesn't require Mono anymore.
This was a build script from the beta7 timeframe but it should be close to what's needed to use RC1 now:
#!/bin/bash
sudo apt-get update
sudo apt-get -y install libunwind8 gettext libssl-dev libcurl3-dev zlib1g
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
dnvm install 1.0.0-beta7 -r coreclr -a x64
cd src/dotnetstarter
dnu restore
dnu build
cd ../../test/dotnetstarter.tests
dnu restore
dnu build
dnx test
cd ../../src/dotnetstarter
dnu publish --runtime ~/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-beta7
The app was https://github.com/IBM-Bluemix/asp.net5-helloworld and I added the dotnetstarter.tests project which I was trying to run in the pipeline (the dnx test step). The last publish step isn't required but is included to show it was working.
Thanks to opiethehokie, this is the working script:
#!/bin/bash
echo --- UPDATING DEPENDENCIES! ---
sudo apt-get update
echo --- DOWNLOADING PACKAGES! ---
sudo apt-get -y install libunwind8 gettext libssl-dev libcurl3-dev zlib1g libcurl4-openssl-dev libicu-dev uuid-dev
echo --- DOWNLOADING DNVM! ---
curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_BRANCH=dev sh && source ~/.dnx/dnvm/dnvm.sh
echo --- INSTALLING DNVM! ---
dnvm install 1.0.0-rc1-final -r coreclr -a x64
echo --- EXECUTING RESTORE! ---
cd /path-to-project-folder
dnu restore
echo --- EXECUTING BUILD! ---
dnu build
echo --- PUBLISH BUILD (OPTIONAL)! ---
dnu publish --runtime ~/.dnx/runtimes/dnx-coreclr-linux-x64.1.0.0-*`
Related
I try to install laravel 9 /mongodbsite under docker , based on
FROM php:8.1.6-apache
But running the app I got error:
Class "MongoDB\Driver\Manager" not found
Searching in net I found a possible decision as “php-mongo” package is not installed
But adding php-mongo in as :
RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
...
RUN apt-get install -y mongodb-org php-mongo
I got error :
E: Package 'php-mongo' has no installation candidate
I tried to use php-mongodb-all-dev, php8.1-mongodb, but got similar errors.
Which package and have I to install ?
Updated Part 1:
I modified Dockerfile.yml as :
FROM php:8.1.6-apache
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends --quiet \
curl \
wget \
gnupg
RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions \
&& install-php-extensions mongo
RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends --quiet \
python \
apt-transport-https \
libfreetype6-dev \
But I got error :
docker-compose up -d --build
...
Reading package lists...
### INSTALLING REQUIRED PACKAGES ###
# Packages to be kept after installation:
# Packages to be used only for installation: libsasl2-dev libssl-dev
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 14467 files and directories currently installed.)
Preparing to unpack .../libssl1.1_1.1.1n-0+deb11u3_amd64.deb ...
Unpacking libssl1.1:amd64 (1.1.1n-0+deb11u3) over (1.1.1n-0+deb11u2) ...
Setting up libssl1.1:amd64 (1.1.1n-0+deb11u3) ...
Selecting previously unselected package libsasl2-dev.
(Reading database ... 14467 files and directories currently installed.)
Preparing to unpack .../libsasl2-dev_2.1.27+dfsg-2.1+deb11u1_amd64.deb ...
Unpacking libsasl2-dev (2.1.27+dfsg-2.1+deb11u1) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../libssl-dev_1.1.1n-0+deb11u3_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.1n-0+deb11u3) ...
Setting up libsasl2-dev (2.1.27+dfsg-2.1+deb11u1) ...
Setting up libssl-dev:amd64 (1.1.1n-0+deb11u3) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
### INSTALLING REMOTE MODULE mongo ###
WARNING: "pecl/mongo" is deprecated in favor of "channel:///mongodb"
pecl/mongo requires PHP (version >= 5.3.0, version <= 5.99.99), installed version is 8.1.6
No valid packages found
install failed
ERROR: Service 'web' failed to build: The command '/bin/sh -c chmod +x /usr/local/bin/install-php-extensions && install-php-extensions mongo' returned a non-zero code: 1
Which format of the command is valid ?
Thanks in advance!
php-mongo is a PHP extension and the default PHP images for docker do not allow installing PHP extensions on then using apt-get.
You can try doing the following in your Dockerfile instead:
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions \
&& install-php-extensions mongodb
This is a more simplified approach than the official documentation.
More information on these images as well as the documentation to install extensions can be found in dockerhub
Information about docker-php-extension-installer can be found in Github
We are currently experimenting with new VMSS build agents for our devops environment, which requires some components for each build pipeline.
So to make sure don't need to add this to every build pipeline, we created a startup script which is executed every time the machine is created (standard custom script extension) with the following contents
#install kubectl
echo "Installing KubeCTL"
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
echo "Installing DotNet SDK"
#install dotnet runtime (5) for dotnet tool install
sudo apt-get install -y dotnet-sdk-5.0
echo "Installing DotNet DotNet Runtime"
#install dotnet runtime (5) for FluentMigrator
sudo apt-get install -y dotnet-runtime-5.0
echo "Installing DotNet AzureCLI"
#install AzureCLI
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
echo "Installing Powershell"
#install powershell
# Update the list of packages
sudo apt-get update
# Install pre-requisite packages.
sudo apt-get install -y wget apt-transport-https software-properties-common
# Download the Microsoft repository GPG keys
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
# Install PowerShell
sudo apt-get install -y powershell
echo "Installing FluentMigrator"
#install fluent migrator
dotnet tool install -g FluentMigrator.DotNet.Cli
echo "Installing OpenJDK"
#install openJDK
sudo apt-get install -y openjdk-11-jre
Now, everything in this script executes and installs without any issues, the build pipeline runs correctly after a new agent is booted up.
However, during release time, we require fluentmigrator, which is not installed even though it is included in the script.
If we add the same install line dotnet tool install -g FluentMigrator.DotNet.Cli as a build step or as a step during release it gets installed correctly. To do this we run a custom bash with the command.
However, i would very much prefer to have this run within the boot-up of the machine instead of adding a custom bash script to 20 release pipelines. Anyone has any idea why the tool is not installing correctly within this script?
I created a Rust application, which I would like to distribute as an installable package.
So, I followed this guide
https://earthly.dev/blog/creating-and-hosting-your-own-deb-packages-and-apt-repo/
Created a deb package,
Created an apt repo
& Signed it !
My code repo is : https://github.com/Bhogayata-Keval/secure-apt-demo
However,
after I add my apt-repo to /etc/apt using
echo "deb [arch=amd64] http://127.0.0.1:8000/apt-repo stable main" | sudo tee /etc/apt/sources.list.d/example.list
(I started a local server for testing, as suggested in the blog post)
& run sudo apt-get install xxxxxx
it says --- E: Unable to locate package xxxxxx
Check out OpenRepo: https://github.com/openkilt/openrepo
This is an open source package hosting server that can make packages available for both Debian (APT) and Red Hat (RPM) files.
Run sudo apt update
This updates the local list of packages apt can install, and should be executed after adding a repository or before running sudo apt upgrade
I am trying to get Roundhouse running from a Docker image where I have some Oracle scripts, but currently when I execute the rh command against my Docker image I get the following error:
A type could not be created from the object you passed. "roundhouse.databases.oracle.OracleDatabase, roundhouse.databases.oracle" resolves to null.
I think this a result of not having the Oracle Client tools configured correctly in my Docker Image(https://github.com/chucknorris/roundhouse/wiki/Oracle).
I have downloaded the rpm files from https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html and I have managed to get the Oracle Client Tools installed but I carry on getting the above error so I assume that this is because I haven't configured the client tools correctly?
Can anyone advise what I am doing wrong?
FROM mcr.microsoft.com/dotnet/core/sdk:2.1
ENV PATH="$PATH:/root/.dotnet/tools"
ADD *.* /
RUN apt-get update && \
apt-get install sudo
#RUN apk --update add libaio bc net-tools
RUN sudo apt-get install unzip
RUN sudo apt-get install wget
RUN sudo apt-get install alien -y
RUN sudo alien -i oracle-instantclient*-basic-*.rpm
RUN sudo alien -i oracle-instantclient*-devel-*.rpm
RUN sudo alien -i oracle-instantclient*-sqlplus-*.rpm
RUN echo /usr/lib/oracle/19.1/client/lib > /etc/ld.so.conf.d/oracle.conf
RUN sudo ldconfig
RUN dotnet tool install --global dotnet-roundhouse --version 1.2.1
ENTRYPOINT [ "rh"]
I had the same error when I tried to use the MS repo.
This worked for me:
Install the oficial oracle instant client container as
oracle/instantclient:19. Instruction here.
On top of that image build this Dockerfile
from oracle/instantclient:19
RUN microdnf install git RUN git clone https://github.com/chucknorris/roundhouse.git
RUN microdnf install dotnet-sdk-2.1
RUN cd roundhouse && dotnet tool install --global dotnet-roundhouse --version 1.2.1
ENTRYPOINT [ "rh"]
i am Trying to install heroku tool belt in Kali sana from :wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh and i keep getting the error below any help?
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
heroku-toolbelt : Depends: heroku (= 3.43.3) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So I know this thread is old but I just got heroku working on kali and found this thread while searching.
$ wget https://cli-assets.heroku.com/branches/stable/heroku-linux-386.tar.gz -O heroku.tar.gz
$ mkdir -p /usr/local/lib
$ tar -xvzf heroku.tar.gz -C /usr/local/lib
$ /usr/local/lib/heroku/install
Above is what I used, the 386 part for ARCH as in architecture is 32bit, so you would need amd64 for 64bit.
sudo apt install software-properties-common # debian only
[nano | echo | leafpad ] "deb https://cliassets.heroku.com/branches/stable/apt ./" """into""" /etc/apt/source.list
curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
sudo apt update
sudo apt upgrade
sudo apt-get install heroku
apt-get update
wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh
heroku update
this would update all the plugins to the latest version of the heroku cli...goodluck