Browse Source

v2: updated readme and makefile

master
narnaud 2 years ago
parent
commit
525fb9828f
  1. 15
      Makefile
  2. 57
      README.md
  3. 6
      srcs/bonus/hexo/academia_config.yml

15
Makefile

@ -1,17 +1,17 @@
NAME = inception
DATA_FOLDER = /home/narnaud/data
DATA_FOLDER = /home/$(USER)/data
CERT = $(DATA_FOLDER)/ssl/inception.pem
all: prune start
all: clean start
domain:
echo "127.0.0.1 narnaud.42.fr" >> /etc/hosts
echo "127.0.0.1 $(USER).42.fr" >> /etc/hosts
$(CERT):
mkdir -p $(DATA_FOLDER)/ssl
openssl req -newkey rsa:4096 -x509 -sha256 -days 365 -nodes \
-out inception.pem -keyout inception.pem \
-subj "/C=FR/ST=Nice/L=Nice/O=42/OU=student/CN=inception_narnaud/"
-subj "/C=FR/ST=Nice/L=Nice/O=42/OU=student/CN=inception_$(USER)/"
start: $(CERT)
BUILDKIT_PROGRESS=plain docker compose -f srcs/docker-compose.yml up --build
@ -19,13 +19,12 @@ start: $(CERT)
stop:
docker compose -f srcs/docker-compose.yml down
prune: stop
clean: stop
docker system prune -f
fclean: prune
docker system prune -af
docker system prune -af --volumes
re: fclean start
.PHONY: domain start stop fclean prune all
.PHONY: domain start stop clean fclean all

57
README.md

@ -3,41 +3,50 @@
Projet 42:
Sujet: Conteneuriser un serveur web qui hebergera wordpress localement à l'aide de docker, alpine/debian, nginx et mariadb
## Todo:
- use variables folders name for volumes and domain
- add a bonus
- add a ftp server
- add login/register/admin buttons in wordpress
## Instructions:
### Setup it:
Create a `.env` file in `srcs` folder whith this content and fullfill empty variables.
Create a `.env` file in `srcs` folder with settings you want.
e.g:
```
MYSQL_HOST=mariadb
MYSQL_ROOT_PWD=
WP_DATABASE_NAME=wordpress
WP_DATABASE_USR=maria
WP_DATABASE_PWD=
WP_URL=localhost/wordpress
DOMAIN=narnaud.42.fr
#DOMAIN=localhost
WP_TITLE=Inception
WP_ADMIN_USR=admin
WP_ADMIN_PWD=
WP_ADMIN_EMAIL=
WP_USR=
WP_PWD=
WP_EMAIL=
WP_ADMIN_USR=theboss
WP_ADMIN_PWD=thebossword
WP_ADMIN_EMAIL=theboss@mail.com
WP_USR=narnaud
WP_PWD=narnaudword
WP_EMAIL=narnaud@student.42nice.fr
MYSQL_ROOT_PWD=mariadbword
WP_DATABASE_NAME=wordpressdb
WP_DATABASE_USR=wordpress
WP_DATABASE_PWD=wordpressword
GITEA_DATABASE_NAME=giteadb
GITEA_DATABASE_USR=gitea
GITEA_DATABASE_PWD=giteaword
GITEA_ADMIN_USR=theboss
GITEA_ADMIN_PWD=thebossword
GITEA_ADMIN_MAIL=theboss@mail.com
FTP_USR=ftpuser
FTP_PWD=ftpuserword
```
### Start it:
If you want to use a custom domain as local host, modify the Makefile HOST variable and `make domain`.
If you want to use a custom domain as local host, modify the Makefile DOMAIN variable and `make domain`.
To custom static page content, just edit `srcs/bonus/hexo/*_conf.yml` files with what you what to use before build.
To build and start, `make` into git root.
`make` to build and start.
`make clean` to cleanup unused datas.
`make fclean` to wipe all.
`sudo make wipe` to wipe all servers datas.
### Use it:
For acces to homepage, visit `localhost` or your domain url (`DOMAIN_URL`) from your browser.
For acces to wordpress, click on blog in homepage or acces `DOMAIN_URL/wordpress`.
For acces to adminer, acces `DOMAIN_URL/wordpress/adminer.php`
You can access all services except ftp server from the homepage.
To access ftp, connect using ftp://FTP_USER@localhost:21 and the FTP_PWD with your favourite ftp client.

6
srcs/bonus/hexo/academia_config.yml

@ -12,9 +12,9 @@ since: 2022
# 可以选择外链或其他页面
menu:
Publications: /#Publications
Blog: /
Gitea: /
Adminer: /
Blog: / #edited in start.sh
Gitea: / #edited in start.sh
Adminer: / #edited in start.sh
About: /
# flink picture will load if avator link calls on error

Loading…
Cancel
Save