2026-02-24 20:44:16 +00:00
|
|
|
|
# Production Makinası kurulumu
|
|
|
|
|
|
|
|
|
|
|
|
## VS Code -> Extensions kısmında "Docker" kurulmalıdır.
|
|
|
|
|
|
|
|
|
|
|
|
## VS Code -> Extensions kısmında "Save as Root in Remote" kurulmalıdır.
|
|
|
|
|
|
|
|
|
|
|
|
## VS Code üzerinden SSH parolası sabitleme (Firewall ve SSH)
|
|
|
|
|
|
|
|
|
|
|
|
- Windows Terminal üzerinde ssh_keygen komutu çalıştırılır.
|
|
|
|
|
|
- C:\Users\sedat.ozturk\.ssh klasörün altında id_rsa ve id_rsa.pub isimli 2 dosya oluşturur.
|
|
|
|
|
|
- C:\Users\sedat.ozturk\.ssh dosyasının içerisindeki id_rsa.pub dosyasının içeriğini ~/.ssh klasöründeki authorized_keys içeriğine kopyalanır.
|
|
|
|
|
|
- Bu sayede VS Code üzerinden bağlanırken her defasında ssh paroları yazmak durumunda olmayız.
|
|
|
|
|
|
|
|
|
|
|
|
## Docker kurulumu
|
|
|
|
|
|
|
|
|
|
|
|
- sudo apt update
|
|
|
|
|
|
- sudo apt install apt-transport-https ca-certificates curl software-properties-common
|
|
|
|
|
|
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
|
|
|
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
|
|
|
|
- sudo apt update
|
|
|
|
|
|
- apt-cache policy docker-ce
|
|
|
|
|
|
- sudo apt install docker-ce
|
|
|
|
|
|
- sudo systemctl status docker
|
|
|
|
|
|
- sudo usermod -aG docker ${USER}
|
|
|
|
|
|
- su - ${USER}
|
|
|
|
|
|
- sudo reboot
|
|
|
|
|
|
- sudo su
|
|
|
|
|
|
- cd /etc/docker
|
|
|
|
|
|
- touch daemon.json
|
|
|
|
|
|
daemon.json dosyasının içerisine aşağıdaki satırlar eklenecek.
|
|
|
|
|
|
{
|
|
|
|
|
|
"insecure-registries": ["devops.sozsoft.com"]
|
|
|
|
|
|
}
|
|
|
|
|
|
- /etc/hosts dosyası açılacak ve içerisine `192.168.0.2 devops.sozsoft.com` eklenecek
|
|
|
|
|
|
- sudo systemctl restart docker
|
|
|
|
|
|
- docker login devops.sozsoft.com
|
|
|
|
|
|
|
|
|
|
|
|
## Sertifika alma
|
|
|
|
|
|
|
|
|
|
|
|
- DevOps makinasının ${USER} klasöründeyer alan ssl klasörü ("sozsoft.com") download edilecek
|
|
|
|
|
|
- ~/ home klasörüne ssl klasörü kopyalacaktır.
|
|
|
|
|
|
- ~/sozsoft.com klasöründe `chmod 775 *` çalıştırılacaktır.
|
|
|
|
|
|
- `ssh-keygen` komutu çalıştırılır ve .ssh klasörünün altına `id_` ile başlayan 2 dosya oluşacak. `.pub` uzantılı dosyanın içeriği kopyalanacak ve https://devops.sozsoft.com/sozsoft/sozsoft-platform/settings/keys `Add deploy key` butonuna basarak eklenecektir.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Git Kurulumu
|
|
|
|
|
|
|
|
|
|
|
|
- cd ~
|
|
|
|
|
|
- git config --global http.sslVerify false
|
|
|
|
|
|
- git clone https://devops.sozsoft.com/sozsoft/sozsoft-platform.git
|
|
|
|
|
|
- cd sozsoft-platform/
|
|
|
|
|
|
- git config core.fileMode false
|
|
|
|
|
|
- chmod 775 *
|
|
|
|
|
|
- cd configs/deployment
|
|
|
|
|
|
- chmod 775 *
|
|
|
|
|
|
- cd configs
|
|
|
|
|
|
- chmod 775 *
|
|
|
|
|
|
- cd ..
|
|
|
|
|
|
- cd scripts
|
|
|
|
|
|
- chmod 775 *
|
|
|
|
|
|
- cd ~/sozsoft-platform
|
|
|
|
|
|
|
|
|
|
|
|
## Deploy
|
|
|
|
|
|
|
|
|
|
|
|
- cd ~/sozsoft-platform/configs/deployment
|
|
|
|
|
|
- docker compose -f docker-compose-data.yml up -d
|
|
|
|
|
|
- cd ~/sozsoft-platform/configs/deployment/scripts
|
2026-10-17 18:51:10 +00:00
|
|
|
|
- ./5-production-deploy.sh # deploy/app.sh production: pull -> up -d (konteynerler önceden durdurulmaz)
|
|
|
|
|
|
- ./6-production-migrator-true.sh
|
|
|
|
|
|
|
|
|
|
|
|
### UI konteyneri ve host nginx
|
|
|
|
|
|
|
|
|
|
|
|
UI imajı `vite preview` yerine nginx ile servis eder (`ui/Sozsoft.Platform.Ui.Dockerfile`,
|
|
|
|
|
|
`ui/nginx/default.conf`). Cache-Control başlıkları, SPA fallback'i ve `sitemap.xml`/`robots.txt`
|
|
|
|
|
|
proxy'si konteynerin içindedir; eski sürüm chunk'ları `ui-assets` volume'unda birikir (deploy sonrası
|
|
|
|
|
|
açık sekmeler "eksik js" hatası almaz; `docker logs sozsoft-ui | grep arşiv`).
|
|
|
|
|
|
|
|
|
|
|
|
Host'taki ters vekil (`configs/deployment/configs/nginx.conf`) başlıkları ezmez; `sozsoft.com`
|
|
|
|
|
|
bloğundaki eski `location = /index.html` / `location = /sw.js` blokları kaldırıldı. Sunucudaki kopya
|
|
|
|
|
|
depodan farklıysa yalnızca o iki bloğu silmek yeterlidir:
|
|
|
|
|
|
|
|
|
|
|
|
- sudo cp ~/sozsoft-platform/configs/deployment/configs/nginx.conf /etc/nginx/sites-available/
|
|
|
|
|
|
- sudo nginx -t && sudo systemctl reload nginx
|
|
|
|
|
|
|
|
|
|
|
|
Doğrulama:
|
|
|
|
|
|
|
|
|
|
|
|
- curl -sI https://sozsoft.com/index.html | grep -i cache-control # no-store
|
|
|
|
|
|
- curl -sI https://sozsoft.com/sw.js | grep -i cache-control # no-store
|
|
|
|
|
|
- curl -sI https://sozsoft.com/assets/js/<entry-*.js> | grep -i cache-control # immutable
|
|
|
|
|
|
- curl -sI https://sozsoft.com/sitemap.xml | head -1 # 200 (API üretir)
|