Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy/deployment #116

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/workflows/check-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@ jobs:
- name: Build npm on production mode
run: npm run build
working-directory: ./Website/ui

32 changes: 32 additions & 0 deletions .github/workflows/mpm-be.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push MPM Backend Image

on:
push:
branches:
- ft/deployment

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./Website/htdocs/mpmanager
file: ./Website/htdocs/mpmanager/Dockerfile
platforms: linux/amd64
push: true
tags: enaccess/mpm-backend:latest
32 changes: 32 additions & 0 deletions .github/workflows/mpm-fe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Push MPM Frontend Image

on:
push:
branches:
- ft/deployment

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./Website/ui
file: ./Website/ui/Dockerfile
platforms: linux/amd64
push: true
tags: enaccess/mpm-frontend:latest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ install-production.sh
# Sphinx documentation
docs/_build/
docs/build/
k8s/secrets/mpm-secrets.yaml
2 changes: 2 additions & 0 deletions Website/htdocs/mpmanager/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/vendor
/node_modules
2 changes: 1 addition & 1 deletion Website/htdocs/mpmanager/.env
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ REDIS_PASSWORD=null
REDIS_PORT=6379
HORIZON_PREFIX="horizon:"

JWT_SECRET="YOUR-JWT-SECRET"
JWT_SECRET="wjV7AQC3uEWpmZHQzR3G9mlWxV0O9dTQDFZAeyWIdmm1LF38KrMN1Mzy3gj7czQz"
LOG_SLACK_WEBHOOK_URL="http://slackchannel.com"

QUEUES="local_payment, local_energy_payment, local_token,local_sms, local_history,local_sms_gateway,local_sms_gateway_1,local_sms_gateway_2,local_report_generator,local_misc"
Expand Down
53 changes: 53 additions & 0 deletions Website/htdocs/mpmanager/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
FROM php:8.2-apache

WORKDIR /app
COPY . /app

RUN apt-get update && \
apt-get install -y \
cron \
libjpeg-dev \
libfreetype6-dev \
libxml2-dev \
libssl-dev \
mariadb-client \
zlib1g-dev \
bzip2 \
supervisor \
libzip-dev \
vim \
git \
zsh

# install ohmyzsh
RUN chsh -s $(which zsh)
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# add php artisan alias
RUN echo 'alias "cmd=php artisan"' >> ~/.zshrc

# remove apt lists
RUN rm -rf /var/lib/apt/lists/*

# install php extentions
RUN docker-php-ext-install gd mysqli zip pdo pdo_mysql soap ftp opcache bcmath pcntl
RUN docker-php-ext-configure gd --with-freetype --with-jpeg\
&& docker-php-ext-configure pcntl --enable-pcntl

RUN touch /usr/local/etc/php/conf.d/xdebug.ini; \
echo xdebug.remote_enable=1 >> /usr/local/etc/php/conf.d/xdebug.ini; \
echo xdebug.remote_autostart=0 >> /usr/local/etc/php/conf.d/xdebug.ini; \
echo xdebug.remote_connephpct_back=1 >> /usr/local/etc/php/conf.d/xdebug.ini; \
echo xdebug.remote_port=9000 >> /usr/local/etc/php/conf.d/xdebug.ini; \
echo xdebug.remote_log=/tmp/php5-xdebug.log >> /usr/local/etc/php/conf.d/xdebug.ini;log=/tmp/php5-xdebug.log >> /usr/local/etc/php/conf.d/xdebug.ini;

RUN php composer.phar install

EXPOSE 80

COPY vhost.conf /etc/apache2/sites-available/000-default.conf

RUN chown -R www-data:www-data /app
RUN chmod -R 775 /app/storage

RUN a2enmod rewrite
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('shard')->create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('company_id')->unsigned();
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('shard')->dropIfExists('users');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('shard')->create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('shard')->dropIfExists('password_resets');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('shard')->create('vodacom_transactions', function (Blueprint $table) {
$table->increments('id');
$table->string('conversation_id')->unique();
$table->string('originator_conversation_id')->unique();
$table->string('mpesa_receipt');
$table->dateTime('transaction_date');
$table->string('transaction_id')->unique();
$table->integer('status')->default(0);
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('shard')->dropIfExists('vodacom_transactions');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('shard')->create('transactions', function (Blueprint $table) {
$table->increments('id');
$table->integer('original_transaction_id');
$table->string('original_transaction_type');
$table->integer('amount');
$table->enum('type', ['energy', 'deferred_payment', 'unknown'])->default('unknown');
$table->string('sender');
$table->string('message');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('shard')->dropIfExists('transactions');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('shard')->create('airtel_transactions', function (Blueprint $table) {
$table->increments('id');
$table->string('interface_id');
$table->string('business_number');
$table->string('trans_id');
$table->string('tr_id');
$table->integer('status')->default(0);
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('shard')->dropIfExists('aritel_transactions');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('shard')->create('payment_histories', function (Blueprint $table) {
$table->increments('id');
$table->integer('amount');
$table->integer('transaction_id');
$table->string('payment_service');
$table->string('sender');
$table->string('payment_type'); // energy, loand, etc.
$table->morphs('paid_for'); // meter_id, loan_id
$table->morphs('payer');
$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('shard')->dropIfExists('payment_histories');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::connection('shard')->create('meter_tariffs', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('price');
$table->string('currency', 20);
$table->integer('factor')->nullable();
$table->timestamps();
$table->softDeletes();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('shard')->dropIfExists('tariffs');
}
};
Loading
Loading