Skip to content

Commit

Permalink
Merge pull request #60 from 101t/3.0.0
Browse files Browse the repository at this point in the history
3.0.0
  • Loading branch information
101t authored Jul 27, 2023
2 parents 5b90077 + 233bc74 commit d7dfe74
Show file tree
Hide file tree
Showing 117 changed files with 6,364 additions and 1,381 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ Dockerfile
.cache
*.md
!README*.md
env/
venv/

logs/
public/
docker-compose.yml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ staticfiles
# virtual environments
.env
env/
venv/
db.sqlite3

# Hitch directory
Expand Down
12 changes: 0 additions & 12 deletions .vscode/settings.json

This file was deleted.

101 changes: 0 additions & 101 deletions DEVELOPMENT.md

This file was deleted.

46 changes: 0 additions & 46 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ docker pull tarekaec/jasmin_web_panel
```
also you could build it on you local machine by navigating to project directory
```shell
docker build -t jasmin_web_panel:1.0 .
docker build -f config/docker/slim/Dockerfile -t jasmin_web_panel:1.0 .
```
You need to configure the environment variable in `.env` file
```shell
Expand Down
10 changes: 5 additions & 5 deletions Sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ TIME_ZONE=Etc/GMT-3
LANGUAGE_CODE=en
SITE_ID=1

MYSQLDB_URL=mysql://root:[email protected]/jasmin_web_db
SQLITE3_URL=sqlite:///db.sqlite3
POSTGRE_URL=postgres://postgres:123@127.0.0.1:5432/jasmin_web_db
# mysql://root:[email protected]/jasmin_web_db
# sqlite:///db.sqlite3
# postgres://jasmin:jasmin@127.0.0.1:5432/jasmin

DEVDB_URL=sqlite:///db.sqlite3
PRODB_URL=postgres://postgres:123@127.0.0.1:5432/jasmin_web_db
PRODB_URL=postgres://jasmin:jasmin@127.0.0.1:5432/jasmin

# REDIS_HOST=localhost
# REDIS_PORT=6379
# REDIS_DB=0

ACTIVE_APP=web
ALLOWED_HOSTS=*
CSRF_TRUSTED_ORIGINS=

TELNET_HOST=127.0.0.1
TELNET_PORT=8990
Expand Down
5 changes: 0 additions & 5 deletions celery_run.sh

This file was deleted.

36 changes: 36 additions & 0 deletions config/celery.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
from django.conf import settings
from celery import Celery
from celery.utils.log import get_task_logger

from django.utils import timezone

logger = get_task_logger(__name__)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.dev")

app = Celery('config')

app.config_from_object("django.conf:settings", namespace="CELERY")
app.conf.broker_url = settings.CELERY_BROKER_URL
app.conf.result_backend = settings.CELERY_RESULT_BACKEND
app.conf.broker_connection_max_retries = 0
app.conf.broker_connection_retry_on_startup = True
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS, related_name='tasks')

BROKER_CONNECTION_TIMEOUT = 120

CELERY_DEFAULT_UP_TIME = timezone.now()


@app.task(bind=True)
def debug_task(self):
print("Request: {0!r}".format(self.Request))


def revoke_task(task_id):
app.control.revoke(task_id)


def clear_tasks():
return app.control.purge()
48 changes: 48 additions & 0 deletions config/docker/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM alpine:3.11

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV JASMIN_HOME=/jasmin
ENV PATH="${PATH}:/jasmin"

# RUN mkdir /jasmin
RUN addgroup -S jasmin && adduser -S jasmin -G jasmin -h $JASMIN_HOME

#RUN apk del busybox-extras
RUN apk --update --no-cache upgrade
RUN apk add python3 --repository=http://dl-cdn.alpinelinux.org/alpine/v3.11/main && ln -sf python3 /usr/bin/python
# RUN apk search busybox-extras
RUN apk add busybox-extras
# RUN busybox --list
# RUN apk add --no-cache bash curl nmap apache2-utils bind-tools tcpdump mtr iperf3 strace tree busybox-extras netcat-openbsd
RUN echo alias telnet='busybox-extras telnet' >> .bashrc
RUN telnet google.com 80

RUN apk add --update build-base git gcc cmake py3-setuptools py3-pip python3-dev bash

# RUN apk add --no-cache bash

WORKDIR $JASMIN_HOME

USER jasmin

RUN mkdir -p $JASMIN_HOME/public/media
RUN mkdir -p $JASMIN_HOME/public/static

# RUN chown -R jasmin:jasmin $JASMIN_HOME/

COPY --chown=jasmin:jasmin ./requirements.txt $JASMIN_HOME/requirements.txt

ENV PATH="${PATH}:/jasmin/.local/bin"

RUN pip3 install --upgrade pip && pip3 install -r requirements.txt

COPY --chown=jasmin:jasmin . $JASMIN_HOME

COPY --chown=jasmin:jasmin ./docker-entrypoint.sh docker-entrypoint.sh

# RUN chown -R jasmin:jasmin $JASMIN_HOME/

# USER root

ENTRYPOINT ["docker-entrypoint.sh"]
34 changes: 34 additions & 0 deletions config/docker/alpine/docker-compose-alpine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3.7'

services:
jasmin_web:
image: tarekaec/jasmin_web_panel:1.0-alpine
ports:
- "8000:8000"
deploy:
replicas: 1
env_file:
- .env
environment:
JASMIN_PORT: 8000
healthcheck:
disable: true
volumes:
- ./public:/web/public
# entrypoint: /jasmin/docker-entrypoint.sh
jasmin_celery:
image: tarekaec/jasmin_web_panel:1.0-alpine
deploy:
replicas: 1
env_file:
- .env
environment:
DEBUG: 0
healthcheck:
disable: true
depends_on:
- jasmin_redis
entrypoint: /jasmin/celery_run.sh
jasmin_redis:
image: redis:alpine
tty: true
6 changes: 6 additions & 0 deletions config/docker/jasmin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Jasmin SMS Gateway
This is the docker version of jasmin sms gateway

```shell
docker stack deploy -c config/docker/jasmin/docker-compose.yml jasmin
```
Loading

0 comments on commit d7dfe74

Please sign in to comment.