Skip to content

Commit 9ed768b

Browse files
authored
Merge pull request #137 from protochron/docker-compose
Add docker-compose file for dev
2 parents 46fc9a9 + 7a87e19 commit 9ed768b

File tree

12 files changed

+163
-7
lines changed

12 files changed

+163
-7
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Dockerfile
2+
.git
3+
.env.dev
4+
.gitlab-ci.yml
5+
*.md

.env.dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copy this file to .env file for development, create environment variables when deploying to production
33
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
44

5-
SITE_NAME=Gundeals.dev
5+
SITE_NAME=gundeals.local
66
NO_REPLY_ADDRESS="no-reply@example.com"
77
APP_LOCALE=en
88

@@ -18,7 +18,7 @@ APP_SECRET="GUNDEALS DEV! THIS MUST NOT BE USED IN PROD OR LIZURDS!"
1818
# Change the username, password, host, database name and server version
1919
# according to your setup. Don't even think about trying another kind of
2020
# database, it won't work
21-
DATABASE_URL=pgsql://gundealsdev:sendit@localhost:5432/gundeals?serverVersion=9.6
21+
DATABASE_URL=pgsql://dev:dev@postgres:5432/gundeals?serverVersion=9.6
2222
###< doctrine/doctrine-bundle ###
2323

2424
###> symfony/swiftmailer-bundle ###

README.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
**Notice**: New Fork of Postmill for gundeals.io project.
1+
**Notice**: New Fork of Postmill for gundeals.io project.
22
Lets see what we can do ladies an gents!
33
Message @TKsM151 in OUR discord to become a collaborator/dev team member.
44

55
***
66

77
# ![](docs/assets/postmill-128.png) Postmill
88

9-
**Postmill** is a free, web-based, social link aggregator with voting and threaded comments.
9+
**Postmill** is a free, web-based, social link aggregator with voting and threaded comments.
1010
It is built on the [Symfony](https://symfony.com/) framework.
1111

1212
## Requirements
@@ -19,15 +19,30 @@ It is built on the [Symfony](https://symfony.com/) framework.
1919

2020
Before you start hacking - run `git config --global --edit` and set up your name correctly, please.
2121
We also recommend you forward your SSH client to your github from you computer instead of storing any keys on devbox directly.
22-
(You will need to setup .ssh forwarding in .ssh/config on your local machine).
22+
(You will need to setup .ssh forwarding in .ssh/config on your local machine).
2323

2424
* Image linked in Discord should provide everything you need, make sure to pull latest master branch.
2525
* Then simply Run `cp .env.dev .env; sudo bin/console server:run *:80` to start the application.
26-
* Navigate to <http://YOURBOXIP:80/>. Log in with:
27-
* gundealsdev
26+
* Navigate to <http://YOURBOXIP:80/>. Log in with:
27+
* gundealsdev
2828
* senditree
2929
9. dbname and pass is in .env file
3030

31+
## Development in docker-compose
32+
33+
There is a docker-compose file in the main directory that will let you run everything locally from the repo.
34+
35+
To get started:
36+
37+
1. install Docker
38+
2. run `docker-compose up` from the main directory
39+
40+
If you don't have php or node handy:
41+
* run `scripts/assets.sh && scripts/vendor.sh`
42+
* `docker-compose run php bash -c './bin/console assets:install'`
43+
* `docker-compose run php bash -c './bin/console assets:install'`
44+
* `docker-compose run php bash -c './bin/console doctrine:migrations:migrate'`
45+
3146
## License
3247

3348
The software is released under the zlib license. See the `LICENSE` file for

docker-compose.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: "3.3"
2+
services:
3+
nginx:
4+
build: docker/nginx
5+
image: gundeals-nginx:latest
6+
networks:
7+
- gundealsnet
8+
ports:
9+
- "8080:80"
10+
volumes:
11+
- ./:/var/www/html
12+
php:
13+
build: docker/php
14+
image: gundeals-php:latest
15+
ports:
16+
- 9000:9000
17+
networks:
18+
- gundealsnet
19+
volumes:
20+
- ./:/var/www/html:cached
21+
- ./docker/php/php-overrides.ini:/etc/php/7.2/fpm/conf.d/99-overrides.ini
22+
- ./.env.dev:/var/www/html/.env
23+
working_dir: /var/www/html
24+
postgres:
25+
image: postgres:9.6.8
26+
networks:
27+
- gundealsnet
28+
ports:
29+
- 5432:5432
30+
environment:
31+
POSTGRES_USER: dev
32+
POSTGRES_PASSWORD: dev
33+
networks:
34+
gundealsnet:

docker/nginx/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM nginx
2+
3+
RUN rm -f /etc/nginx/conf.d/default.conf
4+
ADD nginx.conf /etc/nginx/
5+
ADD gundeals.local /etc/nginx/sites-available/gundeals.conf
6+
RUN ln -s /etc/nginx/sites-available/gundeals.conf /etc/nginx/conf.d/default.conf
7+
RUN usermod -u 1000 www-data
8+
9+
CMD ["nginx"]

docker/nginx/gundeals.local

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
root /var/www/html/public;
5+
6+
location / {
7+
try_files $uri /index.php$is_args$args;
8+
}
9+
10+
11+
location ~ \.php {
12+
fastcgi_pass php:9000;
13+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
14+
include fastcgi_params;
15+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
16+
fastcgi_param DOCUMENT_ROOT $realpath_root;
17+
fastcgi_param HTTPS off;
18+
}
19+
20+
error_log /var/log/nginx/gundeals_error.log;
21+
access_log /var/log/nginx/gundeals_error.log;
22+
}

docker/nginx/nginx.conf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
user www-data;
2+
worker_processes 4;
3+
pid /run/nginx.pid;
4+
5+
events {
6+
worker_connections 2048;
7+
multi_accept on;
8+
use epoll;
9+
}
10+
11+
http {
12+
server_tokens off;
13+
sendfile on;
14+
tcp_nopush on;
15+
tcp_nodelay on;
16+
keepalive_timeout 15;
17+
types_hash_max_size 2048;
18+
include /etc/nginx/mime.types;
19+
default_type application/octet-stream;
20+
access_log off;
21+
error_log off;
22+
gzip on;
23+
gzip_disable "msie6";
24+
include /etc/nginx/conf.d/*.conf;
25+
include /etc/nginx/sites-enabled/*;
26+
open_file_cache max=100;
27+
}
28+
29+
daemon off;

docker/php/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM php:7.2-fpm-stretch
2+
3+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
4+
libpq-dev libcurl4-openssl-dev libpng-dev zlib1g-dev && \
5+
pecl install apcu_bc-1.0.4 && \
6+
docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql && \
7+
docker-php-ext-install pdo pdo_pgsql pgsql && \
8+
docker-php-ext-enable apcu && \
9+
docker-php-ext-install curl iconv gd opcache && \
10+
rm -r /var/lib/apt/lists/* /tmp/*

docker/php/php-overrides.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
opcache.max_accelerated_files = 20000
2+
realpath_cache_size=4096K
3+
realpath_cache_ttl=600
4+
php_admin_flag[log_errors] = on
5+
php_flag[display_errors] = on

scripts/assets.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
docker run --rm -it \
3+
-v $PWD:/home/node/app -w /home/node/app \
4+
node:8 bash -c 'npm install && npm run build-dev'

scripts/install_deps.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
add-apt-repository -y ppa:ondrej/php
4+
add-apt-repository -y "deb https://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main"
5+
curl -L https://www.postgresql.org/media/keys/ACCC4CF8.asc 2>/dev/null | apt-key add -
6+
7+
apt-get update && apt-get install -y \
8+
php7.2-cli \
9+
php7.2-curl \
10+
php7.2-fpm \
11+
php7.2-intl \
12+
php7.2-pgsql \
13+
composer \
14+
nginx \
15+
nodejs \
16+
postgresql-client-9.6 \
17+
postgresql-contrib-9.6 \
18+
postgresql-common \
19+
libpq-dev # TODO I don't think this is the right version

scripts/vendor.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
docker run --rm -it \
3+
-v $PWD:/app \
4+
composer install --ignore-platform-reqs --no-scripts

0 commit comments

Comments
 (0)