Docker multiple web sites - docker

My folder structure is:
docker (folder).
wordpress (folder).
wordpress-test (folder).
drupal (folder).
joomla (folder).
Is it possiblle start multiple web site at same time?
for example wordpress and wordpress-test?

i use lando + docker, this tool is easy to start diferents sites at same time...
Example wp: https://github.com/civanmoreno/wp-lando
you can reply repo and change "name: wplando" on lando.yml and start project

Related

Docker vs Apache for client applications

I have a CMS service and I have 400 clients that I serve on my own server and 20 on clients' servers.
CMS is versioned and clients can have different versions (1.1, 1.2, 1.3 etc).
I have a dedicated server with apache2 + php fpm
I put the application versions into the folder: /core/1.1 /core/1.2 /core/1.3 and then create symlinks to the www folders:
/var/www/client1.domain.com/core[symlink] + .env + storage
/var/www/client2.domain.com/core[symlink] + .env + storage
To deploy using: git clone and symlink change in /var/www/*
QUESTION :D
I would like change my architecutre to containers (docker, docker swarm) but I am worried about performance. My propositions:
build image [1.1]
create docker-compose.yml + volume + custom env (with treafik) x 400 instances
or
build image [1.1]
create only one docker-compose.yml with 1.1 version and dynamically adjust volume (how?) for domains.
what do you think about it?
Sorry for my English
One of the benefits of using Docker is to run your apps in an isolated environment so if one of your sites / apps has a problem or crashed you can replace it easily without affecting other sites / apps.
Also you can control resource limits for each app so if there is a corrupted one prevent it from affecting whole host machine.
so in my opinion is to run separate container for each site using docker-compose
you can use traefik or Caddy on top of your containers as a reverse proxy.

How should I containerize my application requiring apache/php/mysql with an authenticated and public site experience?

I’ve spent months building an application and now I’m looking to deploy it, but I’m new to Docker and I seem to have brain block when it comes to actually containerizing my application. I need to run the following technologies:
php 7.2
mysql 5.7
apache 2.4
phpMyAdmin 4.7
My application will need to be available exclusively through https and I’m assuming the connection between my application and the mysql container will also need to be through a secure port.
In addition to that I have a wordpress site that will serve as the pre-login experience for my application that I’d like to dockerize, but should not share the same DB. When I move this to a prod environment, I will not include the phpMyAdmin container.
How many containers do I need? I was thinking that I would need at least 5:
apache
php
mysql (my application)
mysql (wordpress)
phpmyAdmin
Should my application and the worpress site live in the php container? or should I create separate containers for each.
What should my docker-compose.yml file and dockerfiles look like to achieve this feat?
The driving idea here is that a container should contain a single "service". You don't break things into containers by software component (php, apache, etc.) but rather by whatever needs to be combined to create a single service. So if your application is a PHP application hosted by Apache, then you'd want a container for your application that contained PHP, Apache and your application code. That would provide your application as a service.
Same goes for Wordpress. If Wordpress is running behind Apache and needs PHP, you'd create a second container containing PHP, Apache, WordPress, and your WordPress content, producing your "Wordpress service".
Each of your individual databases can be seen as a service, so you might want two containers running MySQL, one serving each of your databases. You could choose to consider the database server as a whole to be a service, and have it serve both of your databases. Then you could get away with a single MySQL container. Which way you go with this is a minor issue. Having a single database server will likely save a little bit of resources by avoiding some duplication.
If all of your services need to talk to each other, the easiest way to do this with Docker is to use Docker Compose. This lets you create multiple containers that know about each other and can communicate very easily between each other by way of some simple DNS logic that Docker Compose provides. With Compose, you give each of your containers a simple name, and then that name can be looked up via DNS to provide the IP address of each container. So for example, if your MySql container was named "mysql", your app container could connect to it via the DNS address "mysql" with no additional work on your part.

Rails, Ember, Redis, nginx and docker

Colleagues, I have a front-end application based on Ember and Rails (running on nginx) which also uses redis as a cache.
I want to dockerize this application, but not sure about best practices. Would it be best to create one container with a dockerfile that pulls in all these pieces, or should each component be in its own container?
For bonus points: I have to retrieve the code from private bitbucket repos and.. how are we meant to store our secrets and other config files when using containers?
So, I'll try my best from a phone,
Secrets are to be kept in environment variables, so you may need to update your application code to work with those.
As for dockerizing, I typically do backend (rails in this case) in one (or more) container(s) and nginx in a single container bundled with a single page app (ember in this case)
So, you should have two dockerfiles total.
Here are some resources that hopefully provide enough to get started:
Dotnet + react: https://github.com/sillsdev/appbuilder-portal/
Modern bleeding edge ember: https://gitlab.com/NullVoxPopuli/emberclear/
Old ember: https://gitlab.com/precognition-llc/aeonvera-ui
Rails: https://gitlab.com/precognition-llc/aeonvera
For the nginx, that first link shows a dotnet core and react app with nginx and has the deployment strategy I've described. For nginx, you'll start with a node container, or the ember-cli image from danlynn (who still hasn't responded to me about getting those on the official ember docketed), and use multistage builds to eventually copy your dist folder to a directory in the nginx container in the last stage.
Hope this helps. I can clarify more if needed.

Desktop entry for dockerized applications

I know that we can package desktop applications inside docker containers This repo of jessfrazilla includes many dockerized desktop applications. But can we create Desktop entries of those applications as shown below.
.
Creating desktop entries means i can start/stop application from Unity dash instead of docker start <container-name>.docker-compose could be the way but i do not know how to do it. Any help would be appreciated.

Two seperate docker php environments one shared mysql

I am SUPER new to Docker and have spent 4-5 hrs trying to figure this out with no luck so I am turning to you docker geniuses.
I currently have multiple websites, each with their own docker container. Each container is a full environment I created using the Docker documentation - PHP, Ubuntu, Mysql, Server (nginx / apache). Though this works, it isn't what I need / want in the long run.
I have a several Laravel sites running php7 and ngnix with mysql. I also have a couple Phalcon php 5.5 containers using apache and mysql. For each site I have a container built from a base like this webdevops then using the exec command went in and added the laravel stuff or Phalcon stuff.
The problem is that many times I need to reference multiple databases as once. The sites aren't linked but I need a quick look at a db from another project. I also need to run a new container for EACH site, which is stupid because all Laravel sites have the EXACT same environment.
What I would love is to have a mysql container with all my databases. A container with my php7 and nginx for ALL my laravel sites and a container with php 5.5 and apache for ALL my Phalcon stuff. This lets me just look at the code in one environment (without running the environment) AND see the tables in the database while running the other environment. Ie running environment container A that has sites 1, 2, 3 mapped and a shared mysql container. So I can see sites 3, 4 databases without running environment container B
I tried creating yaml files in each project and having a shared dir with envrionment dockerfiles but that isn't working. I have used the likes of this, and this and this to try and guide me but no luck.
Can anyone give me some pointers on where to start or help me with a super simple base example of how to do this?
Thanks in advance.

Resources