AndrewPaglusch / FlashPaper

One-time encrypted password/secret sharing
MIT License
392 stars 62 forks source link

installation process is bit vague #41

Closed 116davinder closed 3 years ago

116davinder commented 3 years ago

can anyone share the proper installation process with nginx, I am trying to create a Dockerfile for it?

Matthew-Jenkins commented 3 years ago

You will need to use php-fpm if you use nginx. If you're running containers, you can either bundle nginx and fpm together in a single container, or you can have nginx be seperate in a pod.

Something like FROM alpine:latest RUN apk update RUN apk add nginx php7 php7-fpm php7-opcache git RUN git clone https://github.com/AndrewPaglusch/FlashPaper.git /flashpaper RUN git clone your_repo_here /your_repo_here ENTRYPOINT /your_repo_here/your_entrypoint_script.sh (spawning nginx and php-fpm)

Matthew-Jenkins commented 3 years ago

Your entrypoint script would be something like

!/bin/bash

nginx -c /your_repo_here/nginx.conf & php-fpm -c /your_repo_here/php-fpm.conf

116davinder commented 3 years ago

Thanks, let me try it and see !

116davinder commented 3 years ago

@Matthew-Jenkins, I am able to do quite a bit now but still unable to start application.

here is what I have done so far $ cat Dockerfile

FROM alpine:latest

RUN apk update

RUN apk add nginx php7 php7-fpm php7-opcache git

RUN git clone https://github.com/AndrewPaglusch/FlashPaper.git /flashpaper

RUN chmod -R 775 /flashpaper

RUN chown -R nginx:nginx /flashpaper

COPY container /container

COPY container/php-fpm.conf /etc/php7/php-fpm.conf

RUN mkdir -p /var/run/nginx && \
    mkdir -p /var/run/php-fpm && \
    chown -R nginx:nginx /var/run/

RUN chmod +x /container/entrypoint.sh

VOLUME ["/flashpaper/data"]

ENTRYPOINT ["/container/entrypoint.sh"]

$ cat container/default.conf

events { }
http {
    server {
        listen 80;
        #server_name  0.0.0.0;

        # note that these lines are originally from the "location /" block
        root   /flashpaper;
        index index.php index.html index.htm;

        location / {
        try_files $uri $uri/ =404;
        }

        location ~ .php$ {
        try_files $uri =404;
        fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        #include fastcgi_params;
        }
    }
}

$ cat container/php-fpm.conf

[www]
user = nginx
group = nginx
listen = 127.0.0.1:9000
listen = /var/run/php-fpm/php-fpm.sock
listen.owner = nginx
listen.group = nginx

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
access.log = /var/log/php7/$pool.access.log

$ cat container/entrypoint.sh

#!/bin/sh

php-fpm7
sleep 5
nginx -c /container/default.conf &
sleep 5
tail -f /var/log/nginx/*.log /var/log/php7/*.log
$ docker build . -t flashpaper
Sending build context to Docker daemon  449.5kB
Step 1/12 : FROM alpine:latest
 ---> 6dbb9cc54074
Step 2/12 : RUN apk update
 ---> Using cache
 ---> 0e2fc451dec7
Step 3/12 : RUN apk add nginx php7 php7-fpm php7-opcache git
 ---> Using cache
 ---> f14b21ad0f02
Step 4/12 : RUN git clone https://github.com/AndrewPaglusch/FlashPaper.git /flashpaper
 ---> Using cache
 ---> a19177f1f619
Step 5/12 : RUN chmod -R 775 /flashpaper
 ---> Using cache
 ---> bf7fe83886f4
Step 6/12 : RUN chown -R nginx:nginx /flashpaper
 ---> Using cache
 ---> e36d5f8ec81e
Step 7/12 : COPY container /container
 ---> Using cache
 ---> 3a9cebd5c1c0
Step 8/12 : COPY container/php-fpm.conf /etc/php7/php-fpm.conf
 ---> Using cache
 ---> 107e269f4cac
Step 9/12 : RUN mkdir -p /var/run/nginx &&     mkdir -p /var/run/php-fpm &&     chown -R nginx:nginx /var/run/
 ---> Using cache
 ---> 99a606f80c1c
Step 10/12 : RUN chmod +x /container/entrypoint.sh
 ---> Using cache
 ---> ae62352f91f1
Step 11/12 : VOLUME ["/flashpaper/data"]
 ---> Using cache
 ---> 35e349b96581
Step 12/12 : ENTRYPOINT ["/container/entrypoint.sh"]
 ---> Using cache
 ---> 0f1e7117ab03
Successfully built 0f1e7117ab03
Successfully tagged flashpaper:latest
$ docker run --rm -p 8080:80 flashpaper
==> /var/log/nginx/access.log <==

==> /var/log/nginx/error.log <==

==> /var/log/php7/error.log <==
[11-May-2021 05:51:39] NOTICE: fpm is running, pid 9
[11-May-2021 05:51:39] NOTICE: ready to handle connections

==> /var/log/php7/www.access.log <==

==> /var/log/nginx/access.log <==
172.17.0.1 - - [11/May/2021:05:51:56 +0000] "GET / HTTP/1.1" 200 5 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36"

==> /var/log/php7/www.access.log <==
- -  11/May/2021:05:51:56 +0000 "- " 200

Any idea? what I am missing here?

Matthew-Jenkins commented 3 years ago

You have 2 listens in your fpm config.

116davinder commented 3 years ago

You have 2 listens in your fpm config.

that doesn't solve my problem :( . Any other suggestion.

image

mattburchett commented 3 years ago

Hey @116davinder,

Can you give the code in #42 a try? @AndrewPaglusch and I worked on adding Docker support for FlashPaper tonight. It's working locally for me and also on my test server.

116davinder commented 3 years ago

@mattburchett, I really appreciate your fast work mate, thanks a lot. I will give it a try tomorrow morning and let you know if there is an issue.

116davinder commented 3 years ago

@mattburchett, it works now. I will wait for your PR to be merged. Thanks a lot!

AndrewPaglusch commented 3 years ago

Resolved by #42