Openproject: How to set config/configuration.yml in docker environment - configuration

I want to configure the docker version of Open Project with the configuration.yml. Where has the file to be stored or where can I find it. None of the given external directories .asset and .pgconfig contains the yml file.

You can mount single files into your container. So we can adjust the example from the docs like this to include your own configuration.yml:
sudo mkdir -p /var/lib/openproject/{pgdata,assets}
printf "production:\n disable_password_login: true" > /var/lib/openproject/configuration.yml
docker run -d -p 8080:80 --name openproject -e SECRET_KEY_BASE=secret \
-v /var/lib/openproject/pgdata:/var/openproject/pgdata \
-v /var/lib/openproject/assets:/var/openproject/assets \
-v /var/lib/openproject/configuration.yml:/app/config/configuration.yml \
openproject/community:11
This, for instance, will disable the password login in OpenProject via the configuration.yml. Usually you would do this via env variables (-e OPENPROJECT_DISABLE__PASSWORD__LOGIN=true) but there are configurations such as for SAML which are indeed easier to just define in the configuration.yml instead.
The file inside of the container is /app/config/configuration.yml.

Related

Docker create volume for MySQL

I'm starting to use docker implement mysql in our environment. But I have a little bit confuse about it.
1. I have tried to use command, it's working
sudo docker run --name mysql5.7 --restart always --privileged=true -p 4306:3006 -v /Users/user/mysql/config/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf -v /Users/user/mysql/data:/var/lib/mysql -e MYSQL_USER=“usr” -e MYSQL_PASSWORD=“1234” -e MYSQL_ROOT_PASSWORD=“1234” -d mysql:5.7
But follow docker document, they suggest use volume to persist data. So I tried crate a volume first docker volume -d create local mysql_v
try to link mysql to volume mysql_v, but I don't know how to do it and what is different with step 1.
anyone can suggest it ~?
Like
docker run --name mysql5.7 --restart always -p 4306:3006 \
-v /Users/user/mysql/config/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf \
-v mysql_v:/var/lib/mysql \
-e MYSQL_USER=“usr” -e MYSQL_PASSWORD=“1234” \
-e MYSQL_ROOT_PASSWORD=“1234” -d mysql:5.7
Note, privileged removed, that's just asking for trouble
Ref: official documents

How to start a mysql docker container with a dump.sql file in a single command without using docker-compose

I need to start a mysql docker container with an initial dump file or create a mysql docker image with initial data.
I don't need to start docker container first and then execute with the dump file in separate commands. I need to run it using a single command.
So assuming the data contains your sql dump file:
docker run -v "$PWD/data":/docker-entrypoint-initdb.d \
--user 1000:1000 \
--name some-mysql \
-e MYSQL_ROOT_PASSWORD=my-secret-pw \
-d \
mysql:tag
ref: hub

Docker Using a custom MySQL configuration file Always fail

Follow the documentation here,Always fail
Using a custom MySQL configuration file
The default configuration for MySQL can be found in /etc/mysql/my.cnf, which may !includedir additional directories such as /etc/mysql/conf.d or /etc/mysql/mysql.conf.d. Please inspect the relevant files and directories within the mysql image itself for more details.
If /my/custom/config-file.cnf is the path and name of your custom configuration file, you can start your mysql container like this (note that only the directory path of the custom config file is used in this command):
$ docker run --name some-mysql -v /my/custom:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag
This will start a new container some-mysql where the MySQL instance uses the combined startup settings from /etc/mysql/my.cnf and /etc/mysql/conf.d/config-file.cnf, with settings from the latter taking precedence.
Configuration without a cnf file
Many configuration options can be passed as flags to mysqld. This will give you the flexibility to customize the container without needing a cnf file. For example, if you want to change the default encoding and collation for all tables to use UTF-8 (utf8mb4) just run the following:
$ docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
If you would like to see a complete list of available options, just run:
My version Docker version 18.09.7, build 2d0083d
The commands I run
docker run --name mysql2 -v /my/custom:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=root -d mysql:8.0.16
My custom configuration file
[mysqld]
sql_mode="STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
I found the reason. Because I set the mysql.cnf permissions to 777.

Several flume sinks in the same agent.conf file

Is it possible to have several flume's agents (sinks) under the same configuration file (agent.conf)?
I think so. It is a matter of include all the per-sinks configuration in the same agent.conf file. There is an example here.
The preferred way for FIWARE is using Dockers. So, let's imagine we need a Cygnus and we want the data to be "sinked" to MongoDB and MySQL.
A good practice would consist of making a Docker-compose file in order to build the application, but in this case, I'll show how to deploy all dockers needed separately.
We want to deploy a MySQL so Cygnus can store data in it. We can do it this way:
sudo docker run --name mysql_showcases \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=dbcygnus \
-e MYSQL_USER=cygnus \
-e MYSQL_PASSWORD=cygnus \
-e MYSQL_ROOT_HOST='%' \
-p 3306:3306 -it -v /data/mysql:/var/lib/mysql -d -h mysql mysql/mysql-server:5.5
We want to deploy a MongoDB so Cygnus can also store data in it. We can do it this way:
sudo docker run --name mongo_showcases -v /data/mongodb:/data/db -d \
-h mongo mongo:3.6
Finally, we can deploy Cygnus using a Docker linked with both previous dockers:
docker run -d --name cygnus_showcases --link mysql_showcases --link mongo_showcases \
-p 8081:8081 -p 5050:5050 \
-e CYGNUS_MYSQL_HOST=mysql_showcases -e CYGNUS_MYSQL_PORT=3306 \
-e CYGNUS_MYSQL_USER=root -e CYGNUS_MYSQL_PASS=root \
-e CYGNUS_MONGO_HOSTS=mongo_showcases:27017 \
fiware/cygnus-ngsi
So, we've deployed a Docker, using Cygnus which will store data in a MongoDB and a MySQL database. We can also provide more "variables" to configure other sinks to where to store data in.

How to pre-configure and prefill official MySQL docker container?

I want to build a new MySQL image based on the official MySQL docker container image. I want to reduce the number of parameters I need to add when running the image. (eg. -e MYSQL_USER, -e MYSQL_DATABASE and even -e MYSQL_ROOT_PASSWORD='rootsecret')
that already includes my settings for the global variables and my Create Database SQL file in the docker-entrypoint-initdb.d folder.
How do I add all my settings and create a new image to simply docker run mysql:config1 docker run mysql:config2 and so on?
You could build your own mysql docker image using a docker file, configure username, password and everything else you might need, build that image, upload it to the docker hub and then when you launch a new docker container you just use the previously built container.
An example of a Docker file to build an ubuntu image with a mysql server inside would be something like bellow (save it to a file called Dockerfile):
FROM ubuntu:latest
RUN apt-get update \
&& apt-get install -y apt-utils \
&& { \
echo debconf debconf/frontend select Noninteractive; \
echo mysql-community-server mysql-community-server/data-dir \
select ''; \
echo mysql-community-server mysql-community-server/root-pass \
password 'Desired-Password'; \
echo mysql-community-server mysql-community-server/re-root-pass \
password 'Desired-Password'; \
echo mysql-community-server mysql-community-server/remove-test-db \
select true; \
} | debconf-set-selections \
&& apt-get install -y mysql-server mysql-client
Then build your mysql docker container like this (you have to be in the folder where the Docker file was/is saved):
docker build my-ubuntu-mysql-docker
Then you have to push it to the docker hub and then you can use it to start a new docker container like this:
docker run -d -p 2222:22 -p 3306:3306 --name my-ubuntu-mysql-docker ...
Where 2222 is local ssh port mapped to ssh port 22 of the docker container and 3306 is local mysql port mapped to the mysql port of the docker container.
I hope this helps!
The following has to be written into the Dockerfile:
FROM mysql:latest
LABEL Name=mylabel Version=0.0.1
COPY path/to/sh/sql/sql.gz/files /docker-entrypoint-initdb.d
ENV MYSQL_ROOT_PASSWORD='rootpassword'
As stated in the documentation on the official docker website:
When a container is started for the first time, a new database with
the specified name will be created and initialized with the provided
configuration variables. Furthermore, it will execute files with
extensions .sh, .sql and .sql.gz that are found in
/docker-entrypoint-initdb.d. Files will be executed in alphabetical
order.
What you you would want to do is to modify Mysql's image entry point
and please note that you do not need to pass all the parameters, most of them are optional