Skip to content

Instantly share code, notes, and snippets.

@heartshare
heartshare / getPosts.php
Created September 27, 2024 15:04 — forked from chrispian/getPosts.php
Import WordPress posts, categories, and tags to a Laravel table
<?php
/*
* NOTES:
*
* - This was designed for my personal use and could be more robust.
* - Make sure to update the tables you want to import into.
* - Make sure to update the website url you want to import from.
* - Customize as needed. I had very few posts and no media.
*
*/
# SETUP #
DOMAIN=example.com
PROJECT_REPO="[email protected]:example.com/app.git"
AMOUNT_KEEP_RELEASES=5
RELEASE_NAME=$(date +%s--%Y_%m_%d--%H_%M_%S)
RELEASES_DIRECTORY=~/$DOMAIN/releases
DEPLOYMENT_DIRECTORY=$RELEASES_DIRECTORY/$RELEASE_NAME
# stop script on error signal (-e) and undefined variables (-u)
#!/bin/bash
# Define the output file
output_file="combined.md"
# Remove the output file if it exists to avoid including it in the search
if [ -f "$output_file" ]; then
rm "$output_file"
fi
@heartshare
heartshare / mysql_check.sh
Created August 28, 2024 02:58 — forked from rothkj1022/mysql_check.sh
Script for checking and repairing MySQL databases & tables, including corrupted InnoDB tables
#!/bin/bash
# set mysql into innodb recovery mode on startup
mode=1; sed -i "/^\[mysqld\]/{N;s/$/\ninnodb_force_recovery=$mode/}" /etc/my.cnf
# restart mysql
systemctl restart mysqld
# remove recovery mode setting
sed -i '/innodb_force_recovery/d' /etc/my.cnf
FROM node:20.15.1 as frontend_build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
WORKDIR /app
RUN npm install -g terser uglifycss autoprefixer postcss sass
COPY ./mapas/src/package.json /app
COPY ./mapas/src/pnpm-*.yaml /app
@heartshare
heartshare / Dockerfile
Created August 26, 2024 06:51 — forked from qolarnix/Dockerfile
Dockerfile for frankenphp local wp
FROM dunglas/frankenphp:latest-php8.2
# install the PHP extensions we need (https://make.wordpress.org/hosting/handbook/handbook/server-environment/#php-extensions)
RUN install-php-extensions \
bcmath \
exif \
gd \
intl \
mysqli \
zip \
@heartshare
heartshare / setup.md
Created August 26, 2024 06:48 — forked from semivori/setup.md
copilot symfony docker w frankenphp

Sure, here is the final Docker configuration for a Symfony 7.0 project with PHP 8.2, MySQL, Adminer, and FrankenPHP, including the necessary PHP extensions and a command for database creation.

First, the Dockerfile:

# Dockerfile
FROM php:8.2-fpm

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
@heartshare
heartshare / laravel-octane-docker.md
Created August 26, 2024 06:47 — forked from fabioassuncao/laravel-octane-docker.md
Docker configuration for Laravel projects with Octane, supporting Open Swoole, Swoole, RoadRunner, and FrankenPHP.

Laravel Octane Docker

Extremely simple Docker setup for Laravel projects with Laravel Octane, using the following application servers:

  • Open Swoole
  • Swoole
  • RoadRunner
  • FrankenPHP

Docker Images

@heartshare
heartshare / 00-laravel-deploy.sh
Created August 26, 2024 06:46 — forked from mathieutu/00-laravel-deploy.sh
Old Laravel Docker prod conf with richarvey image
# scripts/00-laravel-deploy.sh
php artisan route:cache
php artisan view:cache
php artisan config:cache
php artisan migrate --force
@heartshare
heartshare / Dockerfile
Created August 26, 2024 06:43 — forked from mathieutu/Dockerfile
Laravel Production Dockerfile using frankenphp.
# syntax=docker/dockerfile:1.4
FROM node:21-alpine AS front
WORKDIR /usr/src/app
COPY --link package.json yarn.lock .yarnrc.yml ./
COPY --link .yarn .yarn
RUN yarn install
COPY --link tailwind.config.ts postcss.config.cjs vite.config.ts tsconfig.json tsconfig.node.json ./
COPY --link resources resources
RUN yarn build