Skip to content

Instantly share code, notes, and snippets.

View Kyborg2011's full-sized avatar
🏠
Working from home

Anton Babinin Kyborg2011

🏠
Working from home
View GitHub Profile
@Kyborg2011
Kyborg2011 / symfony-regenerate-bootstrap-php-cache.sh
Created July 6, 2017 09:12
Symfony regenerate bootstrap.php.cache
# For Symfony 2.3+
vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
@Kyborg2011
Kyborg2011 / permissions-setup.sh
Created July 6, 2017 09:12
Change all files and folders permissions of a directory to 644/755
find * -type d -print0 | xargs -0 chmod 0755 # for directories
find . -type f -print0 | xargs -0 chmod 0644 # for files
@Kyborg2011
Kyborg2011 / git-reset.sh
Created July 6, 2017 09:13
Resetting git repository
git reset --hard
@Kyborg2011
Kyborg2011 / restart-autoload-composer.sh
Created July 6, 2017 09:13
After deleting some controllers from Symfony 3
# step 1
composer self-update
# step 2
composer dump-autoload
@Kyborg2011
Kyborg2011 / docker-gitlab-ce-useful.sh
Last active July 6, 2017 14:12
Docker + GitLab - useful commands
# recursively find the amount stored in directories (with depth 1)
sudo du -h / -d 1
# clearing of every unused Docker containers
# ( finded from: http://stackoverflow.com/questions/32723111/how-to-remove-old-and-unused-docker-images )
docker rm -v $(docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null
docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null
# making backup of Docker (docker-ce deploying as Docker container)
docker exec -i gitlab-container-name /opt/gitlab/bin/gitlab-rake gitlab:backup:create
@Kyborg2011
Kyborg2011 / docker-startup.sh
Last active July 29, 2019 01:38
Docker + GitLab - startup
#!/bin/bash
# Run docker nginx-proxy container
docker run -d -p 80:80 -p 443:443 \
-v /home/anton/ssl-keys:/etc/nginx/certs \
-v /etc/letsencrypt/archive:/etc/letsencrypt/archive:ro \
-v /etc/letsencrypt/live:/etc/letsencrypt/live:ro \
-v /var/run/docker.sock:/tmp/docker.sock:ro \
jwilder/nginx-proxy
@Kyborg2011
Kyborg2011 / bash-wait-function.sh
Created July 6, 2017 09:16
Some experiments on Bash
#!/bin/bash
first=25601
step=100
while [ $first -lt 130900 ]
do
./app/console app:patients:load --default_pathname="$first" --default_filename="$step" & wait $!
first=$(($first+$step))
done
sudo docker-compose up -d
# docs say we should run reconfigure at least once
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-cal reconfigure
# lets check everything is working after first up
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-rake gitlab:check SANITIZE=true
# restore backup now
sudo docker cp 1460934678_gitlab_backup.tar dockerinfrastructure_gitlab_1:/var/opt/gitlab/backups
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-ctl stop unicorn
sudo docker exec dockerinfrastructure_gitlab_1 gitlab-ctl stop sidekiq
sudo docker exec dockerinfrastructure_gitlab_1 chmod -R 775 /var/opt/gitlab/backups
@Kyborg2011
Kyborg2011 / docker-gitlab-postgres-error-after-upgrade.sh
Created July 7, 2017 15:13
Docker + Gitlab-CE: migrations did not complete problem
# It seems the migrations did not complete. Did you run reconfigure again to see if this gets resolved?
# Also check gitlab-rake db:migrate:status. You can try to run the migrations manually with gitlab-rake db:migrate.
# Make sure postgres is running.
gitlab-rake db:migrate
@Kyborg2011
Kyborg2011 / docker-gitlab-ce-backup.sh
Created July 10, 2017 10:08
Docker + Gitlab-CE backup
docker exec -t <your container name> gitlab-rake gitlab:backup:create