Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change nginx into apache #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@ SF_COMMUNITY_PATH=./symfony

# Project domains
PROJECT_DOMAIN_1=symfony.local
PROJECT_DOMAIN_2=symfony2.local
PROJECT_DOMAIN_3=symfony3.local
PROJECT_DOMAIN_4=symfony4.local

# Nginx document_root
DOCUMENT_ROOT=public

# Symfony front controller
SYMFONY_FRONT_CONTROLLER=index.php

NGINX_SSL_PATH=./user/nginx/ssl/
NGINX_LOG_PATH=./var/log/nginx/
MONGODB_LOG_PATH=./var/log/mongodb/
MYSQL_DATA_PATH=./var/lib/mysql/
MONGODB_DATA_PATH=./var/lib/mongodb/
Expand Down Expand Up @@ -76,9 +68,8 @@ PMA_AUTO_LOGIN_ROOT=no

# Open ports
PORT_MYSQL=3306
PORT_NGINX=80
PORT_NGINX_SSL=443
PORT_PHP=9000
PORT_WEB=80
PORT_WEB_SSL=443
PORT_MAIL_SMTP=1025
PORT_MAIL_HTTP=8025
PORT_PMA=8080
Expand Down Expand Up @@ -137,7 +128,6 @@ PHP_IDE_CONFIG=serverName=symfony-docker
# Node JS available versions: 16, 18, 20, 20, 21
NODE_JS_VERSION=21

CLEAN_NGINX_LOGS=no
CLEAN_SF_logs=no

# docker-compose.yml configuration
Expand All @@ -164,7 +154,7 @@ PHP_IMAP=no

EXTERNAL_NETWORK=no

RABBITMQ_VERSION=3.12.12
RABBITMQ_VERSION=3.13
ELASTICSEARCH_VERSION=6.8.23
ELK_VERSION=7.16.0
# MongoDB available versions: 4.2.24, 4.4.26, 5.0.23, 6.0.12
Expand Down
71 changes: 0 additions & 71 deletions commands/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var startCmd = &console.Command{
Usage: "",
Action: func(c *console.Context) error {
doChecks()
doBuildNginxConf()
doBuildMySQLConf()
doBuild()
doBeforeStart()
Expand Down Expand Up @@ -132,8 +131,6 @@ func doChecks() {
os.Create(sshKeyPath + "/known_hosts")
}

os.MkdirAll(os.Getenv("NGINX_SSL_PATH"), 0755)
os.Mkdir(os.Getenv("NGINX_LOG_PATH"), 0755)
os.Mkdir(os.Getenv("MYSQL_DATA_PATH"), 0755)
os.Mkdir(os.Getenv("USER_CONFIG_PATH"), 0755)
os.Mkdir(os.Getenv("MONGODB_LOG_PATH"), 0755)
Expand All @@ -149,13 +146,6 @@ func doChecks() {
util.AppendFile(os.Getenv("USER_CONFIG_PATH")+"/.my.cnf", data)
}

if os.Getenv("NGINX_SSL") == "yes" {
if !util.FileExists("user/nginx/ssl/d4d.pem") || !util.FileExists("user/nginx/ssl/d4d-key.pem") {
// ./d4d mkcert ssl
}
}

doNginxBuild()
doPhpBuild()
doPhpMyAdminBuild()

Expand All @@ -181,24 +171,6 @@ func doChecks() {
util.Sed("__MYSQL_PASSWORD__", pmaMySQLPassword, "config/phpmyadmin/config.user.inc.php")
}

func doNginxBuild() {
util.Copy("config/nginx/Dockerfile.build", "config/nginx/Dockerfile")

util.Sed("__DEBIAN_VERSION__", os.Getenv("DEBIAN_VERSION"), "config/nginx/Dockerfile")

if os.Getenv("NGINX_SSL") == "yes" {
os.Mkdir("config/nginx/ssl", 0755)

util.Copy("user/nginx/ssl/d4d.pem", "config/nginx/ssl/d4d.pem")
util.Copy("user/nginx/ssl/d4d-key.pem", "config/nginx/ssl/d4d-key.pem")

util.Sed("__D4D_SSL__", "COPY [\"ssl/d4d.pem\", \"ssl/d4d-key.pem\", \"/etc/nginx/ssl/\"]", "config/nginx/Dockerfile")

} else {
util.Sed("__D4D_SSL__", "", "config/nginx/Dockerfile")
}
}

func doPhpBuild() {
util.Copy("config/php/Dockerfile.build", "config/php/Dockerfile")

Expand Down Expand Up @@ -428,39 +400,6 @@ func remove(haystack []string, needle string) []string {
return haystack
}

func doBuildNginxConf() {
projectConfFile := "config/nginx/project.conf"

if os.Getenv("NGINX_SSL") == "yes" {
util.Copy("config/nginx/project-ssl.conf.default", projectConfFile)
} else {
util.Copy("config/nginx/project.conf.default", projectConfFile)
}

util.Sed("__INCLUDE__", "/etc/nginx/d4d/sf.conf", projectConfFile)
util.Sed("__PHP_MAX_EXECUTION_TIME__", os.Getenv("PHP_MAX_EXECUTION_TIME"), projectConfFile)
util.Sed("__NGINX_FASTCGI_BUFFERS__", os.Getenv("NGINX_FASTCGI_BUFFERS"), projectConfFile)
util.Sed("__NGINX_FASTCGI_BUFFER_SIZE__", os.Getenv("NGINX_FASTCGI_BUFFER_SIZE"), projectConfFile)
util.Sed("__PHP_UPLOAD_MAX_FILESIZE__", os.Getenv("PHP_UPLOAD_MAX_FILESIZE"), projectConfFile)

util.Copy("config/nginx/d4d/pwa.conf.default", "config/nginx/d4d/pwa.conf")
util.Sed("__SYMFONY_FRONT_CONTROLLER__", os.Getenv("SYMFONY_FRONT_CONTROLLER"), "config/nginx/d4d/pwa.conf")

util.Copy("config/nginx/d4d/sf.conf.default", "config/nginx/d4d/sf.conf")
util.Sed("__SYMFONY_FRONT_CONTROLLER__", os.Getenv("SYMFONY_FRONT_CONTROLLER"), "config/nginx/d4d/sf.conf")

util.Copy("config/nginx/d4d/wp.conf.default", "config/nginx/d4d/wp.conf")
util.Sed("__SYMFONY_FRONT_CONTROLLER__", os.Getenv("SYMFONY_FRONT_CONTROLLER"), "config/nginx/d4d/wp.conf")

nginxIncludeCache := ""

if os.Getenv("NGINX_CACHE") == "yes" {
nginxIncludeCache = "include /etc/nginx/d4d/cache.conf;"
}

util.Sed("__INCLUDE_CACHE__", nginxIncludeCache, projectConfFile)
}

func doBuildMySQLConf() {
util.Copy("config/mysql/d4d.cnf.d4d", "config/mysql/d4d.cnf")
util.Sed("__MYSQL_MAX_ALLOWED_PACKET__", os.Getenv("MYSQL_MAX_ALLOWED_PACKET"), "config/mysql/d4d.cnf")
Expand Down Expand Up @@ -527,10 +466,6 @@ func doBuild() {
util.AppendFile("docker-compose.yml", util.FileGetContents("docker/elk.yml"))
}

if os.Getenv("EXTERNAL_NETWORK") == "no" || os.Getenv("EXTERNAL_NETWORK") == "yes" {
util.Sed("__NGINX_NETWORKS__", fmt.Sprintf("networks:\n default:\n aliases:\n - %s", os.Getenv("PROJECT_DOMAIN_1")), "docker-compose.yml")
}

if os.Getenv("EXTERNAL_NETWORK") == "yes" {
util.AppendFile("docker-compose.yml", util.FileGetContents("docker/network.yml"))
}
Expand All @@ -540,12 +475,6 @@ func doBeforeStart() {
envFile := util.GetCurrentDir() + "/.env"
util.LoadEnvFile(envFile)

if os.Getenv("CLEAN_NGINX_LOGS") == "yes" {
if err := os.Truncate("var/logs/nginx/project_access.log", 0); err != nil {
log.Printf("Failed to truncate: %v", err)
}
}

if os.Getenv("CLEAN_SF_logs") == "yes" {
os.RemoveAll("project/var/cache")
os.RemoveAll("project/var/log")
Expand Down
67 changes: 0 additions & 67 deletions config/nginx/Dockerfile.build

This file was deleted.

8 changes: 0 additions & 8 deletions config/nginx/d4d/cache.conf

This file was deleted.

8 changes: 0 additions & 8 deletions config/nginx/d4d/sf.conf.default

This file was deleted.

44 changes: 0 additions & 44 deletions config/nginx/nginx.conf

This file was deleted.

91 changes: 0 additions & 91 deletions config/nginx/project-ssl.conf.default

This file was deleted.

Loading
Loading