Skip to content
Permalink
Browse files

#1 #10 improved docker-compose

  • Loading branch information...
mnvx committed Mar 10, 2019
1 parent a80fb6b commit 32cf1d815d74861481865caab5cb631c040a626e
Showing with 26 additions and 24 deletions.
  1. +19 −4 database/seeds/UserSeeder.php
  2. +3 −20 docker-compose.yml
  3. +3 −0 docker/php/entrypoint.sh
  4. +1 −0 readme.md
@@ -17,16 +17,13 @@ class UserSeeder extends Seeder
*/
public function run()
{
// User
DB::beginTransaction();
try {
$name = 'admin';
$email = 'admin@admin';
$password = Hash::make('admin');
/** @var RoleRepositoryEloquent $roleRepo */
$roleRepo = app(AppServiceProvider::ROLE_REPOSITORY);
$roles = $roleRepo->all()->pluck('name')->toArray();
/** @var EloquentUserService $userService */
$userService = app(AppServiceProvider::ELOQUENT_USER_SERVICE);
/** @var \App\User $user */
@@ -35,6 +32,24 @@ public function run()
'email' => $email,
'password' => $password,
]);
DB::commit();
}
catch (\Throwable $e) {
DB::rollback();
if (!($e instanceof QueryException && $e->getCode() == 23505)) {
throw $e;
}
return;
}
// Roles
DB::beginTransaction();
try {
/** @var RoleRepositoryEloquent $roleRepo */
$roleRepo = app(AppServiceProvider::ROLE_REPOSITORY);
$roles = $roleRepo->all()->pluck('name')->toArray();
$user->syncRoles($roles);
DB::commit();
@@ -1,8 +1,8 @@
version: "3.3"

volumes:

code: {}
db: {}

services:

@@ -20,31 +20,14 @@ services:
- php
restart: unless-stopped

cron:
container_name: gitpab-cron
build:
context: .
dockerfile: docker/php/Dockerfile
volumes:
- code:/var/www/html
- ./docker/cron/crontab:/etc/cron.d/app
environment:
GITLAB_PRIVATE_TOKEN: ${token}
GITLAB_RESTRICTIONS_PROJECT_IDS: ${projects}
GITLAB_HOST: ${host}
APP_LOCALE: en
links:
- php
restart: unless-stopped
entrypoint: cron -f

php:
container_name: gitpab-php
build:
context: .
dockerfile: docker/php/Dockerfile
volumes:
- code:/var/www/html
- ./docker/cron/crontab:/etc/cron.d/app
environment:
GITLAB_PRIVATE_TOKEN: ${token}
GITLAB_RESTRICTIONS_PROJECT_IDS: ${projects}
@@ -58,7 +41,7 @@ services:
container_name: gitpab-db
image: postgres
volumes:
- /data/gitpab/postgres:/var/lib/postgresql
- db:/var/lib/postgresql
environment:
POSTGRES_DB: gitpab
POSTGRES_USER: gitpab
@@ -37,5 +37,8 @@ init_project
setup_db
load_data

log "Start cron"
service cron start

log "Start php-fpm"
php-fpm
@@ -130,6 +130,7 @@ Just rebuild container

```bash
git pull
docker volume rm -f gitpab_code # https://github.com/docker/compose/issues/5772
export host="https://gitlab.com/" \
&& export token="your_gitlab_private_token" \
&& export projects="project_id1,project_id2" \

0 comments on commit 32cf1d8

Please sign in to comment.
You can’t perform that action at this time.