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
Related
I'm creating a Docker image where I use sed to modify two parameters, but when i create the images and check the file I wanted to modify it remanis the same. If i run the very sed command interactively, i t works. Why? Could sombebody help me make ma image work without having to modify every container.
Dockerfile
FROM python:slim-buster
WORKDIR /home/scr_dca
COPY . .
ENV FLASK_APP Screenly.py
RUN apt-get update && \
apt install curl gnupg -y && \
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
apt-get update && ACCEPT_EULA=Y apt-get install msodbcsql17 unixodbc-dev -y && \
apt-get install libgssapi-krb5-2 g++ gcc && \
pip3 install -r requirements.txt --trusted-host pypi.python.org
RUN sed -i "s/\(MinProtocol *= *\).*/\1TLSv1.0 /" "/etc/ssl/openssl.cnf" && \
sed -i "s/\(CipherString *= *\).*/\1DEFAULT#SECLEVEL=1 /" "/etc/ssl/openssl.cnf"
CMD ["gunicorn", "-b", ":8000", "scr_dca:app"]
I'm doing
docker run --name mycontainer -d -p 5050:8000 src_dca_v1.0
docker container exec -it mycontainer bash
:/home/myapp# cat /etc/ssl/openssl.cnf
I checked and sed didnt work during the image creation so I ran the following commands:
sed -i "s/\(MinProtocol *= *\).*/\1TLSv1.0 /" "/etc/ssl/openssl.cnf"
sed -i "s/\(CipherString *= *\).*/\1DEFAULT#SECLEVEL=1 /" "/etc/ssl/openssl.cnf"
original part of the file I want to modify:
[system_default_sect]
MinProtocol = TLSv1.2
CipherString = #SECLEVEL=1
sed expected result
[system_default_sect]
MinProtocol = TLSv1.0
CipherString = DEFAULT#SECLEVEL=1
I suspect there is something you are not seeing or that you did not explain/describe in your question. As is, I cannot reproduce your problem.
My MCVE, inspired by your current question to test:
FROM python:slim-buster
RUN cp /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.ORI && \
sed -i "s/\(MinProtocol *= *\).*/\1TLSv1.0 /" "/etc/ssl/openssl.cnf" && \
sed -i "s/\(CipherString *= *\).*/\1DEFAULT#SECLEVEL=1 /" "/etc/ssl/openssl.cnf" && \
(diff -u /etc/ssl/openssl.cnf.ORI /etc/ssl/openssl.cnf || exit 0)
Note: I ignored diff exit status and force it to 0, as it will exit with status 1 when there is a difference between the files which would fail the build.
And the result:
$ docker build --no-cache -t test:test .
Sending build context to Docker daemon 4.096kB
Step 1/2 : FROM python:slim-buster
---> 3d8f801fc3db
Step 2/2 : RUN cp /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.ORI && sed -i "s/\(MinProtocol *= *\).*/\1TLSv1.0 /" "/etc/ssl/openssl.cnf" && sed -i "s/\(CipherString *= *\).*/\1DEFAULT#SECLEVEL=1 /" "/etc/ssl/openssl.cnf" && (diff -u /etc/ssl/openssl.cnf.ORI /etc/ssl/openssl.cnf || exit 0)
---> Running in 523ddc0f4025
--- /etc/ssl/openssl.cnf.ORI 2020-01-09 16:21:44.667348574 +0000
+++ /etc/ssl/openssl.cnf 2020-01-09 16:21:44.675348574 +0000
## -358,5 +358,5 ##
system_default = system_default_sect
[system_default_sect]
-MinProtocol = TLSv1.2
-CipherString = DEFAULT#SECLEVEL=2
+MinProtocol = TLSv1.0
+CipherString = DEFAULT#SECLEVEL=1
Removing intermediate container 523ddc0f4025
---> 88c28529ceb5
Successfully built 88c28529ceb5
Successfully tagged test:test
As you can see, diff is showing the differences before/after running sed and the modifications you are expecting are there.
We can also make sure those modifications persist when starting a container from this image:
$ docker run -it --rm --name testcmd test:test bash -c "grep -A 2 '\[system_default_sect\]' /etc/ssl/openssl.cnf"
[system_default_sect]
MinProtocol = TLSv1.0
CipherString = DEFAULT#SECLEVEL=1
I need to create a directory in root directory of Linux if it's not already present in it.So i am using the if [-d "$/root/folder" ]; but it's going to else part even if directory exist. Please help with this. Below is the code-
#! /bin/sh
if [ -d "$/root/folder" ];then
echo "folder file already exist"
else
echo "Settings in progress" \
&& mkdir folder \
&& chmod 7777 folder \
&& cd folder \
&& mkdir FolderConnector \
&& chmod 7777 FolderConnector \
&& cd FolderConnector \
&& mkdir ClientInput \
&& mkdir ClientOutput \
&& chmod 7777 ClientInput \
&& chmod 7777 ClientOutput \
&& cat /home/data/RTV/file2 >>/etc/exports \
&& exportfs -r \
&& exportfs \
&& echo "Settings completed successfully."
fi
What I would do :
#! /bin/sh
set -e
if [ -d "/root/folder" ]; then
echo "folder file already exist"
else
echo "Settings in progress"
mkdir folder
chmod 7777 folde
cd folder
mkdir FolderConnector
chmod 7777 FolderConnector
cd FolderConnector
mkdir ClientInput
mkdir ClientOutput
chmod 7777 ClientInput
chmod 7777 ClientOutput
cat /home/data/RTV/file2 >>/etc/exports
exportfs -r
exportfs
echo "Settings completed successfully."
fi
set -e stop the script on the first error
you had a $ character in your test
I am having a problem accessing external exadata database from docker.
Docker File:
FROM centos:7.3.1611
WORKDIR /tmp
ADD . /tmp
ENV http_proxy=<added>
ENV https_proxy=<added>
ENV RHEL_FRONTEND=noninteractive
ENV ORACLE_INSTANTCLIENT_MAJOR=12.2
ENV ORACLE_INSTANTCLIENT_VERSION=12.2.0.1.0
ENV ORACLE=/usr
ENV ORACLE_HOME=$ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib
ENV C_INCLUDE_PATH=$C_INCLUDE_PATH:$ORACLE/include/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64
RUN yum update && yum install -y libaio1 \
curl rpm2cpio cpio \
&& mkdir $ORACLE && TMP_DIR="$(mktemp -d)" && cd "$TMP_DIR" \
&& oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-basic-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o basic.rpm \
&& rpm2cpio basic.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf ./* \
&& ln -s libclntsh.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libclntsh.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& ln -s libocci.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libocci.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-devel-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o devel.rpm \
&& rpm2cpio devel.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf "$TMP_DIR" \
&& echo "$ORACLE_HOME/lib" > /etc/ld.so.conf.d/oracle.conf && chmod o+r /etc/ld.so.conf.d/oracle.conf && ldconfig \
&& rm -rf /var/lib/apt/lists/* && apt-get purge -y --auto-remove curl rpm2cpio cpio
RUN pip --no-cache-dir install Flask==0.12.2
ENV SHELL /bin/bash
EXPOSE 80
# WORKDIR /docker
ENTRYPOINT ["python"]
CMD ["app.py"]
Error:returned a non-zero code: 1
Can anyone help me to resolve this?
The build command fails when executing the below command:
RUN yum update && yum install -y libaio1 \
curl rpm2cpio cpio \
&& mkdir $ORACLE && TMP_DIR="$(mktemp -d)" && cd "$TMP_DIR" \
&& oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-basic-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o basic.rpm \
&& rpm2cpio basic.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf ./* \
&& ln -s libclntsh.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libclntsh.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& ln -s libocci.so.12.1 $ORACLE/lib/oracle/$ORACLE_INSTANTCLIENT_MAJOR/client64/lib/libocci.so.$ORACLE_INSTANTCLIENT_MAJOR \
&& oracle-instantclient$ORACLE_INSTANTCLIENT_MAJOR-devel-$ORACLE_INSTANTCLIENT_VERSION-1.x86_64.rpm -o devel.rpm \
&& rpm2cpio devel.rpm | cpio -i -d -v && cp -r usr/* $ORACLE && rm -rf "$TMP_DIR" \
&& echo "$ORACLE_HOME/lib" > /etc/ld.so.conf.d/oracle.conf && chmod o+r /etc/ld.so.conf.d/oracle.conf && ldconfig \
&& rm -rf /var/lib/apt/lists/* && apt-get purge -y --auto-remove curl rpm2cpio cpio
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
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