Info Security Memo
  • Blog
  • Sitemap
    • Categories
  • Contact
  • About
  • Resources
  • Tools
  • 51sec.org

Build Confidence

Focusing on Information Security 

Info Security Notes

Install Chevereto - Open Source Image Hosting Website Using Docker

12/17/2020

0 Comments

 
Install Chevereto - Open Source Image Hosting Website Using Docker

Chevereto is an image hosting php application that allows you to get your own beautiful and full-featured image hosting website on your own server. There are a couple of ways to install it. In this post, I am going to show you the steps to install Chevereto using Docker.


Install Docker in Ubuntu or CentOS

For CentOS:

sudo -i
yum -y update
curl -sSL https://get.docker.com/ | sh
systemctl start docker.service
systemctl enable docker.service



For Ubuntu

sudo apt update
sudo apt upgrade
sudo apt install docker.io -y
sudo -i
systemctl start docker
systemctl enable docker
docker version


Not necessary, here are the commands to install Docker Compose:


  1. Run this command to download the current stable release of Docker Compose:

    sudo curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    
    

    To install a different version of Compose, substitute 1.27.4 with the version of Compose you want to use.


  2. Apply executable permissions to the binary:

    sudo chmod +x /usr/local/bin/docker-compose
    
    

Note: If the command docker-compose fails after installation, check your path. You can also create a symbolic link to /usr/bin or any other directory in your path.

For example:

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

  1. Optionally, install command completion for the bash and zsh shell.

  2. Test the installation.

    $ docker-compose --version
    docker-compose version 1.27.4, build 1110ad01
    


Chevereto Docker

Docker Image from : https://ift.tt/3oZYyh3

Docker compose

vi docker-compose.yaml
version: '3'

services:
  db:
    image: mariadb
    volumes:
      - database:/var/lib/mysql:rw
    restart: always
    networks:
      - private
    environment:
      MYSQL_ROOT_PASSWORD: chevereto_root
      MYSQL_DATABASE: chevereto
      MYSQL_USER: chevereto
      MYSQL_PASSWORD: chevereto

  chevereto:
    depends_on:
      - db
    image: nmtan/chevereto
    restart: always
    networks:
      - private
    environment:
      CHEVERETO_DB_HOST: db
      CHEVERETO_DB_USERNAME: chevereto
      CHEVERETO_DB_PASSWORD: chevereto
      CHEVERETO_DB_NAME: chevereto
      CHEVERETO_DB_PREFIX: chv_
    volumes:
      - chevereto_images:/var/www/html/images:rw
    ports:
      - 8080:80

networks:
  private:
volumes:
  database:
  chevereto_images:

Once docker-compose.yaml is ready, you can run

docker-compose up -d


docker ps

docker inspect <container id>


Open Browser to url : http://<public ip>:8080



1. Get php.ini location


$ php -ini

 

2. Change PHP Settings

If there is no php.ini file at /usr/local/etc/php, just create one. 

There is 

upload_max_filesize = 5M


 

3. Restart Apache Server

Restart Apache Server to apply changes

$ service apache2 restart


Install Portainer 


docker volume create portainer_data
docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
docker ps

Use your browser to access URL http://<public ip of your linuxserver>:9000
First time, it will ask you to set up admin user's password.



Create Nginx Container


Docker image:johnyan2/nginx1netsec


Nginx is using Bridge network. Restart policy is also set to Always. 


root@5fbe841d1f40:/# ls
bin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
root@5fbe841d1f40:/# cd etc
root@5fbe841d1f40:/etc# cd nginx
root@5fbe841d1f40:/etc/nginx# cd conf.d
root@5fbe841d1f40:/etc/nginx/conf.d# ls
default.conf  portainer.conf  webssh.conf  wordpress.conf
root@5fbe841d1f40:/etc/nginx/conf.d# nano chevereto.conf 
server {
    listen       80;
    server_name  chevereto.51sec.org;
location / {
    proxy_pass       http://132.145.9.4:8080;
    proxy_redirect             off;
    proxy_http_version         1.1;
    proxy_set_header Upgrade   $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host      $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
root@5fbe841d1f40:/etc/nginx/conf.d# 



root@5fbe841d1f40:/etc/nginx/conf.d# cat portainer.conf 
server {
    listen       80;
    server_name  gcp1portainer.51sec.org;

location / {
    proxy_pass       http://132.145.9.41:9000;
    proxy_redirect             off;
    proxy_http_version         1.1;
    proxy_set_header Upgrade   $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host      $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

service nginx restart




Other scripts

Here is another Docker configuration file from : https://ift.tt/2WngmX8

Go to Portainer and copy this to a new stack:

version: '2'
services:
db:
image: mariadb
volumes:
- /database:/var/lib/mysql:rw # I haven't had good luck putting this database in a different directory
restart: unless-stopped
networks:
- private
environment:
MYSQL_ROOT_PASSWORD: chevereto_root
MYSQL_DATABASE: chevereto
MYSQL_USER: chevereto
MYSQL_PASSWORD: chevereto
chevereto:
depends_on:
- db
image: nmtan/chevereto
restart: unless-stopped
networks:
- private
environment:
CHEVERETO_DB_HOST: db
CHEVERETO_DB_USERNAME: chevereto
CHEVERETO_DB_PASSWORD: chevereto
CHEVERETO_DB_NAME: chevereto
CHEVERETO_DB_PREFIX: chv_
volumes:
- /srv/dev-disk-by-label-ssd/conf/Chevereto/chevereto_images:/var/www/html/images:rw
- /srv/dev-disk-by-label-ssd/conf/php.ini:/usr/local/etc/php/php.ini:ro
ports:
- 8686:80
networks:
private:
volumes:
database:
chevereto_images:


Additional Chevereto Modifications

The php.ini file will need to be created by you if you don’t already have one available for use. By default, you won’t be able to upload images more than 2mb and this will fix that.

Here is the contents of my php.ini file for this setup:

upload_max_filesize = 20M
post_max_size = 20M
memory_limit = 512M
max_execution_time = 180

You’ll also need to make sure you set the correct permissions to the chevereto_images folder. To do that, and using previous setup as an example, you would use the following command:

sudo chmod -R a+rwx /srv/dev-disk-by-label-ssd/conf/Chevereto/chevereto_images


References

  • https://ift.tt/38ftL94









via Blogger https://ift.tt/3reSaEG
December 16, 2020 at 10:21PM Docker
0 Comments



Leave a Reply.

    Categories

    All
    Architecture
    Blog
    Checkpoint
    Cisco
    Cloud
    CyberArk
    F5
    Fortigate
    Guardium
    Juniper
    Linux
    Network
    Others
    Palo Alto
    Qualys
    Raspberry Pi
    Security
    SIEM
    Software
    Vmware
    VPN
    Wireless

    Archives

    March 2024
    February 2024
    January 2024
    December 2023
    November 2023
    October 2023
    September 2023
    August 2023
    July 2023
    June 2023
    May 2023
    April 2023
    March 2023
    February 2023
    January 2023
    December 2022
    November 2022
    October 2022
    September 2022
    August 2022
    July 2022
    June 2022
    May 2022
    April 2022
    March 2022
    February 2022
    January 2022
    December 2021
    November 2021
    October 2021
    September 2021
    August 2021
    July 2021
    June 2021
    May 2021
    April 2021
    March 2021
    February 2021
    January 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    July 2020
    October 2019
    September 2019
    June 2019
    July 2018
    May 2018
    December 2017
    August 2017
    April 2017
    March 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015
    September 2015
    August 2015
    July 2015
    June 2015
    May 2015
    April 2015
    March 2015

    Print Page:

    RSS Feed

    Email Subscribe
Powered by Create your own unique website with customizable templates.
  • Blog
  • Sitemap
    • Categories
  • Contact
  • About
  • Resources
  • Tools
  • 51sec.org