Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9451d11
adding staging aut dep on hagrid-prod2 -n threefoldconnect-staging
PeterNashaat May 22, 2024
09ef80d
missing step name in staging workflow
PeterNashaat May 22, 2024
ed3abe0
fix wizard dockerfile
PeterNashaat May 22, 2024
5830ba4
fix wizard workflow & values file
hossnys May 22, 2024
e3bb4de
fix pvc name
hossnys May 22, 2024
bd40a46
fix staging config file and update workflow
hossnys May 23, 2024
a15cd18
Merge branch 'development' into staging
AhmedHanafy725 May 26, 2024
4fe7bfb
Update the backend server to user newer version of socket io
AhmedHanafy725 Nov 23, 2025
ae4ee09
Update dockerfile and packages
AhmedHanafy725 Nov 23, 2025
36935f7
More updates
AhmedHanafy725 Nov 23, 2025
231bdf3
Update nginx config
AhmedHanafy725 Nov 23, 2025
6c7aa86
Update uwsgi config
AhmedHanafy725 Nov 23, 2025
9795f7b
More updates for nignx and uwsgi
AhmedHanafy725 Nov 23, 2025
b4455a3
Update packages
AhmedHanafy725 Nov 23, 2025
77434b1
Revert to gevent
AhmedHanafy725 Nov 23, 2025
1819bf6
Merge remote-tracking branch 'origin/staging' into development_update…
AhmedHanafy725 Nov 24, 2025
9de5fbe
Fix wizard docker image
AhmedHanafy725 Nov 24, 2025
d400198
Change the base image for the wizard
AhmedHanafy725 Nov 24, 2025
cb86073
Fix the frontend to use the same version of socketio as the backend
AhmedHanafy725 Nov 24, 2025
b1e2e89
Update yarn lock file
AhmedHanafy725 Nov 24, 2025
851f805
Add dispatch methods for the events
AhmedHanafy725 Nov 24, 2025
75404e6
Update the minimum version to 195
AhmedHanafy725 Nov 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/old_wfs/staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: staging

on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
jobs:
build:
runs-on: ubuntu-latest
steps:
# - uses: actions/checkout@v1
# - uses: actions/setup-java@v1
# with:
# java-version: '12.x'

# # Setup the flutter environment.
# - uses: subosito/flutter-action@v1
# with:
# channel: 'stable' # 'dev', 'alpha', default to: 'stable'
# flutter-version: '2.10.1' # you can also specify exact version of flutter

# # Get flutter dependencies.
# - run: cd app && flutter pub get

# # Check for any formatting issues in the code.
# - run: flutter format --set-exit-if-changed .

# # Statically analyze the Dart code for any errors.
# - run: flutter analyze .

# # Build apk.
# - run: flutter build apk

# # Upload generated apk to the artifacts.
# - uses: actions/upload-artifact@v1
# with:
# name: release-apk
# path: app/apks/app-release.apk

- uses: actions/checkout@v2
- name: Login to docker hub
run: docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_TOKEN }}
- name: Set config
run: mv frontend/public/config.staging.js frontend/public/config.js
- name: Build the Docker image
run: docker build . --file Dockerfile --tag jimber/3botlogin:staging-${{ github.sha }}
- name: Push the Docker image
run: docker push jimber/3botlogin:staging-${{ github.sha }}

deploy:
needs: build
runs-on: tfc-connect-staging
steps:
- name: Login to docker hub
run: docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_TOKEN }}
- name: kill old docker
run: docker rm -f 3botlogin || true
- name: Pull Image
run: docker pull jimber/3botlogin:staging-${{ github.sha }}
- name: Run new docker
run: docker run -d -it --restart=unless-stopped --name 3botlogin -v /opt/3botlogin/pythonsqlite.db:/usr/share/nginx/backend/pythonsqlite.db -v /opt/3botlogin/config.ini:/usr/share/nginx/backend/config.ini --network=proxy jimber/3botlogin:staging-${{ github.sha }}
Empty file.
71 changes: 25 additions & 46 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,33 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
# - uses: actions/checkout@v1
# - uses: actions/setup-java@v1
# with:
# java-version: '12.x'

# # Setup the flutter environment.
# - uses: subosito/flutter-action@v1
# with:
# channel: 'stable' # 'dev', 'alpha', default to: 'stable'
# flutter-version: '2.10.1' # you can also specify exact version of flutter

# # Get flutter dependencies.
# - run: cd app && flutter pub get

# # Check for any formatting issues in the code.
# - run: flutter format --set-exit-if-changed .

# # Statically analyze the Dart code for any errors.
# - run: flutter analyze .

# # Build apk.
# - run: flutter build apk

# # Upload generated apk to the artifacts.
# - uses: actions/upload-artifact@v1
# with:
# name: release-apk
# path: app/apks/app-release.apk

- uses: actions/checkout@v2
- name: Login to docker hub
run: docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_TOKEN }}
- name: Log into Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.TFDOCKERHUB_USERNAME }}
password: ${{ secrets.TFDOCKERHUB_PASSWORD }}

- name: Set config
run: mv frontend/public/config.staging.js frontend/public/config.js
- name: Build the Docker image
run: docker build . --file Dockerfile --tag jimber/3botlogin:staging-${{ github.sha }}
- name: Push the Docker image
run: docker push jimber/3botlogin:staging-${{ github.sha }}

- name: Build the 3botlogin Docker image
run: docker build . --file Dockerfile --tag threefolddev/3botlogin:staging-${{ github.sha }}
- name: Push the 3botlogin Docker image
run: docker push threefolddev/3botlogin:staging-${{ github.sha }}
- name: Build wizard Docker image
run: docker build wizard/ --file wizard/Dockerfile --tag threefolddev/wizard:staging-${{ github.sha }}
- name: Push wizard Docker image
run: docker push threefolddev/wizard:staging-${{ github.sha }}

deploy:
needs: build
runs-on: tfc-connect-staging
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Login to docker hub
run: docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_TOKEN }}
- name: kill old docker
run: docker rm -f 3botlogin || true
- name: Pull Image
run: docker pull jimber/3botlogin:staging-${{ github.sha }}
- name: Run new docker
run: docker run -d -it --restart=unless-stopped --name 3botlogin -v /opt/3botlogin/pythonsqlite.db:/usr/share/nginx/backend/pythonsqlite.db -v /opt/3botlogin/config.ini:/usr/share/nginx/backend/config.ini --network=proxy jimber/3botlogin:staging-${{ github.sha }}
- uses: actions/checkout@v2
- name: Set authorization certificate
run: |
mkdir ${HOME}/.kube
echo ${{ secrets.TF_KUBE_CONFIG }} | base64 --decode > ${HOME}/.kube/config
- name: Install or Upgrade production on cluster
run: |
helm upgrade threebotlogin --install helm_files -f helm_files/valuesStaging.yaml --set images.login.tag=staging-${{ github.sha }} --set images.wizard.tag=staging-${{ github.sha }} -n threefoldconnect-staging
30 changes: 20 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12 as builder
FROM node:16 AS builder

COPY frontend /frontend
WORKDIR /frontend
Expand All @@ -13,16 +13,26 @@ WORKDIR /wizard
RUN yarn install --frozen-lockfile && yarn build


FROM nginx:1.21.1
FROM nginx:1.25
COPY backend/requirements.txt requirements.txt

RUN apt update && apt install -y python3 python3-pip gcc libssl-dev python-gevent
RUN CFLAGS="-I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib" \
UWSGI_PROFILE_OVERRIDE=ssl=true pip3 install uwsgi==2.0.19.1 -Iv
# RUN pip3 install flask flask_socketio flask_cors pyfcm pynacl
RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt --ignore-installed
RUN pip3 install gevent
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
gcc \
libssl-dev \
python3-dev \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --break-system-packages uwsgi==2.0.26
RUN pip3 install --break-system-packages --upgrade pip
# Install stellar-sdk first to get compatible yarl version
RUN pip3 install --break-system-packages stellar-sdk==9.1.0
# Increase timeout and retries for slow network connections
RUN pip3 install --break-system-packages \
--default-timeout=100 \
--retries=5 \
-r requirements.txt --ignore-installed

COPY --from=builder /frontend/dist /var/www/html/frontend
# COPY --from=builder /example/dist /var/www/html/example
Expand All @@ -35,4 +45,4 @@ COPY services.sh /services.sh
RUN chmod +x /services.sh
WORKDIR /usr/share/nginx/backend/

CMD /./services.sh
CMD ["/services.sh"]
2 changes: 1 addition & 1 deletion backend/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
logging.getLogger("engineio").setLevel(level=logging.ERROR)

# check_blockchain()
sio.init_app(app, cors_allowed_origins="*")
sio.init_app(app)

if __name__ == "__main__":
sio.run(app, host="0.0.0.0", port=5000)
19 changes: 10 additions & 9 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ entrypoints==0.3
Flask==2.0.1
Flask-Cors==3.0.10
Flask-RESTful==0.3.9
Flask-SocketIO==4.3.2
gevent==21.1.2
greenlet==1.1.0
Flask-SocketIO==5.3.6
gevent==24.2.1
greenlet==3.0.3
gevent-websocket==0.10.1
idna==2.10
itsdangerous==2.0.1
Jinja2==3.0.1
Expand All @@ -24,17 +25,17 @@ pycparser==2.20
pycrypto==2.6.1
pyfcm==1.5.3
PyNaCl==1.4.0
python-engineio==3.14.2
python-socketio==4.6.1
python-engineio==4.9.0
python-socketio==5.11.0
pytz==2021.1
pyxdg==0.27
requests==2.25.1
requests==2.31.0
requests-toolbelt==0.9.1
SecretStorage==3.3.1
six==1.15.0
SQLAlchemy==1.4.22
urllib3==1.26.4
uWSGI==2.0.19.1
urllib3==2.0.7
uWSGI==2.0.26
Werkzeug==2.0.1
stellar-sdk==3.3.1
stellar-sdk==9.1.0
nanoid==2.0.0
2 changes: 1 addition & 1 deletion backend/routes/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
@api_misc.route("/minimumversion", methods=["get"])
def minimum_version_handler():
response = Response(
response=json.dumps({"android": 184, "ios": 183}), mimetype="application/json"
response=json.dumps({"android": 195, "ios": 195}), mimetype="application/json"
)
return response

Expand Down
10 changes: 9 additions & 1 deletion backend/services/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
import database as db
from services.logger import logger

sio = SocketIO(transports=["websocket"])
sio = SocketIO(
cors_allowed_origins="*",
async_mode='gevent_uwsgi',
logger=False,
engineio_logger=False,
ping_timeout=60,
ping_interval=25,
allow_upgrades=True,
)

usersInRoom = {}
messageQueue = {}
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"axios": "^1.8.2",
"socket.io-client": "^4.7.5",
"bip39": "^2.5.0",
"libsodium": "^0.7.6",
"libsodium-wrappers": "^0.7.6",
Expand Down
4 changes: 2 additions & 2 deletions frontend/public/config.staging.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default ({
apiurl: 'https://login.staging.jimber.io/',
openkycurl: 'https://openkyc.staging.jimber.io/',
apiurl: 'https://login.staging.threefold.me/',
openkycurl: 'https://kyc.staging.threefold.me/',
deeplink: 'threebot-staging://'
})
9 changes: 8 additions & 1 deletion frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ import router from './router'
import store from './store'
import './plugins'
import './style.scss'
import socket from './services/socketClient'

Vue.config.productionTip = false

// Expose Socket.IO client instance on Vue prototype
Vue.prototype.$socket = socket

router.beforeEach((to, from, next) => {
console.log(`to.name == ${to.name}`)
if ((to.name !== 'initial' && to.name !== 'error' && to.name !== 'verifyemail' && to.name !== 'verifysms' && to.name !== 'sign') && !store.state.doubleName) {
Expand All @@ -17,8 +22,10 @@ router.beforeEach((to, from, next) => {
}
})

export default new Vue({
const vm = new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')

export default vm
1 change: 0 additions & 1 deletion frontend/src/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
import './socketio'
import './vuetify'
import './uuid'
49 changes: 49 additions & 0 deletions frontend/src/services/socketClient.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { io } from "socket.io-client";
import config from "../../public/config";
import store from "../store";

// Shared Socket.IO client for the Vue app
// Uses same apiurl as the existing frontend config
const socket = io(config.apiurl, {
transports: ["websocket", "polling"],
withCredentials: true,
});

// Recreate vue-socket-io's SOCKET_* → Vuex action mapping
socket.on("connect", () => {
store.dispatch("SOCKET_connect");
});

socket.on("nameknown", () => {
store.dispatch("SOCKET_nameknown");
});

socket.on("namenotknown", () => {
store.dispatch("SOCKET_namenotknown");
});

socket.on("cancelLogin", () => {
store.dispatch("SOCKET_cancelLogin");
});

socket.on("cancelSign", () => {
store.dispatch("SOCKET_cancelSign");
});

socket.on("signedAttempt", (data) => {
store.dispatch("SOCKET_signedAttempt", data);
});

socket.on("signedSignDataAttempt", (data) => {
store.dispatch("SOCKET_signedSignDataAttempt", data);
});

socket.on("phoneverified", () => {
store.dispatch("SOCKET_phoneverified");
});

socket.on("emailverified", () => {
store.dispatch("SOCKET_emailverified");
});

export default socket;
Loading