Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 13, 2022. It is now read-only.

82Flex/DCRM

Repository files navigation


DCRM - Darwin Cydia Repository Manager (Version 4)

DO NOT USE DCRM FOR DISTRIBUTING PIRATED PACKAGES. Qing Wu Shi Yong DCRM Fen Fa Dao Ban Ruan Jian Bao .

  • SUMMARY
    • Features
    • TODOs
  • DEMO
  • DOCKER DEPLOY Zi Dong Bu Shu
    • Docker Commands Chang Yong Ming Ling
    • Basic Configuration
    • Configure GnuPG
  • PUBLISH REPOSITORY Fa Bu Ruan Jian Yuan
  • MANUALLY DEPLOY Shou Dong Bu Shu
    • ENVIRONMENT Huan Jing
    • EXAMPLE Shi Li
    • IN PRODUCTION Sheng Chan Huan Jing Shi Li
      • Configure UWSGI
      • UWSGI Commands
      • Configure NGINX
      • NGINX Commands
      • Configure Workers
      • Configure GnuPG
  • CONTRIBUTORS
  • LICENSE Ban Quan Sheng Ming

1. SUMMARY

DCRM means Darwin Cydia Repo (APT) Manager, which is designed for Jay Freeman's Cydia. Cydia is an universal package manager for jailbroken devices.

1.1. Features

  • full featured dashboard powered by Django and Django Suit
  • restful APIs with full documentation powered by Django REST framework
  • import Debian package (.deb) via http or ftp upload
  • manage packages, versions, sections and icons
  • sync control fields between db and the control file inside package automatically
  • auto generated depiction pages, mobile optimized
  • threaded comments & screenshots gallery
  • iOS version / product type compatibility check
  • version history & downgrade support
  • download count & statistics
  • scheduled tasks
  • multiple users / groups
  • CDN/OSS friendly
  • GPG signature
  • supports Docker

1.2. TODOs

  • apt pdiff feature
  • support for commercial packages
  • more themes

2. DEMO

This demo is deployed using Container Optimized OS on Google Cloud.

https://apt.82flex.com/

  • Username: root
  • Password: dcrmpass

Watch the guide video: https://youtu.be/dvNCRckm2Cc

3. DOCKER DEPLOY Zi Dong Bu Shu

Yi Xia Bu Zou Neng Wan Zheng Bu Shu DCRM Zui Xin Fu Ben , Qi Yong Liao Ren Wu Dui Lie Ji Ye Mian Huan Cun Zhi Chi , Ni Ke Yi Gen Ju Xu Yao Diao Zheng Zi Ji De Pei Zhi .

  1. Ru Guo Ni Huan Mei You Xia Zai Ci Xiang Mu , Jian Yi Shi Yong git Ke Long Gai Cang Ku :
# download this project or clone this git repo:
git clone --depth 1 https://github.com/82Flex/DCRM.git && cd DCRM
  1. Gou Jian Bing Qi Dong DCRM Rong Qi :
# build and launch DCRM via `docker-compose`
docker-compose up --build --detach
  1. Xian Fu Jia Dao Rong Qi Zhong :
# attach to `dcrm_app` container
docker exec -i -t dcrm_app /bin/bash
  1. execute in container: Zai Rong Qi Zhong Zhi Xing Ming Ling :
# collect static files
python manage.py collectstatic --no-input

# create required database structures
python manage.py migrate

# create super user in database
python manage.py createsuperuser
  1. access admin panel via http://127.0.0.1/admin/, you can upload packages via HTTP or FTP: Xian Zai Ke Yi Chang Shi Fang Wen DCRM Hou Tai Liao , Ni Ke Yi Tong Guo HTTP Huo FTP Fang Shi Shang Chuan Ruan Jian Bao :
  • Default FTP username: dcrm
  • Default FTP password: dcrm_ftp_password

3.1. Docker Commands Chang Yong Ming Ling

  1. Zhong Xin Gou Jian Bing Zai Hou Tai Qi Dong DCRM (Jin Dang Dai Ma Fa Sheng Bian Dong , Bu Hui Ying Xiang Shu Ju )
# build and launch DCRM in background (when source code changed)
docker-compose up --build --detach
  1. Jin Zai Hou Tai Qi Dong DCRM
# launch DCRM in background
docker-compose up --detach
  1. Zai Qian Tai Qi Dong DCRM
# launch DCRM in foreground to see what happens
docker-compose up
  1. Ting Zhi DCRM
# shutdown DCRM
docker-compose down

3.2. Basic Configuration

here are a few steps you need to follow:

edit docker/nginx/conf.d/default.conf:

  1. set server_name to your domain
  2. configure your https server

edit DCRM/.env:

  1. DCRM_HOST
  2. DCRM_DEBUG: set it to 0 if you're providing subscription to others
  3. DCRM_SECURE_SSL: set it to 1 if you have https certs and properly configured
  4. DCRM_SECRET_KEY: set it to a random, unique string
  5. DCRM_TIME_ZONE

edit docker-compose.yml:

  1. change default FTP username and password in services:pure-ftpd:environment, FTP_USER_NAME and FTP_USER_PASS, enable FTP over TLS if you want

3.3. Configure GnuPG

# 1. attach to `dcrm_app` container
docker exec -i -t dcrm_app /bin/bash

# 2. generate new GPG key
gpg --gen-key --homedir .gnupg
# or
# gpg --allow-secret-key-import --import private.key --homedir .gnupg

# 3. enable GPG feature and configure passphrase in `WEIPDCRM -> Settings -> Security`
# 4. create APT verification package in `WEIPDCRM -> Sections -> Action -> Generate icon package for selected sections`, which will install GPG public key to user's device

4. PUBLISH REPOSITORY Fa Bu Ruan Jian Yuan

Before you publish your repository, there are a few steps you should follow: Bu Shu Wan Cheng Hou , Ni Huan Xu Yao Yi Xie Bu Zou Lai Fa Bu Ni De Ruan Jian Yuan :

  1. Sites

Set domains and site names. Zai Sites Zhong She Zhi Yu Ming He Zhan Dian Ming Cheng

  1. WEIPDCRM -> Settings
  2. WEIPDCRM -> Releases

Add a new release and set it as an active release. Tian Jia Xin De Release Bing Jiang Qi She Zhi Wei Huo Yue Zhuang Tai

  1. WEIPDCRM -> Sections
  2. WEIPDCRM -> Upload -> New Package

Upload your debian package via HTTP or FTP. Shang Chuan Ni De deb Bao

  1. WEIPDCRM -> Versions

Enable package versions and assign them into sections. Ji De Qi Yong Ni De deb Bao (Mo Ren Bu Qi Yong ), Bing Qie Jiang Ta Men Fen Pei Dao Yuan Fen Lei Dang Zhong

  1. WEIPDCRM -> Builds

Build the repository to apply all the changes, thus you cannot add this repo in Cydia. Gou Jian Quan Yuan , Rang Suo You Geng Gai Sheng Xiao (Di Yi Ci Gou Jian Qian , Cydia Zhong Shi Wu Fa Tian Jia Gai Yuan De )

5. MANUALLY DEPLOY Shou Dong Bu Shu

5.1. ENVIRONMENT Huan Jing

  • gzip, bzip2, xz (xz-devel)
  • Python 3.7 (CentOS: if compiled from source, make sure package xz-devel is installed)
  • Django 1.11+
  • MySQL (or MariaDB)
  • Redis (optional)
  • memcached (optional)
  • uwsgi, Nginx (production only)
  • vsftpd (or pure-ftpd, optional)

5.2. EXAMPLE Shi Li

  1. install dependencies: An Zhuang Yi Lai :
apt-get update
apt-get upgrade
apt-get install git mysql-server libmysqlclient-dev python3-dev python3-pip libjpeg-dev tzdata
  1. configure mysql: An Zhuang Wan Cheng Hou , Deng Lu Dao mysql:
service mysql start
mysql_secure_installation
mysql -uroot -p
  1. create a database for this DCRM instance: Xin Jian DCRM Shu Ju Ku :
CREATE DATABASE `DCRM` DEFAULT CHARSET UTF8;
  1. create mysql user dcrm and grant privileges: Xin Jian dcrm Yong Hu Bing She Zhi Mi Ma :
CREATE USER 'dcrm'@'localhost' IDENTIFIED BY 'thisisthepassword';
GRANT ALL PRIVILEGES ON `DCRM`.* TO 'dcrm'@'localhost';
FLUSH PRIVILEGES;
  1. clone this git repo: Zai He Gua De Wei Zhi Ke Long DCRM:
mkdir -p /wwwdata
cd /wwwdata
git clone --depth 1 https://github.com/82Flex/DCRM.git
cd /wwwdata/DCRM
  1. install python modules, virtualenv is recommended if you want: An Zhuang Bi Yao De python Mo Kuai :
pip3 install -r requirements.txt
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -D mysql -u root -p
  1. enable redis support (task queue): Ru Guo Ni Huan Xu Yao Kai Qi Redis Zhi Chi (Yong Yu Ren Wu Dui Lie ):
apt-get install redis-server
service redis-server start
  1. enable memcached support (page caching): Ru Guo Ni Huan Xu Yao Kai Qi Ye Mian Huan Cun , Ni Ke Neng Huan Xu Yao Zi Xing Qi Dong memcached Fu Wu :
apt-get install memcached
service memcached start
  1. modify DCRM/.env:
  • DCRM_DEBUG=1 for debugging, DCRM_DEBUG=0 for production
  • DCRM_HOST: add your domain
  • DCRM_SECRET_KEY: set it to a random, unique string
  • DCRM_MYSQL_*: your mysql configurations, you may use different 'DATABASE' across DCRM instances
  • DCRM_REDIS_*: your redis configurations, you may use different 'DB' numbers across DCRM instances
  • DCRM_MEMCACHED_*: your memcached configurations
  • DCRM_LANGUAGE_CODE and DCRM_TIME_ZONE
  • optional features: DCRM_ENABLE_REDIS, DCRM_ENABLE_CACHE, DCRM_ENABLE_API
  1. collect static files: Tong Bu Jing Tai Wen Jian :
python3 manage.py collectstatic
  1. migrate database and create new super user: Tong Bu Shu Ju Ku Jie Gou Bing Chuang Jian Chao Ji Yong Hu :
python3 manage.py migrate
python3 manage.py createsuperuser
  1. run debug server: Qi Dong Ce Shi Fu Wu Qi :
python3 manage.py runserver
  1. access admin panel via http://127.0.0.1:8000/admin/

5.3. IN PRODUCTION Sheng Chan Huan Jing Shi Li

Sheng Chan Huan Jing De Pei Zhi Xu Yao You Yi Ding De Fu Wu Qi Yun Wei Jing Yan , Ru Guo Ni Zai Sheng Chan Huan Jing De Pei Zhi Guo Cheng Zhong Yu Dao Kun Nan , Wo Men Ti Gong Fu Fei De Yi Nan Jie Da .

We assumed that nginx uses www-data as its user and group. Jia She nginx Shi Yong www-data Yong Zuo Qi Yong Hu Ming He Yong Hu Zu Ming .

5.3.1. Configure UWSGI

here is an example of uwsgi.ini:

[uwsgi]

chdir = /home/DCRM
module = DCRM.wsgi

master = true
processes = 4
enable-threads = true
threads = 2
thunder-lock = true
socket = :8001
vaccum = true
uid = www-data
gid = www-data
safe-pidfile = /home/run/uwsgi-apt.pid
; daemonize = /dev/null

5.3.2. UWSGI Commands

# test
uwsgi --ini uwsgi.ini

# run
uwsgi --ini uwsgi.ini --daemonize=/dev/null

# kill
kill -INT `cat /home/run/uwsgi-apt.pid`

5.3.3. Configure Nginx/Apache

here is an example of nginx https site configuration file:

upstream django {
server 127.0.0.1:8001; # to match your uwsgi configuration
}
server {
listen 80;
server_name apt.82flex.com; # your domain
rewrite ^/(.*)$ https://apt.82flex.com/$1 permanent; # redirect to https
}
server {
listen 443 ssl;

ssl_certificate /wwwdata/ssl/1_apt.82flex.com_bundle.crt; # your ssl cert
ssl_certificate_key /wwwdata/ssl/2_apt.82flex.com.key; # your ssl key
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_prefer_server_ciphers on;

server_name apt.82flex.com; # your domain
root /wwwdata/wwwroot; # specify a web root, not the DCRM directory
error_page 497 https://$host$uri?$args;
server_name_in_redirect off;
index index.html;

location = / {
# only enable this section if you want to use DCRM as your home page
rewrite ^ /index/ last;
}

location / {
# only enable this section if you want to use DCRM as your default pages
try_files $uri $uri/ @djangosite;
}

location ~^/static/(.*)$ {
# static files for DCRM, you can change its path in settings.py
alias /wwwdata/DCRM/static/$1; # make an alias for static files
}

location ~^/resources/(.*)$ {
# resources for DCRM, including debian packages and icons, you can change it in WEIPDCRM > Settings in admin panel
alias /wwwdata/DCRM/resources/$1; # make an alias for resources

# Aliyun CDN/OSS:
# you can mount '/wwwdata/DCRM/resources' to oss file system
# then rewrite this path to oss/cdn url for a better performance
}

location ~^/((CydiaIcon.png)|(Release(.gpg)?)|(Packages(.gz|.bz2)?))$ {
# Cydia meta resources, including Release, Release.gpg, Packages and CydiaIcon

# Note:
# 'releases/(\d)+/$1' should contain `active_release.id`, which is set in Settings tab.
alias /wwwdata/DCRM/resources/releases/1/$1; # make an alias for Cydia meta resources
}

location @djangosite {
uwsgi_pass django;
include /etc/nginx/uwsgi_params;
}

location ~* .(ico|gif|bmp|jpg|jpeg|png|swf|js|css|mp3|m4a|m4v|mp4|ogg|aac)$ {
expires 7d;
}

location ~* .(gz|bz2)$ {
expires 12h;
}
}

here is an example of apache virtual host configuration file:

Alias /static /home/DCRM/static
Alias /resources /home/DCRM/resources
Alias /CydiaIcon.png /home/DCRM/resources/releases/1/CydiaIcon.png
Alias /Release /home/DCRM/resources/releases/1/Release
Alias /Release.gpg /home/DCRM/resources/releases/1/Release.gpg
Alias /Packages /home/DCRM/resources/releases/1/Packages
Alias /Packages.gz /home/DCRM/resources/releases/1/Packages.gz
Alias /Packages.bz2 /home/DCRM/resources/releases/1/Packages.bz2

<IfModule mod_proxy_uwsgi.c>
ProxyPreserveHost On
ProxyPass /static !
ProxyPass /resources !
ProxyPass /CydiaIcon.png !
ProxyPass /Release !
ProxyPass /Release.gpg !
ProxyPass /Packages !
ProxyPass /Packages.gz !
ProxyPass /Packages.bz2 !
ProxyPass / uwsgi://127.0.0.1:8001/
IfModule>

<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/png "access 7 days"
ExpiresByType image/gif "access 7 days"
ExpiresByType image/jpeg "access 7 days"
ExpiresByType text/javascript "access 2 weeks"
ExpiresByType text/css "access 2 weeks"
ExpiresByType text/html "modification 4 hours"
ExpiresDefault "access 2 hours"
IfModule>

5.3.4. NGINX Commands

# install Nginx
apt-get install nginx

# launch Nginx
service nginx start

# test Nginx configuration
nginx -t

# reload configuration
nginx -s reload

# launch nginx if it is down
sudo /etc/init.d/nginx start

5.3.5. Configure Workers

# launch task queue with the same nginx working user (www/www-data)
su www-data

# if you cannot switch to user `www-data`, remember to change its login prompt in `/etc/passwd`. launch some workers for DCRM background queue
nohup ./manage.py rqworker high > /dev/null &
nohup ./manage.py rqworker default > /dev/null &

# you need at least one worker for each queue

worker De Shu Liang Yi Ni De Ju Ti Xu Qiu Wei Zhun , Dan Shi Ge Dui Lie Zhong Zhi Shao Yao You Yi Ge Huo Yue worker, Fou Ze Dui Lie Zhong De Ren Wu Jiang Yi Zhi Bao Chi Gua Qi .

5.3.6. Configure GnuPG

# 1. install `gnupg2`
apt-get install gnupg2

# 2. make sure to launch background queue with the same nginx working user (www/www-data)
su www-data

# 3. generate new GPG key
gpg --gen-key --homedir .gnupg
# or
# gpg --allow-secret-key-import --import private.key --homedir .gnupg

# 4. enable GPG feature and configure passphrase in `WEIPDCRM -> Settings -> Security`
# 5. create APT verification package in `WEIPDCRM -> Sections -> Action -> Generate icon package for selected sections`, which will install GPG public key to user's device

6. CONTRIBUTORS

7. LICENSE Ban Quan Sheng Ming

As long as you do not use the DCRM in a business or money-making venture, it is free for your own personal use. If you use DCRM in commercial projects (e.g. hosting commercial packages), please consider buy a commercial license.

PayPal receipt is valid proof of purchase of DCRM licence.

SINGLE: Use DCRM in one commercial project

UNLIMITED: Use DCRM in unlimited commercial projects


Copyright (c) 2013-2020 Lessica, Hintay, 0xJacky and all DCRM contributors

The program is distributed under the terms of the GNU Affero General Public License.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Packages

Contributors