Skip to content

unsektor/dotudash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

118 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotudash

A Symfony project created on July 28, 2016, 1:44 pm.

Персональный веб-сайт Михаила Драгункина.


dotudash is built on top of:

  • php 8.4 / symfony 7
  • node.js11 / npm6 / bower / gulp / webpack

Static files managed by:

  • imagemagick
  • optipng
  • wkhtmltopdf

Usage

There are two methods of running an application: docker way and classic (native).

Run (Docker way)

There are two environments to deploy an application with docker: production, development.

Run application in production environment:

docker compose -f compose.yaml -f compose.prod.yaml up -d

Note

After containers built in production environment, any files modification in local directories are not reflected into any container, as files there are isolated. For consistent changes use development environment.

Run application in development environment:

docker compose -f compose.yaml -f compose.dev.yaml up -d

Run (Classic way)

Setup

Frontend development requires few dependencies to be installed once.

Install global requirements:

npm install -g bower gulp npm-run-all webpack

Install frontend application requirements:

npm install
bower install

Install backend application requirements:

composer install

Build

Build frontend assets:

npm run build

To rebuild frontend each time on project files change:

npm run dev

Optionally: backend application cache warmup:

./bin/console cache:warmup

Deploy

For static data processing is better to proxy traffic via nginx, with configuration for example:

Nginx configuration example
server {
  listen 80;
  server_name "dotudash" "*.dotudash";
  root        ".../dotudash/web";

  if ($host = 'static.dotudash') {
    rewrite ^/(?!bundles|static|\.well-known) http://dotudash/ permanent;
  }

  location / {
    try_files $uri /app_dev.php$is_args$args;  // (!) note the environment specific application entrypoint 
  }

  location ~ ^/app_dev\.php(/|$) {
    proxy_set_header  Host             $host;
    proxy_set_header  X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_set_header  X-Real-IP        $remote_addr;

    proxy_pass http://127.0.0.1:8000;  // php-fpm
    internal;
  }

  location ~ /\. {
    # deny all;
  }
}

Initialization

When the project is first run, initialization is necessary:

  1. Initialize database:
    ./bin/console doctrine:database:create
    ./bin/console doctrine:schema:create
    
    # fill database with test content:
    # ./bin/console doctrine:fixtures:load --no-interaction
    
    # ./bin/console doctrine:migration:migrate --no-interaction
  2. Dump vendor assets into public shared directory (required for admin section of web-site):
    ./bin/console assets:install

Render résumé pdf file

wkhtmltopdf \
    -s A4 -O Portrait --zoom 0.95 \
    http://dotudash/résumé/d8901cd7-d347-46bc-8c72-3147fc5a59e7 \
    ./web/media/main/résumé/résumé.pdf

Note

This method requires application to be launched

About

Personal web-site project

Resources

License

Stars

Watchers

Forks

Packages

No packages published