lot of small changes in makefile and conf files, but ssl doesnt work so far
This commit is contained in:
51
Makefile
51
Makefile
@@ -35,9 +35,15 @@ VOLUMES = v_wp_site \
|
|||||||
|
|
||||||
CONTAINERS = $(IMAGES:%=my%)
|
CONTAINERS = $(IMAGES:%=my%)
|
||||||
|
|
||||||
|
SUDO =
|
||||||
|
|
||||||
|
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
# use 'make' to launch and relaunch the project #
|
||||||
|
# use 'make re' to relaunch and clean the dungling images #
|
||||||
|
# use 'make fre' to start all over again (images) #
|
||||||
|
# use 'make super-clean' if you want to delete all dockers on com- #
|
||||||
|
# puter even if not related to the project #
|
||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
|
||||||
|
|
||||||
all: build $(VOLUMES_D) up
|
all: build $(VOLUMES_D) up
|
||||||
@@ -46,60 +52,53 @@ $(VOLUMES_D):
|
|||||||
mkdir -p $(VOLUMES_D)
|
mkdir -p $(VOLUMES_D)
|
||||||
|
|
||||||
build:
|
build:
|
||||||
sudo docker-compose -f $(COMPOSE) build
|
$(SUDO) docker-compose -f $(COMPOSE) build
|
||||||
|
|
||||||
up: $(VOLUMES_D)
|
up: $(VOLUMES_D)
|
||||||
sudo docker-compose -f $(COMPOSE) up -d
|
$(SUDO) docker-compose -f $(COMPOSE) up -d
|
||||||
|
|
||||||
# list images, containers, volumes
|
# list images, containers, volumes
|
||||||
list:
|
list:
|
||||||
@echo $(B_YELLOW)"\nimages:"$(RESET)
|
@echo $(B_YELLOW)"\nimages:"$(RESET)
|
||||||
@sudo docker images -a
|
@$(SUDO) docker images -a
|
||||||
@echo $(B_YELLOW)"\ncontainers:"$(RESET)
|
@echo $(B_YELLOW)"\ncontainers:"$(RESET)
|
||||||
@sudo docker ps -a
|
@$(SUDO) docker ps -a
|
||||||
@echo $(B_YELLOW)"\nvolumes:"$(RESET)
|
@echo $(B_YELLOW)"\nvolumes:"$(RESET)
|
||||||
@sudo docker volume ls
|
@$(SUDO) docker volume ls
|
||||||
@echo ""
|
@echo ""
|
||||||
|
|
||||||
# remove project images
|
# remove project images
|
||||||
rm-images:
|
rm-images:
|
||||||
sudo docker image rm -f $(IMAGES)
|
$(SUDO) docker image rm -f $(IMAGES)
|
||||||
|
|
||||||
# stop project containers
|
# stop project containers
|
||||||
stop:
|
stop:
|
||||||
- sudo docker stop $(CONTAINERS)
|
- $(SUDO) docker stop $(CONTAINERS)
|
||||||
|
|
||||||
# remove project containers
|
# remove all stopped containers and dangling images (dangling images, see : https://projectatomic.io/blog/2015/07/what-are-docker-none-none-images/)
|
||||||
rm-containers: stop
|
prune:
|
||||||
- sudo docker rm $(CONTAINERS)
|
$(SUDO) docker system prune -f
|
||||||
|
|
||||||
# close nginx
|
|
||||||
close-nginx:
|
|
||||||
- sudo nginx -s quit
|
|
||||||
|
|
||||||
# remove project images and containers
|
# remove project images and containers
|
||||||
clean: stop rm-containers close-nginx
|
clean: stop prune
|
||||||
|
|
||||||
# remove project volumes
|
# remove project volumes
|
||||||
rm-volumes:
|
rm-volumes:
|
||||||
- sudo docker volume rm -f $(VOLUMES)
|
- $(SUDO) docker volume rm -f $(VOLUMES)
|
||||||
/bin/rm -rf $(VOLUMES_D)
|
/bin/rm -rf $(VOLUMES_D)
|
||||||
|
|
||||||
# remove project
|
# remove project
|
||||||
fclean: rm-images clean rm-volumes
|
fclean: rm-images clean rm-volumes
|
||||||
|
|
||||||
# remove all containers and related files that are not runnings
|
# remove all dockers, even not related to the project
|
||||||
prune:
|
super-clean:
|
||||||
sudo docker system prune -af --volumes
|
- $(SUDO) docker stop $(sudo docker ps -q)
|
||||||
|
$(SUDO) docker system prune -af --volumes
|
||||||
/bin/rm -rf $(VOLUMES_D)
|
/bin/rm -rf $(VOLUMES_D)
|
||||||
|
|
||||||
# remove all containers and related files
|
re: clean all
|
||||||
fprune:
|
|
||||||
sudo docker stop $(sudo docker ps -q)
|
|
||||||
sudo docker system prune -af --volumes
|
|
||||||
/bin/rm -rf $(VOLUMES_D)
|
|
||||||
|
|
||||||
re: fclean all
|
fre: fclean all
|
||||||
|
|
||||||
.PHONY : all build up $(VOLUMES_D) list rm-images stop rm-containers close-nginx clean rm-volumes fclean prune fprune re
|
.PHONY : all build up $(VOLUMES_D) list rm-images stop rm-containers close-nginx prune clean rm-volumes fclean super-clean re fre
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,8 @@
|
|||||||
- [download alpine linux](https://alpinelinux.org/downloads/)
|
- [download alpine linux](https://alpinelinux.org/downloads/)
|
||||||
- [dockerhub alpine image](https://hub.docker.com/_/alpine)
|
- [dockerhub alpine image](https://hub.docker.com/_/alpine)
|
||||||
- [run without sudo on linux](https://docs.docker.com/engine/install/linux-postinstall/)
|
- [run without sudo on linux](https://docs.docker.com/engine/install/linux-postinstall/)
|
||||||
|
- [run docker deamon rootless](https://docs.docker.com/engine/security/rootless/)
|
||||||
|
- [dangling images '<none>'](https://projectatomic.io/blog/2015/07/what-are-docker-none-none-images/)
|
||||||
|
|
||||||
#### docker :
|
#### docker :
|
||||||
- [docker starter guide](https://docs.docker.com/get-started/)
|
- [docker starter guide](https://docs.docker.com/get-started/)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
#---------------------------------
|
# ---------------------------------
|
||||||
|
|
||||||
test:
|
test:
|
||||||
build:
|
build:
|
||||||
@@ -18,16 +18,18 @@ services:
|
|||||||
image: test
|
image: test
|
||||||
container_name: mytest
|
container_name: mytest
|
||||||
|
|
||||||
#---------------------------------
|
# ---------------------------------
|
||||||
|
|
||||||
nginx:
|
nginx:
|
||||||
|
# restart: on-failure
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
|
- "443:443"
|
||||||
build:
|
build:
|
||||||
context: ./requirements/nginx
|
context: ./requirements/nginx
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
image: nginx
|
image: nginx
|
||||||
container_name: mynginx
|
container_name: mynginx
|
||||||
|
|
||||||
#---------------------------------
|
# ---------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ RUN apt update && apt install -y nginx openssl
|
|||||||
|
|
||||||
# create ssl certificate
|
# create ssl certificate
|
||||||
RUN openssl req -newkey rsa:2048 -nodes -x509 \
|
RUN openssl req -newkey rsa:2048 -nodes -x509 \
|
||||||
-keyout /etc/nginx/cert/hulamy.42.fr.key -out /etc/nginx/cert/hulamy.42.fr.crt \
|
-keyout /etc/ssl/private/hulamy.42.fr.key -out /etc/ssl/certs/hulamy.42.fr.crt \
|
||||||
-subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=inception/CN=hulamy.42.fr"
|
-subj "/C=fr/ST=ile-de-france/L=paris/O=42/OU=inception/CN=hulamy.42.fr"
|
||||||
|
|
||||||
# import sites conf files
|
# import sites conf files
|
||||||
@@ -49,4 +49,4 @@ CMD [ "nginx", "-g", "daemon off;" ]
|
|||||||
# - `nodes` create a private key without encryption (no passphrase needed)
|
# - `nodes` create a private key without encryption (no passphrase needed)
|
||||||
#
|
#
|
||||||
# SO discussion about becomming a real CA to have a certificate that works in deployement : https://stackoverflow.com/questions/10175812/how-to-generate-a-self-signed-ssl-certificate-using-openssl
|
# SO discussion about becomming a real CA to have a certificate that works in deployement : https://stackoverflow.com/questions/10175812/how-to-generate-a-self-signed-ssl-certificate-using-openssl
|
||||||
|
#
|
||||||
|
|||||||
@@ -6,19 +6,19 @@ server {
|
|||||||
location /images/ { root /data; }
|
location /images/ { root /data; }
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
#server {
|
||||||
listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
|
# listen 443 ssl; # for ipv4, on port 443, specifying that accepted connections should works in ssl mode
|
||||||
listen [::]:443 ssl; # for ipv6
|
# listen [::]:443 ssl; # for ipv6
|
||||||
server_name hulamy.42.fr;
|
# server_name hulamy.42.fr;
|
||||||
ssl_certificate /etc/nginx/cert/hulamy.42.fr.crt # specifies the file with the ssl certificate (self signed here) generated by openssl
|
# ssl_certificate /etc/ssl/certs/hulamy.42.fr.crt # specifies the file with the ssl certificate (self signed here) generated by openssl
|
||||||
ssl_certificate-key /etc/nginx/cert/hulamy.42.fr.key # specifies the file with the secret key of the certificate
|
# ssl_certificate_key /etc/ssl/private/hulamy.42.fr.key # specifies the file with the secret key of the certificate
|
||||||
|
#
|
||||||
root /var/www/html; # contains default nginx index.nginx-debian.html
|
# root /var/www/html; # contains default nginx index.nginx-debian.html
|
||||||
index index.html index.htm index.nginx-debian.html index.php; # defines files that will be used as index (https://nginx.org/en/docs/http/ngx_http_index_module.html)
|
# index index.html index.htm index.nginx-debian.html index.php; # defines files that will be used as index (https://nginx.org/en/docs/http/ngx_http_index_module.html)
|
||||||
|
#
|
||||||
location / {
|
# location / {
|
||||||
try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
|
# try_files $uri $uri/ =404; # from /etc/nginx/sites-enabled/default : First attempt to serve request as file, then as directory, then fall back to displaying a 404
|
||||||
# test
|
# # test
|
||||||
root /data/www;
|
# root /data/www;
|
||||||
}
|
# }
|
||||||
}
|
#}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ http { # section for http server directives
|
|||||||
# SSL Settings
|
# SSL Settings
|
||||||
##
|
##
|
||||||
|
|
||||||
ssl_protocols TLSv1.2; # Dropping SSLv3, ref: POODLE # enables the specified protocols. The TLSv1.1 and TLSv1.2 parameters works only when OpenSSL 1.0.1 or higher is used, and the TLSv1.3 only when OpenSSL 1.1.1 or higher is used
|
ssl_protocols TLSv1.3; # Dropping SSLv3, ref: POODLE # enables the specified protocols. The TLSv1.1 and TLSv1.2 parameters works only when OpenSSL 1.0.1 or higher is used, and the TLSv1.3 only when OpenSSL 1.1.1 or higher is used
|
||||||
ssl_prefer_server_ciphers on; # Specifies that server ciphers should be preferred over client ciphers when using the SSLv3 and TLS protocols (a cipher is "an algorithm for performing encryption or decryption, a series of [...] steps that can be followed as a procedure" https://en.wikipedia.org/wiki/Cipher_suite)
|
ssl_prefer_server_ciphers on; # Specifies that server ciphers should be preferred over client ciphers when using the SSLv3 and TLS protocols (a cipher is "an algorithm for performing encryption or decryption, a series of [...] steps that can be followed as a procedure" https://en.wikipedia.org/wiki/Cipher_suite)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
Reference in New Issue
Block a user