Skip to content

Commit

Permalink
Merge pull request #4777 from tesilaaliset/fix-docker
Browse files Browse the repository at this point in the history
Fix docker
  • Loading branch information
lymanjre authored Feb 17, 2025
2 parents 2f21922 + 9622530 commit f135f17
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 18 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ COPY . .
RUN apt-get update && apt-get install -y apt-utils curl sudo systemd xxd lsof gawk iproute2 &&\
mkdir -p /hiddify-data/ssl/ && \
rm -rf /opt/hiddify-manager/ssl && \
ln -sf /hiddify-data/ssl /opt/hiddify-manager/ssl &&\
bash install.sh install-docker --no-gui &&\
rm -rf /var/cache/apt/archives /var/lib/apt/lists/*
ln -sf /hiddify-data/ssl /opt/hiddify-manager/ssl

RUN bash install.sh install-docker --no-gui
RUN rm -rf /var/cache/apt/archives /var/lib/apt/lists/*

COPY other/docker/ /usr/bin/

Expand Down
23 changes: 15 additions & 8 deletions common/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ python -m pip config set global.index-url https://pypi.org/simple > /dev/null
# rm /etc/resolv.conf
# ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

if [[ $COUNTRY == 'cn' ]]; then
sudo timedatectl set-timezone Asia/Shanghai
elif [[ $COUNTRY == 'ru' ]]; then
sudo timedatectl set-timezone Europe/Moscow
else
sudo timedatectl set-timezone Asia/Tehran
if [ "${MODE}" != "install-docker" ];then
if [[ $COUNTRY == 'cn' ]]; then
sudo timedatectl set-timezone Asia/Shanghai
elif [[ $COUNTRY == 'ru' ]]; then
sudo timedatectl set-timezone Asia/Moscow
else
sudo timedatectl set-timezone Asia/Tehran
fi
fi

groupadd -f hiddify-common
Expand All @@ -39,7 +41,9 @@ fi

ln -sf $(pwd)/sysctl.conf /etc/sysctl.d/hiddify.conf

sysctl --system > /dev/null
if [ "${MODE}" != "install-docker" ];then
sysctl --system > /dev/null
fi

if [[ "$ONLY_IPV4" != true ]]; then
sysctl -w net.ipv6.conf.all.disable_ipv6=0
Expand Down Expand Up @@ -83,7 +87,10 @@ echo "@reboot root /opt/hiddify-manager/install.sh --no-gui --no-log >> /opt/hid
echo "@daily root /opt/hiddify-manager/common/daily_actions.sh >> /opt/hiddify-manager/log/system/daily_actions.log 2>&1" >/etc/cron.d/hiddify_daily_memory_release
service cron reload

localectl set-locale LANG=C.UTF-8
if [ "${MODE}" != "install-docker" ];then
localectl set-locale LANG=C.UTF-8
fi

update-locale LANG=C.UTF-8

echo "hiddify-panel ALL=(root) NOPASSWD: /opt/hiddify-manager/common/commander.py" >/etc/sudoers.d/hiddify
Expand Down
4 changes: 3 additions & 1 deletion common/run.sh.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
source /opt/hiddify-manager/common/utils.sh

if [ "${MODE}" != "install-docker" ];then

# open essential ports
allow_port "tcp" 22
allow_port "tcp" 80
Expand Down Expand Up @@ -99,7 +101,7 @@ ip6tables -P INPUT ACCEPT
save_firewall

#add2iptables "INPUT -p tcp --dport 9000 -j DROP"

fi
{% if hconfigs['auto_update'] %}
echo "0 3 * * * root $(pwd)/../update.sh --no-gui --no-log" >/etc/cron.d/hiddify_auto_update
service cron reload
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ services:

#specific version
#image: ghcr.io/hiddify/hiddify-manager:v10.80.0
ports:
- "443:443"
- "80:80"
- "22:22"
- "80:80"
- "443:443"
- "53:53/udp"
- "53:53/tcp"
- "42238:42238/udp"
- "19572:19572/udp"
- "17573:17573/udp"
privileged: true
cap_add:
- NET_ADMIN
Expand Down
6 changes: 3 additions & 3 deletions hiddify-panel/app.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SECRET_KEY=Pl3453Ch4ng3
DEBUG=False
RUN_HOST=0.0.0.0
RUN_PORT=9000
SQLALCHEMY_DATABASE_URI=sqlite:////opt/hiddify-manager/hiddify-panel/hiddifypanelnew.db

REDIS_URI_MAIN=redis://:[email protected]:6379/0
REDIS_URI_SSH=redis://:[email protected]:6379/1
DB_VERSION=0SQLALCHEMY_DATABASE_URI ='mysql+mysqldb://hiddifypanel:MYSQL_STRONG_PASS@mariadb/hiddifypanel?charset=utf8mb4'
REDIS_URI_MAIN = 'redis://:REDIS_STRONG_PASS@redis:6379/0'
REDIS_URI_SSH = 'redis://:REDIS_STRONG_PASS@redis:6379/1'
7 changes: 7 additions & 0 deletions hiddify-panel/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ fi

pip uninstall -y flask-babelex >/dev/null 2>&1

if [ "${MODE}" == "install-docker" ];then
rm -rf /opt/hiddify-manager/hiddify-panel/src
mkdir -p /opt/hiddify-manager/hiddify-panel/src
git clone --depth 1 --branch main https://github.com/hiddify/hiddifypanel.git /opt/hiddify-manager/hiddify-panel/src
HIDDIFY_PANLE_SOURCE_DIR=/opt/hiddify-manager/hiddify-panel/src
fi

# install/build hiddifypanel package
if [ -n "$HIDDIFY_PANLE_SOURCE_DIR" ]; then
echo "NOTICE: building hiddifypanel package from source..."
Expand Down
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function main() {
clean_files
update_progress "${PROGRESS_ACTION}" "Common Tools and Requirements" 2
runsh install.sh common &
if [ "${DOCKER_MODE}" != "true" ];then
if [ "$MODE" != "install-docker" ];then
install_run other/redis &
install_run other/mysql &
fi
Expand Down Expand Up @@ -166,7 +166,7 @@ function set_config_from_hpanel() {

function install_run() {
echo "==========================================================="
if [ "$MODE" == "install-docker" ];then
if [ "$MODE" == "install-docker" ];then
runsh install.sh $1
return
elif [ "$DO_NOT_INSTALL" != "true" ];then
Expand Down
4 changes: 3 additions & 1 deletion other/wireguard/install.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ PostDown = ip6tables -t nat -D POSTROUTING -o ${SERVER_PUB_NIC} -j MASQUERADE" >
echo "net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1" >/etc/sysctl.d/wg.conf

sysctl --system > /dev/null
if [ "$MODE" != "install-docker" ];then
sysctl --system > /dev/null
fi

systemctl start "wg-quick@${SERVER_WG_NIC}"
systemctl enable "wg-quick@${SERVER_WG_NIC}"

0 comments on commit f135f17

Please sign in to comment.