diff --git a/data/infra/database_pg/.gitignore b/data/infra/database_pg/.gitignore new file mode 100755 index 00000000..d6b7ef32 --- /dev/null +++ b/data/infra/database_pg/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/data/infra/db.Dockerfile b/data/infra/db.Dockerfile deleted file mode 100644 index a17b488a..00000000 --- a/data/infra/db.Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM mysql:5.7 -MAINTAINER Alejandro Celaya - -# Enable remote access (default is localhost only, we change this -# otherwise our database would not be reachable from outside the container) -RUN sed -i -e"s/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/" /etc/mysql/my.cnf diff --git a/data/infra/nginx.Dockerfile b/data/infra/nginx.Dockerfile deleted file mode 100644 index e3d90df9..00000000 --- a/data/infra/nginx.Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM nginx:1.11.6-alpine -MAINTAINER Alejandro Celaya - -# Delete default nginx vhost -RUN rm /etc/nginx/conf.d/default.conf diff --git a/data/infra/php.Dockerfile b/data/infra/php.Dockerfile index e0e2c104..19454a48 100644 --- a/data/infra/php.Dockerfile +++ b/data/infra/php.Dockerfile @@ -28,6 +28,9 @@ RUN docker-php-ext-install zip RUN apk add --no-cache --virtual libpng-dev RUN docker-php-ext-install gd +RUN apk add --no-cache postgresql-dev +RUN docker-php-ext-install pdo_pgsql + # Install redis extension ADD https://github.com/phpredis/phpredis/archive/$PREDIS_VERSION.tar.gz /tmp/phpredis.tar.gz RUN mkdir -p /usr/src/php/ext/redis\ diff --git a/data/infra/swoole.Dockerfile b/data/infra/swoole.Dockerfile index e77c2d56..1695e82c 100644 --- a/data/infra/swoole.Dockerfile +++ b/data/infra/swoole.Dockerfile @@ -27,6 +27,9 @@ RUN docker-php-ext-install zip RUN apk add --no-cache --virtual libpng-dev RUN docker-php-ext-install gd +RUN apk add --no-cache postgresql-dev +RUN docker-php-ext-install pdo_pgsql + # Install redis extension ADD https://github.com/phpredis/phpredis/archive/$PREDIS_VERSION.tar.gz /tmp/phpredis.tar.gz RUN mkdir -p /usr/src/php/ext/redis\ diff --git a/docker-compose.override.yml.dist b/docker-compose.override.yml.dist index 6e40c113..ec9d24da 100644 --- a/docker-compose.override.yml.dist +++ b/docker-compose.override.yml.dist @@ -1,4 +1,4 @@ -version: '2' +version: '3' services: shlink_php: @@ -12,3 +12,15 @@ services: volumes: - /etc/passwd:/etc/passwd:ro - /etc/group:/etc/group:ro + + shlink_db: + user: 1000:1000 + volumes: + - /etc/passwd:/etc/passwd:ro + - /etc/group:/etc/group:ro + + shlink_db_postgres: + user: 1000:1000 + volumes: + - /etc/passwd:/etc/passwd:ro + - /etc/group:/etc/group:ro diff --git a/docker-compose.yml b/docker-compose.yml index 3424d925..5d60a061 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,17 +1,15 @@ -version: '2' +version: '3' services: shlink_nginx: container_name: shlink_nginx - build: - context: . - dockerfile: ./data/infra/nginx.Dockerfile + image: nginx:1.15.9-alpine ports: - "8000:80" volumes: - ./:/home/shlink/www - ./docs:/home/shlink/www/public/docs - - ./data/infra/vhost.conf:/etc/nginx/conf.d/shlink-vhost.conf + - ./data/infra/vhost.conf:/etc/nginx/conf.d/default.conf links: - shlink_php @@ -25,6 +23,7 @@ services: - ./data/infra/php.ini:/usr/local/etc/php/php.ini links: - shlink_db + - shlink_db_postgres shlink_swoole: container_name: shlink_swoole @@ -37,12 +36,11 @@ services: - ./:/home/shlink links: - shlink_db + - shlink_db_postgres shlink_db: container_name: shlink_db - build: - context: . - dockerfile: ./data/infra/db.Dockerfile + image: mysql:5.7 ports: - "3307:3306" volumes: @@ -51,3 +49,16 @@ services: environment: MYSQL_ROOT_PASSWORD: root MYSQL_DATABASE: shlink + + shlink_db_postgres: + container_name: shlink_db_postgres + image: postgres:10.7-alpine + ports: + - "5433:5432" + volumes: + - ./:/home/shlink/www + - ./data/infra/database_pg:/var/lib/postgresql/data + environment: + POSTGRES_PASSWORD: root + POSTGRES_DB: shlink + PGDATA: /var/lib/postgresql/data/pgdata