docker run --name mynginx1 -p 32768:80 -d nginx
Source: NGINX Docs | Deploying NGINX and NGINX Plus on Docker
docker run --name mynginx1 -p 32768:80 -d nginx
Source: NGINX Docs | Deploying NGINX and NGINX Plus on Docker
In the past year alone, the Docker community has created 100,000+ images and over 300+ million images have been pulled from Docker Hub to date. Over 20 million of these pulls came from the 70+ Official Images that Docker develops in conjunction with upstream partners, like Oracle, CentOS, and NGINX.
NGINX is used by over 40% of the world’s busiest websites and is an open-source reverse proxy server, load balancer, HTTP cache, and web server. The official image on Docker Hub has been pulled over 3.4 million times and is maintained by the NGINX team. This post from NGINX provides a walkthrough on using the Docker Image to deploy the open-source version of NGINX.
Here is a Tutorial on How to use the NGINX Official Docker Image
To create an instance of NGINX in a Docker container, search for and pull the NGINX official image from Docker Hub. Use the following command to launch an instance of NGINX running in a container and using the default configuration.
# docker run --name mynginx1 -P -d nginx fcd1fb01b14557c7c9d991238f2558ae2704d129cf9fb97bb4fadf673a58580d
This command creates a container named mynginx1 based on the NGINX image and runs it in detached mode, meaning the container is started and stays running until stopped but does not listen to the command line. We will discuss later how to interact with the container.
The NGINX image exposes ports 80 and 443 in the container and the -P option tells Docker to map those ports to ports on the Docker host that are randomly selected from the range between 49153 and 65535. We do this because if we create multiple NGINX containers on the same Docker host, we create a conflict on ports 80 and 443. The port mappings are dynamic and are set each time the container is started or restarted. If you want the port mappings to be static, set them manually with the -p option. The long form of the Container Id will be returned.
We can run docker ps to verify that the container was created and is running, and to see the port mappings:
# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES fcd1fb01b145 nginx:latest "nginx -g 'daemon of 16 seconds ago Up 15 seconds 0.0.0.0:49166->443/tcp, 0.0.0.0:49167->80/tcp mynginx1
We can also verify that NGINX is running by making an HTTP request to port 49167 (reported in the output from the preceding command as the port on the Docker host that is mapped to port 80 in the container); the default NGINX welcome page appears:
# curl http://localhost:49167
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
Working with the NGINX Docker Container
Now that we have a working NGINX Docker container, how do we manage the content and the NGINX configuration? And what about logging? It is common to have SSH access to NGINX instances, but Docker containers are generally intended to be for a single purpose (in this case running NGINX) so the NGINX image does not have OpenSSH installed and for normal operations there is no need to get shell access directly to the NGINX container. We will use other methods supported by Docker. For a detailed discussion of alternatives to SSH access, see Why you don’t need to run SSHd in your Docker Containers.
Managing Content and Configuration Files
There are multiple ways you can manage the NGINX content and configuration files and we will cover a few options:
Maintain the Content and Configuration on the Docker Host
When the container is created we can tell Docker to mount a local directory on the Docker host to a directory in the container. The NGINX image uses the default NGINX configuration, so the root directory for the container is/usr/share/nginx/html and the configuration files are in /etc/nginx. If the content on the Docker host is in the local directory /var/www and the configuration files are in /var/nginx/conf, we run the command:
# docker run --name mynginx2 -v /var/www:/usr/share/nginx/html:ro \ -v /var/nginx/conf:/etc/nginx:ro -P -d nginx
Now any change made to the files in the local directories /var/www and /var/nginx/conf on the Docker host are reflected in the directories /usr/share/nginx/html and /etc/nginx in the container. The :ro option causes these directors to be read only inside the container.
Copy the Files from the Docker Host
Another option is to have Docker copy the content and configuration files from a local directory on the Docker host when a container is created. Once a container is created, the files are maintained by creating a new container when the files change or by modifying the files in the container. A simple way to copy the files is to create a Dockerfile to generate a new Docker image, based on the NGINX image from Docker Hub. When copying files in the Dockerfile, the path to the local directory is relative to the build context where the Dockerfile is located. For this example, the content is in the content directory and the configuration files are in the conf directory, both in the same directory as theDockerfile. The NGINX image has the default NGINX configuration files, including default.conf and example_ssl.conf in/etc/nginx/conf.d. Since we want to use the configuration files from the host, we include commands in the followingDockerfile to delete the default files:
FROM nginx RUN rm /etc/nginx/conf.d/default.conf RUN rm /etc/nginx/conf.d/examplessl.conf COPY content /usr/share/nginx/html COPY conf /etc/nginx
We can then create our own NGINX image by running the following command from the directory where the Dockerfileis located:
# docker build -t mynginximage1.
Note the period (“.”) at the end of the command. This tells Docker that the build context is the current directory. The build context contains the Dockerfile and the directories to be copied. Now we can create a container using the image by running the command:
# docker run --name mynginx3 -P -d mynginximage1
If we want to make changes to the files in the container, we use a helper container as described below.
As mentioned previously, we are not able to get SSH access to the NGINX container, so if we want to edit the content or configuration files directly we can use a helper container that has shell access. In order for the helper container to have access to the files, we must create a new image that has the proper volumes specified for the image. Assuming we want to copy the files as in the example above, while also specifying volumes for the content and configuration files, we use the following Dockerfile:
FROM nginx COPY content /usr/share/nginx/html COPY conf /etc/nginx VOLUME /usr/share/nginx/html VOLUME /etc/nginx
We then create the new NGINX image by running the following command (again note the final period):
# docker build -t mynginximage2 .
Now we create an NGINX container using the image by running the command:
# docker run --name mynginx4 -P -d mynginximage2
We then start a helper container with a shell and access the content and configuration directories of the NGINX container we created in the previous example by running the command:
# docker run -i -t --volumes-from mynginx4 --name mynginx4files debian /bin/bash
root@b1cbbad63dd1:/#
This creates an interactive container named mynginx4_files that runs in the foreground with a persistent standard input (-i) and a tty (-t) and mounts all the volumes defined in the container mynginx4 as local directories in the newmynginx4_files container. This container uses the Debian image from Docker Hub, which is the same operating system used by the NGINX image. Since all of the examples shown so far use the NGINX image and therefore Debian, it is more efficient to use Debian for the helper container rather then having Docker load another operating system. After the container is created, it runs the bash shell, which presents a shell prompt for the container that you can use to modify the files as needed. You can also install other tools, such as Puppet or Chef, in the container to manage these files. If you exit the shell by running the exit command, the container terminates. If you want to exit while leaving the container running, use Control-p followed by Control-q. The container can be started and stopped with the following commands:
# docker start mynginx4files
and
# docker stop mynginx4files
Shell access can be regained to a running container with the command:
# docker attach mynginx4files
The NGINX image is configured to send the main NGINX access and error logs to the Docker log collector by default. This is done by linking them to stdout and stderr, which causes all messages from both logs to be stored in the file/var/lib/docker/containers/\<container id\>/\<container id\>-json.log on the Docker Host. \<container id\> is the long-form Container Id returned when you create a container. You can display the long-form Id for a container with the command:
# docker inspect --format '{{ .Id }}' <container name>
You can use both the Docker command line and the Docker Remote API to extract the log messages. From the command line run the command:
# docker logs <container name>
To enable the Docker Remote API, add the following line to the file /etc/default/docker:
DOCKEROPTS='-H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock'
When Docker is restarted, it listens for HTTP API requests on port 4243 (you can specify a different port) and also on a socket. To get all the messages, you can issue the GET request:
http://<docker host>:4243/containers/<container name>/logs?stdout=1&stderr=1
To include only access log messages in the output, include only stdout=1; to limit the output to error log messages, include only stderr=1. To learn about other available options, see the Docker documentation.
If you want to implement another method of log collection, or if you want to configure logging differently at various levels in the NGINX configuration (such as servers and locations), you can use a volume for the directory or directories in which to store the log files in the container. You can then use a helper container to access the log files and use whatever logging tools you like. To implement this, create a new image that contains the volume or volumes for the logging files. For example, to configure NGINX to store log files in /var/log/nginx/log, we start with the Dockerfile shown in the earlier example of copying files from the Docker host to the container and simply add a volume declaration for this directory:
FROM nginx COPY content /usr/share/nginx/html COPY conf /etc/nginx VOLUME /var/log/nginx/log
We can then create an image as described above and using this image create an NGINX container and a helper container that have access to the log directory. This helper container can have any desired logging tools installed.
Since we do not have access to the command line of the NGINX container directly, we cannot use the nginx command to control NGINX. Fortunately NGINX can be controlled by signals and Docker provides kill command for sending signals to a container. For example, to reload the NGINX configuration run the command:
docker kill -s HUP <container name>
If you want to restart the NGINX process, restart the container by running the command:
docker restart <container name>
NGINX and Docker are tools that work extremely well together. By using the NGINX open-source image from the Docker Hub repository, you can easily spin up new instances of NGINX in Docker containers. You can also take these images and easily create new Docker images from them to give you even more control of your containers and how you manage them.
Learn more about NGINX by visiting their website and download the official image from Docker Hub today.
Source: Tips for Deploying NGINX with Docker (Examples) | Docker Blog
<?php
$myObj->name = “John”;
$myObj->age = 30;
$myObj->city = “New York”;
$myJSON = json_encode($myObj);
echo $myJSON;
?>
Source: JSON PHP
In Ubuntu systems running MySQL 5.7 (and later versions), the root MySQL user is set to authenticate using the auth_socket plugin by default rather than with a password. This allows for some greater security and usability in many cases, but it can also complicate things when you need to allow an external program (e.g., phpMyAdmin) to access the user.
In order to use a password to connect to MySQL as root, you will need to switch its authentication method from auth_socket to mysql_native_password. To do this, open up the MySQL prompt from your terminal:
Next, check which authentication method each of your MySQL user accounts use with the following command:
+------------------+-------------------------------------------+-----------------------+-----------+
| user | authentication_string | plugin | host |
+------------------+-------------------------------------------+-----------------------+-----------+
| root | | auth_socket | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| debian-sys-maint | *CC744277A401A7D25BE1CA89AFF17BF607F876FF | mysql_native_password | localhost |
+------------------+-------------------------------------------+-----------------------+-----------+
4 rows in set (0.00 sec)
In this example, you can see that the root user does in fact authenticate using the auth_socket plugin. To configure the root account to authenticate with a password, run the following ALTER USER command. Be sure to change password to a strong password of your choosing, and note that this command will change the root password you set in Step 2:
Then, run FLUSH PRIVILEGES which tells the server to reload the grant tables and put your new changes into effect:
Check the authentication methods employed by each of your users again to confirm that root no longer authenticates using the auth_socket plugin:
+------------------+-------------------------------------------+-----------------------+-----------+
| user | authentication_string | plugin | host |
+------------------+-------------------------------------------+-----------------------+-----------+
| root | *3636DACC8616D997782ADD0839F92C1571D6D78F | mysql_native_password | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| debian-sys-maint | *CC744277A401A7D25BE1CA89AFF17BF607F876FF | mysql_native_password | localhost |
+------------------+-------------------------------------------+-----------------------+-----------+
4 rows in set (0.00 sec)
You can see in this example output that the root MySQL user now authenticates using a password. Once you confirm this on your own server, you can exit the MySQL shell:
Alternatively, some may find that it better suits their workflow to connect to MySQL with a dedicated user. To create such a user, open up the MySQL shell once again:
Note: If you have password authentication enabled for root, as described in the preceding paragraphs, you will need to use a different command to access the MySQL shell. The following will run your MySQL client with regular user privileges, and you will only gain administrator privileges within the database by authenticating:
From there, create a new user and give it a strong password:
Then, grant your new user the appropriate privileges. For example, you could grant the user privileges to all tables within the database, as well as the power to add, change, and remove user privileges, with this command:
Note that, at this point, you do not need to run the FLUSH PRIVILEGES command again. This command is only needed when you modify the grant tables using statements like INSERT, UPDATE, or DELETE. Because you created a new user, instead of modifying an existing one, FLUSH PRIVILEGES is unnecessary here.
Following this, exit the MySQL shell:
Finally, let’s test the MySQL installation.
Software in the Public Interest, Inc. (SPI) is a US 501(c)(3) non-profit organization formed to help other organizations create and distribute free/open-source software and open-source hardware. Anyone is eligible to apply for membership, and contributing membership is available to those who participate in the free software community.
SPI was originally created to allow the Debian Project to accept donations. It now acts as a fiscal sponsor to many free and open source projects.
SPI has hosted Wikimedia Foundation board elections and audited the tally as a neutral third party from 2007–2011.
https://en.wikipedia.org/wiki/Software_in_the_Public_Interest
The closest thing to what you’re looking for is wordgrinder, a terminal-based word processor.
You can install it executing:
sudo apt install wordgrinder
Here is the official website of the project: https://cowlark.com/wordgrinder/
This is the Github repo: https://github.com/davidgiven/wordgrinder
And a quick Survival Guide: https://gist.github.com/davidgiven/1aba97e96a9b8f9b573b
If you check the Importing and Exporting sections you will find:
Imports basic content from ODT files. OpenDocument is complicated and hard to parse but WordGrinder will do its best to apply appropriate styles. Unsupported features are ignored.
This produces an ODT file which can be read by LibreOffice and a variety of other major word processors. Character and paragraph styles are exported and are mapped to OpenDocument styles called P, H1, H2 etc.
Source: 16.04 – How to edit a .odt file from the terminal? – Ask Ubuntu
In celestial mechanics, the Roche limit, also called Roche radius, is the distance within which a celestial body, held together only by its own force of gravity, will disintegrate due to a second celestial body’s tidal forces exceeding the first body’s gravitational self-attraction. Inside the Roche limit, orbiting material disperses and forms rings, whereas outside the limit material tends to coalesce. The term is named after Édouard Roche (pronounced [ʁɔʃ] (French), /rɔːʃ/ rawsh (English)), who was the French astronomer who first calculated this theoretical limit in 1848.
Znači, preostane jedino ono školsko razmatranje:
– svaka perilica prvo ispumpa vodu, smatra se da postoji preostali sadržaj šalica i sl. i to traje 20-30 sek (akustički: laaaaaah laaaaaaah laaaaaah)
– onda utoči svježu vodu otvaranjem niza elektroventila, to je tih zvuk bzzzzzzzzzzzzz i žubor
– nakon što utoči, trebalo bi otvoriti vrata da provjerite da li je vodostaj dostatan, obično je to 1-2 cm od donjeg ruba vrata
Ako ima radni vodostaj, kreće “prava akcija”:
– uključuje glavnu pumpu i to se čuje kako “bičuje” lim energično, dakle akustično žljaaam žljaaam žljaaam
– istodobno uklj. grijač i kad je voda mlačna, dakle nakon par minuta, čuje se udarac kad se oslobodi spremnik i pada tableta
Općenito, ako krene u “akciju” i zbrejka – tada rade samo gl. pumpa i grijač.
Ako gl. pumpa ima neki meh. problem, dakle zastoj ili teško okretanje rotora uslijed prodora iz smjera turbine (ispred motora), onda prekida jer troši previše struje takav motor i optočna pumpa je krivac. Imate novu, ne znam da li za taj tip, u Batis.hr i cijena je između 500 i 1000 kn, zapišite model pa nazovite
http://batis.hr/perilice.php?id=36&vrsta=22&id2=11
to je velik posao za zamijeniti odnosno 2 h minimalno će vam računati servis.
Ako grijač ima neki problem, onda nema očekivane krivulje rasta temp i zbrejka ciklus.
Grijač – da li uklj. ili ne – najlakše izmjeriti nekom spravom
https://www.chipoteka.hr/artikl/8627…821-6071050011
stavite u utičnicu i pratite potrošnju – odvodna pumpa 30 W cca, elektroventili nekoliko puta 2-3 W, ovisno o broju, glavna pumpa 150 W cca i grijač 1500-2000 W.
Ne znam da li to imate u domu – ali to je najviše pristupačna metoda.
I to bi bilo to – onako školski izrečeno…