How to install mono 4.8 on Ubuntu 16.04 - installation

Ok, I feel like I should be able to figure this out based on the documentation provided by Mono, but nothing is working. Based on this guide and this note, I've tried running
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/ubuntu/dists/wheezy/snapshots/4.8.0" | sudo tee /etc/apt/sources.list.d/mono-official.list
sudo apt-get update
I've modifed that 2nd line a few times and or simply edited /etc/apt/sources.list.d/mono-official.list, trying other similar things, butevery time I run the sudo apt-get update, I get:
user#NAS:~$ sudo apt-get update
E: Malformed entry 1 in list file /etc/apt/sources.list.d/mono-official.list (Component)
E: The list of sources could not be read.
I need 4.8, as the app I need to use with mono does not work as well with 5.0. I currently have mono 4.2.1, but I believe it came pre-installed on my distro.

Your procedure looks sound, one small issue is that the second step should be
echo "deb http://download.mono-project.com/repo/ubuntu wheezy/snapshots/4.8.0 main" | sudo tee /etc/apt/sources.list.d/mono-official.list
Next step (after apt-get update) is installing the mono-devel 4.8.0 package and all its dependencies by version:
apt-get -f install \
mono-devel=4.8.0.524-0xamarin11 \
libmono-cecil-private-cil=4.8.0.524-0xamarin11 \
mono-mcs=4.8.0.524-0xamarin11 \
mono-gac=4.8.0.524-0xamarin11 \
mono-xbuild=4.8.0.524-0xamarin11 \
libmono-cil-dev=4.8.0.524-0xamarin11 \
libmono-2.0-dev=4.8.0.524-0xamarin11 \
libmonosgen-2.0-dev=4.8.0.524-0xamarin11 \
libmono-accessibility4.0-cil=4.8.0.524-0xamarin11 \
libmono-cairo4.0-cil=4.8.0.524-0xamarin11 \
libmono-codecontracts4.0-cil=4.8.0.524-0xamarin11 \
libmono-compilerservices-symbolwriter4.0-cil=4.8.0.524-0xamarin11 \
libmono-corlib4.5-cil=4.8.0.524-0xamarin11 \
libmono-cscompmgd0.0-cil=4.8.0.524-0xamarin11 \
libmono-csharp4.0c-cil=4.8.0.524-0xamarin11 \
libmono-custommarshalers4.0-cil=4.8.0.524-0xamarin11 \
libmono-data-tds4.0-cil=4.8.0.524-0xamarin11 \
libmono-db2-1.0-cil=4.8.0.524-0xamarin11 \
libmono-debugger-soft4.0a-cil=4.8.0.524-0xamarin11 \
libmono-http4.0-cil=4.8.0.524-0xamarin11 \
libmono-i18n4.0-all=4.8.0.524-0xamarin11 \
libmono-ldap4.0-cil=4.8.0.524-0xamarin11 \
libmono-management4.0-cil=4.8.0.524-0xamarin11 \
libmono-messaging4.0-cil=4.8.0.524-0xamarin11 \
libmono-messaging-rabbitmq4.0-cil=4.8.0.524-0xamarin11 \
libmono-microsoft-build4.0-cil=4.8.0.524-0xamarin11 \
libmono-microsoft-build-engine4.0-cil=4.8.0.524-0xamarin11 \
libmono-microsoft-build-framework4.0-cil=4.8.0.524-0xamarin11 \
libmono-microsoft-build-tasks-v4.0-4.0-cil=4.8.0.524-0xamarin11 \
libmono-microsoft-build-utilities-v4.0-4.0-cil=4.8.0.524-0xamarin11 \
libmono-microsoft-csharp4.0-cil=4.8.0.524-0xamarin11 \
libmono-microsoft-visualc10.0-cil=4.8.0.524-0xamarin11 \
libmono-microsoft-web-infrastructure1.0-cil=4.8.0.524-0xamarin11 \
libmono-oracle4.0-cil=4.8.0.524-0xamarin11 \
libmono-parallel4.0-cil=4.8.0.524-0xamarin11 \
libmono-peapi4.0a-cil=4.8.0.524-0xamarin11 \
libmono-posix4.0-cil=4.8.0.524-0xamarin11 \
libmono-rabbitmq4.0-cil=4.8.0.524-0xamarin11 \
libmono-relaxng4.0-cil=4.8.0.524-0xamarin11 \
libmono-security4.0-cil=4.8.0.524-0xamarin11 \
libmono-sharpzip4.84-cil=4.8.0.524-0xamarin11 \
libmono-simd4.0-cil=4.8.0.524-0xamarin11 \
libmono-smdiagnostics0.0-cil=4.8.0.524-0xamarin11 \
libmono-sqlite4.0-cil=4.8.0.524-0xamarin11 \
libmono-system4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-componentmodel-composition4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-componentmodel-dataannotations4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-configuration4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-configuration-install4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-core4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-data4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-data-datasetextensions4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-data-entity4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-data-linq4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-data-services4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-data-services-client4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-deployment4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-design4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-drawing4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-drawing-design4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-dynamic4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-enterpriseservices4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-identitymodel4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-identitymodel-selectors4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-io-compression4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-io-compression-filesystem4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-json4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-json-microsoft4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-ldap4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-ldap-protocols4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-management4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-messaging4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-net4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-net-http4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-net-http-formatting4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-net-http-webrequest4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-numerics4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-numerics-vectors4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-core2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-debugger2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-experimental2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-interfaces2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-linq2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-observable-aliases0.0-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-platformservices2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-providers2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-runtime-remoting2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-windows-forms2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reactive-windows-threading2.2-cil=4.8.0.524-0xamarin11 \
libmono-system-reflection-context4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-runtime4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-runtime-caching4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-runtime-durableinstancing4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-runtime-interopservices-runtimeinformation4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-runtime-serialization4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-runtime-serialization-formatters-soap4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-security4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-servicemodel4.0a-cil=4.8.0.524-0xamarin11 \
libmono-system-servicemodel-activation4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-servicemodel-discovery4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-servicemodel-internals0.0-cil=4.8.0.524-0xamarin11 \
libmono-system-servicemodel-routing4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-servicemodel-web4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-serviceprocess4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-threading-tasks-dataflow4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-transactions4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-abstractions4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-applicationservices4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-dynamicdata4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-extensions4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-extensions-design4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-http4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-http-selfhost4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-http-webhost4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-mobile4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-mvc3.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-razor2.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-regularexpressions4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-routing4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-services4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-webpages2.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-webpages-deployment2.0-cil=4.8.0.524-0xamarin11 \
libmono-system-web-webpages-razor2.0-cil=4.8.0.524-0xamarin11 \
libmono-system-windows4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-windows-forms4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-windows-forms-datavisualization4.0a-cil=4.8.0.524-0xamarin11 \
libmono-system-workflow-activities4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-workflow-componentmodel4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-workflow-runtime4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-xaml4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-xml4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-xml-linq4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-xml-serialization4.0-cil=4.8.0.524-0xamarin11 \
libmono-tasklets4.0-cil=4.8.0.524-0xamarin11 \
libmono-webbrowser4.0-cil=4.8.0.524-0xamarin11 \
libmono-webmatrix-data4.0-cil=4.8.0.524-0xamarin11 \
libmono-windowsbase4.0-cil=4.8.0.524-0xamarin11 \
libmono-xbuild-tasks4.0-cil=4.8.0.524-0xamarin11 \
libnunit-cil-dev=2.6.3+dfsg-1~xamarin2 \
libmono-codecontracts4.0-cil=4.8.0.524-0xamarin11 \
libmono-compilerservices-symbolwriter4.0-cil=4.8.0.524-0xamarin11 \
libmono-peapi4.0a-cil=4.8.0.524-0xamarin11 \
libmono-relaxng4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-configuration-install4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-data-linq4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-io-compression-filesystem4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-runtime4.0-cil=4.8.0.524-0xamarin11 \
libmono-system-servicemodel4.0a-cil=4.8.0.524-0xamarin11 \
libmono-system-web-services4.0-cil=4.8.0.524-0xamarin11 \
mono-csharp-shell=4.8.0.524-0xamarin11 \
mono-4.0-gac=4.8.0.524-0xamarin11 \
libmono-corlib4.5-cil=4.8.0.524-0xamarin11 \
libmono-microsoft-csharp4.0-cil=4.8.0.524-0xamarin11 \
mono-gac=4.8.0.524-0xamarin11 \
mono-runtime=4.8.0.524-0xamarin11 \
libmono-i18n-cjk4.0-cil=4.8.0.524-0xamarin11 \
libmono-i18n-mideast4.0-cil=4.8.0.524-0xamarin11 \
libmono-i18n-other4.0-cil=4.8.0.524-0xamarin11 \
libmono-i18n-rare4.0-cil=4.8.0.524-0xamarin11 \
libmono-i18n-west4.0-cil=4.8.0.524-0xamarin11 \
ca-certificates-mono=4.8.0.524-0xamarin11 \
libmonosgen-2.0-1=4.8.0.524-0xamarin11 \
"libnunit-console-runner2.6.3-cil=2.6.3+dfsg-1~xamarin2" \
"libnunit-core2.6.3-cil=2.6.3+dfsg-1~xamarin2" \
"libnunit-core-interfaces2.6.3-cil=2.6.3+dfsg-1~xamarin2" \
"libnunit-framework2.6.3-cil=2.6.3+dfsg-1~xamarin2" \
"libnunit-mocks2.6.3-cil=2.6.3+dfsg-1~xamarin2" \
"libnunit-util2.6.3-cil=2.6.3+dfsg-1~xamarin2" \
libmono-i18n4.0-cil=4.8.0.524-0xamarin11 \
mono-runtime-sgen=4.8.0.524-0xamarin11 \
mono-runtime-common=4.8.0.524-0xamarin11 \
monodoc-browser=4.2-0xamarin1 \
monodoc-base=4.8.0.524-0xamarin11

Actually, if you add ppa with target version (as user8174722 said)
echo "deb http://download.mono-project.com/repo/ubuntu wheezy/snapshots/4.8.0 main" | sudo tee /etc/apt/sources.list.d/mono-official.list
and you have not add any other version or main repo, you can install mono v4.8.0 with pure
apt install mono-devel
and you don't need to specify all this versions.
But be sure that you do not have other mono-project's repo in your /etc/apt directory. You can check it with
grep -d recurse -e 'mono-project' /etc/apt

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
sudo apt-get update
sudo apt-get install mono-complete
sudo vi /etc/ssh/sshd_config
^^ password authentication -> yes

You can found instruction to setup latest version of mono for ubuntu 16.04 and other distros/version on mono project site
www.mono-project.com/download/stable/
Ubuntu 16.04 (i386, amd64, armhf, arm64, ppc64el)
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-
keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
sudo apt install apt-transport-https ca-certificates
echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
sudo apt update
sudo apt install mono-devel

Related

Addition of two variables in slurm script

I am having slurm scirpt processing fmri data and the maximum value I can give in an array is 999, but the name of my subject ist over 1000.
So I need to to an addition in my slurm script. I tried:
a=${SLURM_ARRAY_TASK_ID} sum=$(($a + 1200))
#!/bin/sh
#
#SBATCH --job-name psy-stephan_fmriprep_gsp
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=4
#SBATCH --mem=8GB
#SBATCH --output /projects/core-psy/logs/nako/stephan/slurm-%j.log
#SBATCH --error /projects/core-psy/logs/nako/stephan/slurm-%j.err
a=${SLURM_ARRAY_TASK_ID}
sum=$(($a + 1200))
singularity run \
--home /projects/core-psy/tmp3:/home/fmriprep \
--cleanenv \
-B /projects/core-psy/data/nako//swunderl/GSP_new/:/input \
-B /projects/core-psy/data/nako/swunderl/GSP_new/derivatives:/output \
-B //projects/core-psy/data/nako/swunderl/GSP_new_workdir/:/workdir \
-B /projects/core-psy/data/nako/swunderl/license.txt:/license \
/projects/core-psy/images/fmriprep-20.2.2.simg /input/sub-$sum /output participant \
--fs-license-file /license \
--skip-bids-validation \
--use-aroma \
--fs-no-reconall \
-w /workdir/ \
#--output-layout bids \
# sbatch --account=core-psy sbatch-multiple-job.slurm
So i can pass as a command SLURM_ARRAY_TASK_ID as 1.
But the addition keeps giving me sub-0+1200 and not the actual sum of both numbers.
Since you do not need to perform math on a, you can perform variable expansion on the string to make a 4 digit subject label for your fmriprep command:
sum="1${SLURM_ARRAY_TASK_ID}"
This way sbatch -a 200 ./your_job_script.sh will run for sub-1200. If you have labels like 1001, you will need to add to the variable expansion since 001 becomes a SLURM_ARRAY_TASK_ID of 1.
Here's an example adapted from my own - albeit not the most succint - code for sbatch scripts
if [ ${#SLURM_ARRAY_TASK_ID} == 1 ];
then
inputNo="100${SLURM_ARRAY_TASK_ID}"
singularity run \
--home /projects/core-psy/tmp3:/home/fmriprep \
--cleanenv \
-B /projects/core-psy/data/nako//swunderl/GSP_new/:/input \
-B /projects/core-psy/data/nako/swunderl/GSP_new/derivatives:/output \
-B //projects/core-psy/data/nako/swunderl/GSP_new_workdir/:/workdir \
-B /projects/core-psy/data/nako/swunderl/license.txt:/license \
/projects/core-psy/images/fmriprep-20.2.2.simg /input/sub-${inputNo} /output participant \
--fs-license-file /license \
--skip-bids-validation \
--use-aroma \
--fs-no-reconall \
-w /workdir/
elif [ ${#SLURM_ARRAY_TASK_ID} == 2 ];
then
inputNo="10${SLURM_ARRAY_TASK_ID}"
singularity run \
--home /projects/core-psy/tmp3:/home/fmriprep \
--cleanenv \
-B /projects/core-psy/data/nako//swunderl/GSP_new/:/input \
-B /projects/core-psy/data/nako/swunderl/GSP_new/derivatives:/output \
-B //projects/core-psy/data/nako/swunderl/GSP_new_workdir/:/workdir \
-B /projects/core-psy/data/nako/swunderl/license.txt:/license \
/projects/core-psy/images/fmriprep-20.2.2.simg /input/sub-${inputNo} /output participant \
--fs-license-file /license \
--skip-bids-validation \
--use-aroma \
--fs-no-reconall \
-w /workdir/
elif [ ${#SLURM_ARRAY_TASK_ID} == 3 ];
then
inputNo="1${SLURM_ARRAY_TASK_ID}"
singularity run \
--home /projects/core-psy/tmp3:/home/fmriprep \
--cleanenv \
-B /projects/core-psy/data/nako//swunderl/GSP_new/:/input \
-B /projects/core-psy/data/nako/swunderl/GSP_new/derivatives:/output \
-B //projects/core-psy/data/nako/swunderl/GSP_new_workdir/:/workdir \
-B /projects/core-psy/data/nako/swunderl/license.txt:/license \
/projects/core-psy/images/fmriprep-20.2.2.simg /input/sub-${inputNo} /output participant \
--fs-license-file /license \
--skip-bids-validation \
--use-aroma \
--fs-no-reconall \
-w /workdir/
fi

Upload a file to a virtual machine on apache server

I have a small problem which would be a great help.
I have a function in laravel that captures certain data and at the end with $ file-> move ($ virtual_machine_address, document) it is saved in the created folder. This locally works wonders. The code is referenced fromsubir archivos en laravel (API)
public function uploadFile(Request $request){
/*Initializing variables in input*/
$input = $request->all();
/*rutas de carpeta*/
$ruta_server = DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR.'172.xx.xx.xxx'.DIRECTORY_SEPARATOR.'Prueba'.DIRECTORY_SEPARATOR.'DOCUMENTOS'.DIRECTORY_SEPARATOR;
/*Enter if file exist*/
if($request->hasFile('file')){
/*Modification in the name and extension*/
$file = $request->file('file');
$filename = $file->getclientOriginalName();
$filename = pathinfo($filename, PATHINFO_FILENAME);
$name_file = str_replace(" ", "_", $filename);
$extension = $file->getClientOriginalExtension();
/*Redacción o revisión*/
if($input['posicion'] == 1){
$picture = 'Redaccion('.$input['version'].')' . '-' . $name_file . '.' . $extension;
}else{
$picture = 'Revision('.$input['version'].')' . '-' . $name_file . '.' . $extension;
}
/*official root*/
$ruta_oficial = $ruta_server.$input['id_carpeta'].DIRECTORY_SEPARATOR;
/*create and uploadfile*/
$file->move($ruta_oficial, $picture);
return response()->json([
"ok" => true,
"error" => false,
"data" => $picture
]);
}else{
return response()->json([
"ok" => false,
"error" => true,
"mensaje" => "Error Detectado"
]);
}
}
I created a container in docker that simulates the apache server configuration where the project will be uploaded and when testing my function with postman, it doesn't work. Sending the error:
Symfony\Component\HttpFoundation\File\Exception\FileException: Unable to create the "//172.xx.xx.xxx/Prueba/DOCUMENTOS/100-2021/" directory. in file /opt/data/vendor/symfony/http-foundation/File/File.php on line 125
Along with 38 # more bugs.
My project versions:
Laravel: 8.48.0
PHP: 8.0.7
Docker container: FROM php:8.0.7-apache (Linux)
File server (172.xx.xx.xxx): Windows Virtual Server
This is my DockerFile
FROM php:8.0.7-apache
RUN apt-get update
# 1. paauetes dev
RUN apt-get install -y \
git \
zip \
samba \
smbclient \
curl \
sudo \
unzip \
libpq-dev \
libzip-dev \
libicu-dev \
libbz2-dev \
libpng-dev \
libjpeg-dev \
libmcrypt-dev \
libreadline-dev \
libfreetype6-dev \
libsmbclient-dev \
g++ \
libaio1 wget && apt-get clean autoclean && apt-get autoremove --yes && rm -rf /var/lib/{apt,dpkg,cache,log}/
# 2. dir apache
ENV APACHE_HOME /var/www/html
# 3. mod_rewrite for URL rewrite and mod_headers for .htaccess extra headers like Access-Control-Allow-Origin-
RUN a2enmod rewrite headers
# 4. start with base php config, then add extensions
#RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
RUN docker-php-ext-install \
gd\
bz2 \
intl \
iconv \
bcmath \
opcache \
calendar \
# mbstring \
# pdo_mysql \
zip
# 5. composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# ORACLE oci
RUN mkdir /opt/oracle \
&& cd /opt/oracle
ADD http://git.xxx.xxx/bxxxx.xxxx/media/raw/master/IC/instantclient-basic-linux.x64-19.5.0.0.0dbru.zip /opt/oracle
ADD http://git.xxx.xxx/bxxxx.xxxx/media/raw/master/IC/instantclient-sdk-linux.x64-19.5.0.0.0dbru.zip /opt/oracle
# Install Oracle Instantclient
RUN unzip /opt/oracle/instantclient-basic-linux.x64-19.5.0.0.0dbru.zip -d /opt/oracle \
&& unzip /opt/oracle/instantclient-sdk-linux.x64-19.5.0.0.0dbru.zip -d /opt/oracle \
# && ln -s /opt/oracle/instantclient_19_5/libclntsh.so.19.1 /opt/oracle/instantclient_19_5/libclntsh.so \
&& ln -s /opt/oracle/instantclient_19_5/libclntshcore.so.19.1 /opt/oracle/instantclient_19_5/libclntshcore.so \
# && ln -s /opt/oracle/instantclient_19_5/libocci.so.19.1 /opt/oracle/instantclient_19_5/libocci.so \
&& rm -rf /opt/oracle/*.zip
ENV LD_LIBRARY_PATH /opt/oracle/instantclient_19_5:${LD_LIBRARY_PATH}
# Install Oracle extensions
RUN echo 'instantclient,/opt/oracle/instantclient_19_5/' | pecl install oci8-3.0.1 \
&& docker-php-ext-enable \
oci8 \
&& docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/opt/oracle/instantclient_19_5,19.5 \
&& docker-php-ext-install \
pdo_oci
RUN mkdir -p /opt/data/public && \
rm -r /var/www/html && \
ln -s /opt/data/public $APACHE_HOME
WORKDIR $APACHE_HOME

Bash scripts return a substring not whole value in column for psql

I want to get the value of message in db, which for example is "the error is missing index " but when I run the code belong, it only return me 'the' for error_type. How could this happen that only return me the first word but not the whole value of the query result? How can I get the query results with the whole value?
declare -a ROW=($(psql \
-X \
-U $DB_USER \
-h $DB_HOST \
-d $DB_NAME \
-p $DB_PORT \
--single-transaction \
--set AUTOCOMMIT=off \
--set ON_ERROR_STOP=on \
--no-align \
-t \
--field-separator ' ' \
--quiet \
-c "SELECT message
FROM error_message
WHERE created_at > '$t1' and created_at < '$t'")
)
error_type=${ROW[0]}
echo $error_type
Don't use an array, use an ordinary string variable to contain the whole result.
error_type=$(psql \
-X \
-U $DB_USER \
-h $DB_HOST \
-d $DB_NAME \
-p $DB_PORT \
--single-transaction \
--set AUTOCOMMIT=off \
--set ON_ERROR_STOP=on \
--no-align \
-t \
--field-separator ' ' \
--quiet \
-c "SELECT message
FROM error_message
WHERE created_at > '$t1' and created_at < '$t'")
echo "$error_type"
Remember to quote variables unless you need word splitting and wildcard expansion to be done.

Submit multiple json payloads with curl

I am working with the confluent kafka, zookeeper in docker. I successfully submit a json file to kafka topic then consume as follow
curl -X POST \
-H "Content-Type: application/json" \
--data '{"name": "quickstart-file-source", "config {"connector.class":"org.apache.kafka.connect.file.FileStreamSourceConnector", "tasks.max":"1", "topic":"quickstart-data", "file": "/tmp/quickstart/input.json"}}' \
http://localhost:28081/connectors
Above curl command has only one json file which executes successfully but I need to post multiple json files. Is there any way to do it?
Here is my kafka connect
docker run -d \
--name=kafka-connect-avro \
--net=host \
-e CONNECT_BOOTSTRAP_SERVERS=localhost:29091 \
-e CONNECT_REST_PORT=28081 \
-e CONNECT_GROUP_ID="quickstart-avro" \
-e CONNECT_CONFIG_STORAGE_TOPIC="quickstart-avro-config" \
-e CONNECT_OFFSET_STORAGE_TOPIC="quickstart-avro-offsets" \
-e CONNECT_STATUS_STORAGE_TOPIC="quickstart-avro-status" \
-e CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR=1 \
-e CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR=1 \
-e CONNECT_STATUS_STORAGE_REPLICATION_FACTOR=1 \
-e CONNECT_KEY_CONVERTER="org.apache.kafka.connect.json.JsonConverter" \
-e CONNECT_VALUE_CONVERTER="org.apache.kafka.connect.json.JsonConverter" \
-e CONNECT_INTERNAL_KEY_CONVERTER="org.apache.kafka.connect.json.JsonConverter" \
-e CONNECT_INTERNAL_VALUE_CONVERTER="org.apache.kafka.connect.json.JsonConverter" \
-e CONNECT_REST_ADVERTISED_HOST_NAME="localhost" \
-e CONNECT_LOG4J_ROOT_LOGLEVEL=DEBUG \
-v /tmp/quickstart/file:/tmp/quickstart \
confluentinc/cp-kafka-connect:latest
Reference link
You could make individual JSON files in the current directory and post them separately in a loop
e.g.
$ ls *.json # list your connectors
payload1.json
payload2.json
And then loop over them
for f in `ls *.json`; do
curl -X POST -H "Content-Type: application/json" \
--data#${f} http://localhost:28081/connectors
done
Or simpler to use cat

How can I get Elasticsearch running on CoreOS?

I've a CoreOS cluster with three servers (on Digital Ocean), at this moment running MongoDB. Now I want to start Elasticsearch on this cluster with 1 replica (not using the Mongo river).
I followed the description as outlined here.
Resulting in two services, elasticsearch#.service & elasticsearch-discovery#.service.
elasticsearch#.service
[Unit]
Description=ElasticSearch service
After=etcd.service
After=docker.service
Before=elasticsearch-discovery#%i.service
Requires=elasticsearch-discovery#%i.service
[Service]
KillMode=none
TimeoutStartSec=0
TimeoutStopSec=360
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill %p-%i
ExecStartPre=-/usr/bin/docker rm %p-%i
ExecStartPre=-/usr/bin/bash -c "echo PreKill and rm done;"
ExecStartPre=/usr/bin/mkdir -p /data/elasticsearch
ExecStartPre=/usr/bin/docker pull dockerfile/elasticsearch
ExecStartPre=/usr/bin/bash -c "echo mkdir and docker pull done;"
ExecStart=/bin/bash -c "\
echo StartingUp; \
curl -f ${COREOS_PUBLIC_IPV4}:4001/v2/keys/services/elasticsearch; \
if [ $? = 0 ]; then \
UNICAST_HOSTS = $(etcdctl ls --recursive /services/elasticsearch | sed 's/\/services\/elasticsearch\///g' | sed 's/$/:9300/' | paste -s -d ','); \
echo Key found; \
else \
UNICAST_HOSTS=''; \
echo No Key found; \
fi;"
ExecStartPost=/bin/bash -c "\
echo Starting Docker; \
/usr/bin/docker run \
--name %p-%i \
--publish 9200:9200 \
--publish 9300:9300 \
--volume /data/elasticsearch:/data \
dockerfile/elasticsearch \
/elasticsearch/bin/elasticsearch \
--node.name=%p-%i \
--cluster.name=nvssearch \
--network.publish_host=${COREOS_PUBLIC_IPV4} \
--discovery.zen.ping.multicast.enabled=false \
--discovery.zen.ping.unicast.hosts=$UNICAST_HOSTS;"
ExecStop=/bin/bash/ -c "/usr/bin/docker kill %p-%i"
Restart=on-failure
[X-Fleet]
X-Conflicts=%p#*.service
elasticsearch-discovery#.service
[Unit]
Description=ElasticSearch discovery service
BindsTo=elasticsearch#%i.service
After=elasticsearch#%i.service
[Service]
EnvironmentFile=/etc/environment
ExecStart=/bin/bash -c '\
while true; do \
curl -f ${COREOS_PUBLIC_IPV4}:9200; \
if [ "$?" = "0" ]; then \
etcdctl set /services/elasticsearch/${COREOS_PUBLIC_IPV4} \ '{"http_port": 9200, "transport_port": 9300}\' --ttl 60; \
else \
etcdctl rm /services/elasticsearch/${COREOS_PUBLIC_IPV4}; \
fi; \
sleep 45; \
done'
ExecStop=/usr/bin.etcdctl rm /services/elasticsearch/${COREOS_PUBLIC_IPV4}
[X-Fleet]
X-ConditionMachineOf=elasticsearch#%i.service
But if I try to run the service (fleetctl submit / load / start elasticsearch#1.service), it immediately dies:
elasticsearch#1.service 475f6273.../IP inactive dead
Running fleetctl journal elasticsearch#1 results in the following message:
Mar 17 09:17:04 nvs-1 systemd[1]: Stopped ElasticSearch service.
That's all, no echoes I've added (to the service) are shown, or whatsoever. Anyone any ideas on how to get me further?
It is somewhat simpler to get Elasticsearch running with Weave. My blog post shows how to run it on Vagrant, however moving the same setup to cloud should be pretty straight-forward.
I've followed the same article you did and ran into the same issue. I tracked it down to the docker container not being available anymore, so I change the docker run command in the elasticsearch#service unit:
[Unit]
Description=ElasticSearch service
After=docker.service
Requires=docker.service
[Service]
TimeoutSec=180
EnvironmentFile=/etc/environment
ExecStartPre=/usr/bin/mkdir -p /data/elasticsearch
ExecStartPre=/usr/bin/docker pull elasticsearch
ExecStart=/bin/bash -c '\
curl -f ${COREOS_PRIVATE_IPV4}:4001/v2/keys/services/elasticsearch; \
if [ "$?" = "0" ]; then \
UNICAST_HOSTS=$(etcdctl ls --recursive /services/elasticsearch \
| sed "s/\/services\/elasticsearch\///g" \
| sed "s/$/:9300/" \
| paste -s -d","); \
else \
UNICAST_HOSTS=""; \
fi; \
/usr/bin/docker run \
--rm \
--name %p-%i \
--publish 9200:9200 \
--publish 9300:9300 \
--volume /data/elasticsearch:/data \
elasticsearch \
--node.name=%p-%i \
--cluster.name=logstash \
--network.publish_host=${COREOS_PRIVATE_IPV4} \
--discovery.zen.ping.multicast.enabled=false \
--discovery.zen.ping.unicast.hosts=$UNICAST_HOSTS'
ExecStop=/usr/bin/docker stop %p-%i
ExecStop=/usr/bin/docker rm %p-%i
[X-Fleet]
X-Conflicts=%p#*.service
Apart from that I think, on your original post, you're missing some quotes, double quotes and have some wrong blank spaces.
This is my current elastic-discovery#service for reference:
[Unit]
Description=ElasticSearch discovery service
BindsTo=elasticsearch#%i.service
[Service]
EnvironmentFile=/etc/environment
ExecStart=/bin/bash -c '\
while true; do \
curl -f ${COREOS_PRIVATE_IPV4}:9200; \
if [ "$?" = "0" ]; then \
etcdctl set /services/elasticsearch/${COREOS_PRIVATE_IPV4} \'{"http_port": 9200, "transport_port": 9300}\' --ttl 60; \
else \
etcdctl rm /services/elasticsearch/${COREOS_PRIVATE_IPV4}; \
fi; \
sleep 45; \
done'
ExecStop=/usr/bin/etcdctl rm /services/elasticsearch/${COREOS_PRIVATE_IPV4}
[X-Fleet]
X-ConditionMachineOf=elasticsearch#%i.service

Resources