Notes taken between: 12-16 November 2018
I've been note-taking everyday since my entry into full-time work; which now amount to a years worth. Usually the only time I go back to look at them is quickly grab some long command I haven't stamped into memory or remind myself of some bespoke undocumented process.
Saying that, I think it might be helpful to start doing end of week summaries (TWIL - This week i learned) which could potentially serve to pinpoint any gaps in my knowledge that needs filling or perhaps help someone out there.
A wall I hit this week was trying to run a Symfony app locally and receiving a:
You have requested a non-existent service
Most likely, someone has added a new service.. or maybe removed one. after failing a composer install and update it was time to try clearing the cache.
php ./app/console cache:clear
This didnt work. It turns out when clearing the cache you need to specify which one:
test, dev etc.. so you would run
php ./app/console cache:clear --env=dev
or you could just run:
rm -rf app/cache/test/
Docker training #1
Run your first container:
docker container run hello-world
the Docker engine running in your terminal tried to find an image named hello-world. Since you just got started there are no images stored locally (Unable to find image...) so Docker engine goes to its default Docker registry, which is Docker Store, to look for an image named “hello-world”. It finds the image there, pulls it down, and then runs it in a container.
A container is an application abstraction: the focus is really on the OS and the application, and not so much the hardware abstraction. (like VMS)
docker image pull alpine
The pull command fetches the alpine image from the Docker registry and saves it in our system.
Great! Let’s now run a Docker container based on this image. To do that you are going to use the docker container run command.
docker container run alpine ls -l
After the ls command finished, the container shut down.
interactive shell where you could type some commands.
docker container run -it alpine /bin/sh
docker container ls -a
a list of all containers that you ran. Notice that the STATUS column shows that these containers exited some time ago.
docker container ls list the running containers.
We can send a command in to the container to run by using the exec command, as follows:
- The file system and configuration of our application which are used to create containers. To find out more about a Docker image, run docker image inspect alpine. In the demo above, you used the docker image pull command to download the alpine image. When you executed the command docker container run hello-world, it also did a docker image pull behind the scenes to download the hello-world image.
- Running instances of Docker images — containers run the actual applications. A container includes an application and all of its dependencies. It shares the kernel with other containers, and runs as an isolated process in user space on the host OS. You created a container using docker run which you did using the alpine image that you downloaded. A list of running containers can be seen using the docker container ls command.
- Docker daemon
- The background service running on the host that manages building, running and distributing Docker containers.
- Docker client
- The command line tool that allows the user to interact with the Docker daemon.
- Docker Store
- Store is, among other things, a registry of Docker images. You can think of the registry as a directory of all available Docker images. You’ll be using this later in this tutorial
using < to redirect input, and > to redirect output.
file1 executes command1, placing the output in file1, as opposed to displaying it at the terminal, which is the usual destination for standard output. This will clobber any existing data in file1.
command1 < file1 executes command1, with file1 as the source of input, as opposed to the keyboard, which is the usual source for standard input.
outfile combines the two capabilities: command1 reads from infile and writes to outfile
To append output to the end of the file, rather than clobbering it, the >> operator is used:
command1 >> file1.
What is a reverse proxy server?
A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client requests to the appropriate backend server. A reverse proxy provides an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers.
Differences Between Forward Proxy and Reverse Proxy. The main difference between the two is that forward proxy is used by the client such as a web browser whereas reverse proxy is used by the server such as a web server. Forward proxyand the client can be in the same internal network, or it can be on the Internet.
What is the use of reverse proxy?
A typical usage of a reverse proxy is to provide Internet users access to a server that is behind a firewall. Reverse proxies can also be used to balance load among several back-end servers, or to provide caching for a slower back-end server.
What is Preg_match in PHP?
PHP has built in functions that allow us to work with regular functions. preg_match – this function is used to perform a pattern match on a string. It returns true if a match is found and false if a match is not found.
And when you say, “my session” you would refer to your entry in the session object. Every user is able to access only their session. The session can be stored on the server, or on the client. If it’s on the client, it will be stored by the browser, most likely in cookies and if it is stored on the server, the session ids are created and managed by the server. So if there are a million users connected to the server, there will also be a million session ids for those users on the server.