├── .gitignore ├── README.md ├── auto-invite-python ├── Dockerfile ├── app.py └── requirements.txt ├── ghost-mariadb ├── .env.example ├── config.production.json.example ├── docker-compose.yml └── nginx │ └── defualt.conf.example └── nginx-wp-mariadb ├── .env.example ├── config └── nginx │ └── nginx.conf.example └── docker-compose.yml /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | ehthumbs.db 37 | Thumbs.db 38 | .env 39 | nginx.conf 40 | nginx-wp-mariadb/config/site-data/* 41 | ghost-mariadb/content 42 | ghost-mariadb/mysql 43 | ghost-mariadb/nginx/defualt.conf 44 | ghost-mariadb/config.production.json -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker Apps 2 | 3 | FullStack apps deployed with docker. 4 | 5 | ## List of Apps 6 | 7 | - Ghost blog, Mariadb, and Nginx 8 | - Wordpress blog, Mariadb, and Nginx 9 | -------------------------------------------------------------------------------- /auto-invite-python/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | FROM python:3.8-slim-buster 4 | 5 | WORKDIR /app 6 | 7 | COPY requirements.txt requirements.txt 8 | RUN pip3 install -r requirements.txt 9 | 10 | COPY . . 11 | 12 | CMD [ "python3", "app.py"] 13 | -------------------------------------------------------------------------------- /auto-invite-python/app.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import time 3 | import json 4 | # import redis 5 | 6 | # r = redis.Redis( 7 | # host='localhost', 8 | # port='6379', 9 | # db=1 10 | # ) 11 | 12 | 13 | url = "https://www.clubhouseapi.com/api/" 14 | ch = "m7Kk7X31" 15 | t = "4c721c9c2f7d18b463c83a5e61df4d3d34e39d71" 16 | 17 | user_list = [] 18 | 19 | 20 | def get_room(channel, token): 21 | headers = { 22 | 'CH-Languages': 'en-US', 23 | 'CH-Locale': 'en_US', 24 | 'Accept': 'application/json', 25 | 'Accept-Encoding': 'gzip, deflate', 26 | 'CH-AppBuild': '2576', 27 | 'CH-AppVersion': '0.1.8', 28 | 'CH-UserID': '1928455578', 29 | 'User-Agent': 'clubhouse/2576 (iPhone; iOS 14.4; Scale/2.00)', 30 | 'Connection': 'close', 31 | 'Content-Type': 'application/json; charset=utf-8', 32 | 'Authorization': 'Token ' + token, 33 | } 34 | data = { 35 | "channel": channel 36 | } 37 | api_url = url + 'get_channel' 38 | req = requests.request("POST", api_url, 39 | headers=headers, json=data) 40 | res = req.json() 41 | dump_res = json.dumps(res, indent=2) 42 | loads_res = json.loads(dump_res) 43 | user_list = loads_res['users'] 44 | return user_list 45 | 46 | 47 | def invate_speaker(t, ch, id): 48 | headers = { 49 | 'CH-Languages': 'en-US', 50 | 'CH-Locale': 'en_US', 51 | 'Accept': 'application/json', 52 | 'Accept-Encoding': 'gzip, deflate', 53 | 'CH-AppBuild': '2576', 54 | 'CH-AppVersion': '0.1.8', 55 | 'CH-UserID': '1928455578', 56 | 'User-Agent': 'clubhouse/2576 (iPhone; iOS 14.4; Scale/2.00)', 57 | 'Connection': 'close', 58 | 'Content-Type': 'application/json; charset=utf-8', 59 | 'Authorization': 'Token ' + t, 60 | } 61 | payload = { 62 | "channel": ch, 63 | "user_id": id 64 | } 65 | api_url = url + 'invite_speaker' 66 | response = requests.request("POST", api_url, json=payload, headers=headers) 67 | print(response.text) 68 | 69 | 70 | def add_to_dict(user): 71 | user_dict = {} 72 | user_id = user['user_id'] 73 | user_state = user['is_speaker'] 74 | is_invate = user['is_invited_as_speaker'] 75 | user_dict = {1: user_id, 2: user_state, 3: is_invate} 76 | return user_dict 77 | 78 | 79 | while True: 80 | all_users = get_room(ch, t) 81 | for i in all_users: 82 | all_user_dict = add_to_dict(i) 83 | # print(all_user_dict) 84 | if all_user_dict[2] == False: 85 | if all_user_dict[3] == False: 86 | id = all_user_dict[1] 87 | print(all_user_dict) 88 | invate_speaker(t, ch, id) 89 | time.sleep(5) 90 | -------------------------------------------------------------------------------- /auto-invite-python/requirements.txt: -------------------------------------------------------------------------------- 1 | requests -------------------------------------------------------------------------------- /ghost-mariadb/.env.example: -------------------------------------------------------------------------------- 1 | MYSQL_ROOT_PASSWORD=root 2 | MYSQL_DATABASE=ghostdb 3 | MYSQL_USER=ehsandev 4 | MYSQL_PASSWORD=root 5 | PMA_HOST=db 6 | 7 | url=http://ehsanghaffarii.ir 8 | database__client=mysql 9 | database__connection__host=db 10 | database__connection__user=root 11 | database__connection__password=root 12 | database__connection__database=ghostdb -------------------------------------------------------------------------------- /ghost-mariadb/config.production.json.example: -------------------------------------------------------------------------------- 1 | { 2 | "url": "http://ehsanghaffarii.ir", 3 | "server": { 4 | "port": 2368, 5 | "host": "0.0.0.0" 6 | }, 7 | "database": { 8 | "client": "mysql", 9 | "connection": { 10 | "host": "db", 11 | "user": "root", 12 | "password": "root", 13 | "database": "ghostdb", 14 | "charset": "utf8" 15 | } 16 | }, 17 | "mail": { 18 | "from": "'MyDomain' ", 19 | "transport": "SMTP", 20 | "options": { 21 | "service": "Mailgun", 22 | "host": "smtp.mailgun.org", 23 | "port": 465, 24 | "secureConnection": true, 25 | "auth": { 26 | "user": "eghafari.5000@gmail.com", 27 | "pass": "7adsf7f8asd8f6as7asd7f-123sdf8-asdf87fa" 28 | } 29 | } 30 | }, 31 | "logging": { 32 | "transports": ["file", "stdout"] 33 | }, 34 | "process": "systemd", 35 | "paths": { 36 | "contentPath": "/var/lib/ghost/content" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ghost-mariadb/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.3' 2 | services: 3 | 4 | ghost: 5 | image: ghost:latest 6 | restart: always 7 | depends_on: 8 | - db 9 | env_file: .env 10 | volumes: 11 | - ./content:/var/lib/ghost/content 12 | - ./config.production.json:/var/lib/ghost/config.production.json 13 | 14 | 15 | db: 16 | image: mariadb:latest 17 | restart: always 18 | ports: 19 | - 3316:3306 20 | env_file: .env 21 | volumes: 22 | - ./mysql:/var/lib/mysql 23 | 24 | 25 | phpmyadmin: 26 | depends_on: 27 | - db 28 | ports: 29 | - '8980:80' 30 | image: phpmyadmin 31 | restart: always 32 | env_file: .env 33 | 34 | nginx: 35 | image: nginx:alpine 36 | restart: always 37 | depends_on: 38 | - ghost 39 | ports: 40 | - "8989:80" 41 | volumes: 42 | - /usr/share/nginx/html:/usr/share/nginx/html 43 | - ./nginx:/etc/nginx/conf.d 44 | -------------------------------------------------------------------------------- /ghost-mariadb/nginx/defualt.conf.example: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | listen [::]:80; 4 | server_name ehsanghaffarii.ir www.ehsanghaffarii.ir; 5 | client_max_body_size 20m; 6 | 7 | location / { 8 | proxy_set_header Host $host; 9 | proxy_set_header X-Real-IP $remote_addr; 10 | proxy_set_header X-Forwarded-Proto http; 11 | proxy_pass http://ghost:2368; 12 | } 13 | 14 | 15 | gzip on; 16 | gzip_comp_level 5; 17 | gzip_min_length 256; 18 | gzip_proxied any; 19 | gzip_vary on; 20 | gzip_types 21 | application/atom+xml 22 | application/javascript 23 | application/json 24 | application/ld+json 25 | application/manifest+json 26 | application/rss+xml 27 | application/vnd.geo+json 28 | application/vnd.ms-fontobject 29 | application/x-font-ttf 30 | application/x-web-app-manifest+json 31 | application/xhtml+xml 32 | application/xml 33 | font/opentype 34 | image/bmp 35 | image/svg+xml 36 | image/x-icon 37 | text/cache-manifest 38 | text/css 39 | text/plain 40 | text/vcard 41 | text/vnd.rim.location.xloc 42 | text/vtt 43 | text/x-component 44 | text/x-cross-domain-policy; 45 | } -------------------------------------------------------------------------------- /nginx-wp-mariadb/.env.example: -------------------------------------------------------------------------------- 1 | MYSQL_ROOT_PASSWORD= 2 | MYSQL_DATABASE= 3 | MYSQL_USER= 4 | MYSQL_PASSWORD= 5 | 6 | WORDPRESS_DB_HOST= 7 | WORDPRESS_DB_USER= 8 | WORDPRESS_DB_PASSWORD= 9 | WORDPRESS_DB_NAME= 10 | WORDPRESS_TABLE_PREFIX= -------------------------------------------------------------------------------- /nginx-wp-mariadb/config/nginx/nginx.conf.example: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | listen [::]:80; 4 | access_log off; 5 | root /var/www/html; 6 | index index.php; 7 | server_name goldwin1.ir; 8 | server_tokens off; 9 | location / { 10 | # First attempt to serve request as file, then 11 | # as directory, then fall back to displaying a 404. 12 | try_files $uri $uri/ /index.php?$args; 13 | } 14 | # pass the PHP scripts to FastCGI server listening on wordpress:9000 15 | location ~ \.php$ { 16 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 17 | fastcgi_pass wordpress:9000; 18 | fastcgi_index index.php; 19 | include fastcgi_params; 20 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 21 | fastcgi_param SCRIPT_NAME $fastcgi_script_name; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /nginx-wp-mariadb/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.9" 2 | 3 | volumes: 4 | mariadb: 5 | driver: local 6 | 7 | networks: 8 | db: 9 | driver: bridge 10 | 11 | services: 12 | mariadb: 13 | # We use a mariadb image which supports both amd64 & arm64 architecture 14 | image: mariadb:10.7 15 | volumes: 16 | - mariadb:/var/lib/mysql 17 | restart: always 18 | env_file: .env 19 | ports: 20 | - "33060:3306" 21 | expose: 22 | - 33060 23 | networks: 24 | db: 25 | 26 | phpmyadmin: 27 | image: phpmyadmin 28 | restart: always 29 | ports: 30 | - 40001:80 31 | environment: 32 | - PMA_ARBITRARY=1 33 | networks: 34 | db: 35 | 36 | wordpress: 37 | image: wordpress:latest 38 | ports: 39 | - 8090:80 40 | restart: always 41 | env_file: .env 42 | networks: 43 | db: 44 | volumes: 45 | - ./config/site-data:/var/www/html/wp-content 46 | 47 | nginx: 48 | image: nginx:alpine 49 | ports: 50 | - 8088:80 51 | networks: 52 | db: 53 | volumes: 54 | - ./config/nginx:/etc/nginx/conf.d --------------------------------------------------------------------------------