Worpress in docker: wrong file permission
In wp-config.pgp
define('FS_CHMOD_DIR', 0777);
8 августа 2024, 14:01
define('FS_CHMOD_DIR', 0777);
select enum_range(null::your_type_name);
sudo apt install postgresql postgresql-contrib
su postgres psql ALTER USER postgres PASSWORD '***';
/usr/share/gitlab-runner/clear-docker-cache
# Add Docker's official GPG key: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
SELECT stuff, count(*) OVER() AS total_count FROM table WHERE .... ORDER BY ... OFFSET 0 LIMIT 10
docker compose up -d
import Knex from "knex"; const knex = Knex({ client: 'pg', connection: process.env.DATABASE_URL, }); const records = [ { id: 2, login: "admin" }, ]; async function upsert() { const result = await knex.raw( `? ON CONFLICT (id) DO UPDATE SET login = EXCLUDED.login, updated_at = CURRENT_TIMESTAMP RETURNING *;`, [knex("users").insert(records)], ); }
pkill -9 -f pattern
???
SELECT 'SELECT SETVAL(' || quote_literal(quote_ident(sequence_namespace.nspname) || '.' || quote_ident(class_sequence.relname)) || ', COALESCE(MAX(' ||quote_ident(pg_attribute.attname)|| '), 1) ) FROM ' || quote_ident(table_namespace.nspname)|| '.'||quote_ident(class_table.relname)|| ';' FROM pg_depend INNER JOIN pg_class AS class_sequence ON class_sequence.oid = pg_depend.objid AND class_sequence.relkind = 'S' INNER JOIN pg_class AS class_table ON class_table.oid = pg_depend.refobjid INNER JOIN pg_attribute ON pg_attribute.attrelid = class_table.oid AND pg_depend.refobjsubid = pg_attribute.attnum INNER JOIN pg_namespace as table_namespace ON table_namespace.oid = class_table.relnamespace INNER JOIN pg_namespace AS sequence_namespace ON sequence_namespace.oid = class_sequence.relnamespace ORDER BY sequence_namespace.nspname, class_sequence.relname;Alternatives List of all sequence
SELECT c.relname FROM pg_class c WHERE c.relkind = 'S' order BY c.relname;Fix sequence (if it's named id)
SELECT concat('SELECT SETVAL(''public.', c.relname,''', COALESCE(MAX(id), 1) ) FROM public.', replace(c.relname, '_id_seq', ''), ';') FROM pg_class c WHERE c.relkind = 'S' order BY c.relname;
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - sudo apt-get install -y nodejs
docker cp <source_path> <container_id>:<destination_path> docker cp <container_id>:<source_path> <destination_path>
openssl rand -base64 32
proxy_cache_path /home/nginx levels=1:2 keys_zone=CACHE:50m max_size=12G inactive=30d; server { server_name example.com; location / { proxy_cache_key "$uri"; proxy_pass https://$path$is_args$args; resolver 8.8.8.8; proxy_cache CACHE; access_log off; expires max; add_header X-Proxy-Cache $upstream_cache_status; proxy_set_header Referer ""; proxy_cache_valid 200 30d; proxy_cache_valid 403 10m; proxy_cache_valid 404 10m; proxy_ssl_server_name on; proxy_ssl_name $proxy_host; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot }
sudo sh -c "echo -n 'sammy:' >> /etc/nginx/.htpasswd" sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
systemctl list-units --type service
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo \ "deb [arch=amd64 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-get update sudo apt-get --assume-yes install docker-ce docker-ce-cli containerd.io
sudo curl -fsSL "https://download.docker.com/linux/ubuntu/gpg" | sudo gpg --dearmor --yes -o /usr/share/keyrings/docker-archive-keyring.gpg sudo chmod a+r /usr/share/keyrings/docker-archive-keyring.gpg
df -hT lsblk growpart /dev/xvda 1 resize2fs /dev/xvda1