Skip to content

Instantly share code, notes, and snippets.

@progressify
Created November 6, 2020 11:27
Show Gist options
  • Save progressify/6916bd3ff77417068b22c67f8294230c to your computer and use it in GitHub Desktop.
Save progressify/6916bd3ff77417068b22c67f8294230c to your computer and use it in GitHub Desktop.
Pure-FTPd, MySQL, Docker and Traefik 2
CREATE TABLE `ftpd` (
`User` varchar(30) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`status` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1',
`Password` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`Uid` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'www-data',
`Gid` varchar(11) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'www-data',
`Dir` varchar(250) COLLATE utf8_unicode_ci NOT NULL DEFAULT '/ftpdata',
`ULBandwidth` smallint(5) NOT NULL DEFAULT '0',
`DLBandwidth` smallint(5) NOT NULL DEFAULT '0',
`comment` tinytext COLLATE utf8_unicode_ci NOT NULL,
`ipaccess` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '*',
`QuotaSize` int(10) NOT NULL DEFAULT '0',
`QuotaFiles` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE `ftpd`
ADD PRIMARY KEY (`User`),
ADD UNIQUE KEY `User` (`User`);
version: "3.3"
services:
pureftp_db:
container_name: pureftp_db
image: mysql:5.7
restart: "always"
volumes:
- ./mysql_data:/var/lib/mysql
- ./backup.sql:/docker-entrypoint-initdb.d/backup.sql
environment:
MYSQL_ROOT_PASSWORD: '<strongpassword>' # insert here a strong password
MYSQL_DATABASE: 'pureftpd'
MYSQL_USER: 'pureftpd'
MYSQL_PASSWORD: '<anotherstrongpassword>' # insert here another strong password
pure_ftpd_mysql:
container_name: pure_ftpd_mysql
image: "humpedli/docker-pure-ftpd-mysql"
ports:
- "20-21:20-21"
- "30000-30009:30000-30009"
volumes:
- "/<path>:/ftpdata" # path of your site
- "/etc/localtime:/etc/localtime:ro"
environment:
- "EXTERNAL_IP=<domain>" # your domain name
- "MYSQL_HOST=pureftpd"
- "MYSQL_PORT=3306"
- "MYSQL_USER=pureftpd"
- "MYSQL_PASSWORD=<anotherstrongpassword>" # insert here same strong password (pureftp_db -> MYSQL_PASSWORD)
- "MYSQL_DATABASE=pureftpd"
depends_on:
- pureftp_db
restart: "always"
pureftpadmin_phpmyadmin:
container_name: pureftpadmin_phpmyadmin
image: phpmyadmin/phpmyadmin:5.0.1
restart: always
depends_on:
- pureftp_db
environment:
PMA_HOSTS: pureftp_db
labels:
- "traefik.enable=true"
- "traefik.http.routers.pureftpadmin_phpmyadmin.entrypoints=websecure"
- "traefik.http.routers.pureftpadmin_phpmyadmin.rule=Host(`pureftpmysql.<domain>`)" # insert here your domain name
- "traefik.http.routers.pureftpadmin_phpmyadmin.tls.certresolver=lets-encr" # replace with your certresolver name
volumes:
mysql_data:
data:
networks:
default:
external:
name: traefik_net # replace with your traefik network name if needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment