вторник, 23 апреля 2024 г.

Docker PHP/MSSQL/APACHE

 Nova days many systems and solutions based on Docker. Sometime main issue is collaborating several solutions into one docker-file for running it.

My situation was similar and required to deploy solution which us using SQL Server PHP and Apache, unusual case :) Thats why was decided to implement two docker containers where in first will be executed SQL Server and on second PHP/Apache.

Below you can find steps:

1) Install Docker in your linux system.

    yum install docker 

2) Install SQL Server container into your docker system

    sudo docker pull mcr.microsoft.com/mssql/server:2022-latest

 

3) Need to create docker-file (nano Dockerfile.base in /usr/src)

FROM php:8.2-apache-buster

RUN apt update && apt install -y unixodbc-dev gpg libzip-dev \
 && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
 && curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list \
 && apt update \
 && ACCEPT_EULA=Y apt-get install -y msodbcsql18 \
 && pecl install sqlsrv \
 && pecl install pdo_sqlsrv \
 && docker-php-ext-install pdo opcache bcmath zip \
 && mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
 && echo 'extension=sqlsrv.so' >> "$PHP_INI_DIR/php.ini" \
 && echo 'extension=pdo_sqlsrv.so' >> "$PHP_INI_DIR/php.ini" \
 && a2enmod rewrite

 -------------------------------------------------------------------------------------

For building new container from your docker file need to use below command 

 docker build . -f Dockerfile.base -t 3cp-web 

 

воскресенье, 17 сентября 2023 г.

четверг, 18 июня 2020 г.

Backup to Network Drive

For backup to network drive user below command:

EXEC xp_cmdshell 'net use Z:  \\192.168.28.12\e$\PVGBACK P@yvand!@#45A /USER:Administrator /PERSISTENT:yes'
GO

After successfully executing go to backup settings (Maintenance - New - Backup) in destination field choose drive Z (configured through command before)


воскресенье, 20 января 2019 г.

Strognswan Mikrotik IPSec

Mikrotik

[admin@MikroTik] > /ip ipsec peer add address=StrongSWANIP/32 port=500 auth-method=pre-shared-key secret="PSK" generate-policy=no exchange-mode=main send-initial-contact=yes nat-traversal=no  proposal-check=obey      hash-algorithm=sha1 enc-algorithm=aes-256 dh-group=modp1024 lifetime=8h lifebytes=0 dpd-interval=2m dpd-maximum-failures=5

[admin@MikroTik] > /ip ipsec  policy add src-address=Mikrotik Private IP/24 src-port=any dst-address=Swan Private IP/24 dst-port=any protocol=all action=encrypt level=require ipsec-protocols=esp tunnel=yes sa-src-address=MikrotikPublicIP sa-dst-address=SwanPublicIP proposal=default priority=0

[admin@MikroTik] > /ip ipsec proposal set 0 auth-algorithms=sha1 enc-algorithms=3des lifetime=1h pfs-group=none


StrongSWAN

ipsec.conf

###Pv -Komils Home
conn tunnel 
   rightsendcert=never
    left=SWAN Public IP
    leftsubnet=SWAN Private IP/24
    right=Mikrotik Public IP
    rightsubnet=Mikrotik Private IP/24
    ike=aes256-sha1-modp1024!
    esp=3des-sha1!
    keyingtries=0
    ikelifetime=1h
    lifetime=8h
    dpddelay=30
    dpdtimeout=120
    dpdaction=clear
    authby=secret
    auto=start
    keyexchange=ikev1
    type=tunnel

ipsec.secret

SWAN_IP Mikrotik_IP : PSK 'PSK'

пятница, 11 января 2019 г.

Firewalld open specific port for IP

I hope you can find many articles about installation and deployment, but I faced to issues during open specific ports for IP. Below my example

firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="10.154.30.20" port protocol="udp" port="10000-10100" accept'
firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="10.154.30.20" port protocol="udp" port="4569" accept'
firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="10.154.30.20" port protocol="udp" port="2727" accept'
firewall-cmd --permanent --zone=public --add-rich-rule='rule family="ipv4" source address="10.154.30.20" port protocol="udp" port="5060-5061" accept'

Important to reload firewall after changes

firewall-cmd --reload

Hope will save life to someone :)

среда, 25 апреля 2018 г.

Lets Encrypt renew certificate

Thanks to Lets Encrypt for free certificates but certificates has feature of expiration and need to renew. Lets start, for renew certificate we need only one command:

certbot --authenticator standalone --installer apache -d domain.com -d www.domain.com --pre-hook "sudo systemctl stop httpd.service" --post-hook "sudo systemctl start httpd.service"

пятница, 29 декабря 2017 г.

Strongswan Cisco IPsec

 Приветствую,

Очень долго искал при поиске решений на облаке для подключения по IPsec и в итоге вот оно Strongwan, отличное решение на базе Линукс для такого рода задач. Ну в общем внизу хочу показать рабочий пример при подключении с моего сервера на Strongwan к роутеру Cisco 2801

- strongswan : wan ip : 185.105.229.61
                        lan ip: 192.168.29.0/24

- cisco             wan ip: 185.105.229.99
                       lan ip: 192.168.28.0/24



*** cisco side

!
crypto isakmp policy 15
 encr aes 256
 authentication pre-share
 group 2
!
crypto isakmp key mypassword address 185.105.229.61 no-xauth
crypto ipsec transform-set gw2 esp-aes 256 esp-sha-hmac

crypto ipsec df-bit clear

crypto map MAIN 14 ipsec-isakmp
 description GW2
 set peer 185.105.229.61
 set transform-set gw2
 match address gw2

ip route 192.168.29.1 255.255.255.255 185.105.229.61 permanent
ip route 192.168.29.7 255.255.255.255 185.105.229.61 permanent


ip access-list extended gw2
 permit ip 192.168.28.0 0.0.0.255 192.168.29.0 0.0.0.255
 permit icmp 192.168.28.0 0.0.0.255 192.168.29.0 0.0.0.255
 deny   ip any any

*** Strongswan side

config setup
charondebug="all"
        uniqueids=no
        strictcrlpolicy=no
conn %default
dpdaction=restart
        dpddelay=30
        ikelifetime=1440m
        keylife=60m
        rekeymargin=3m
        keyingtries=1
        keyexchange=ikev1
        authby=secret
conn cisco
left=185.105.229.61             #strongswan outside address
        leftid=185.105.229.61        #IKEID sent by strongswan
        leftsubnet=192.168.29.0/32 #network behind strongswan
        leftfirewall=yes
        right=185.105.229.99    #CISCO outside address
        rightsubnet=192.168.28.0/24 #network behind CISCO

Конечно же не надо прописать в /etc/ipsec.secret PSK формат примерно такой:

Left IP (Your IP) Right IP (Partner IP) : PSK 'mypassword'



вторник, 11 октября 2016 г.

STOP RMAN backup job

Sometimes RMAN job take long time and need to kill job to investigate problem, below script show you how to kill job.


SQL>SELECT p.SPID, s.sid, s.serial#, sw.EVENT, sw.SECONDS_IN_WAIT AS  SEC_WAIT, sw.STATE, CLIENT_INFO
FROM V$SESSION_WAIT sw, V$SESSION s, V$PROCESS p
WHERE s.client_info LIKE 'rman%'
AND s.SID=sw.SID
AND s.PADDR=p.ADDR;

When you found necessary data you should use below script to kill job

SQL> alter system kill session '683, 43845';

пятница, 30 сентября 2016 г.

MacOS сервер впн не ответил - MacOS VPN server not responded


С переходом на МАК возникает очень много не стандартных ситуаций, одна из которых настройка L2TP без Shared Secret, в Винде это просто если нет кей то Винде пофиг а вот Мак не в какую. Ну будем не беда, ниже приведена процедура как заставить МАК работать по VPN-у  без Shared Secret.


0. sudo su -- надо перейти к учетке администратора для выполнения комманд
1. Открываем терминал
2. Набираем sudo bash
3. Вводим свой пароль.
4. Набираем:
echo "plugin L2TP.ppp" >> /etc/ppp/options
echo "l2tpnoipsec" >> /etc/ppp/options
5. После этого настраиваем L2TP соединение, сертификат оно спрашивать не будет.


Удачи!

среда, 24 августа 2016 г.

LIST, REPORT, and DELETE Commands in RMAN


The LIST, REPORT, and DELETE Commands in RMAN
List Command:
The LIST command uses RMAN repository information and provide lists of backups, archived logs, and database incarnations.

Output of LIST command can be filtered BY BACKUP and BY FILE option.

1)RMAN> list backup; #List all your backup sets.
2)RMAN>LIST BACKUPSET; #Lists only backup sets and proxy copies.
3)RMAN>LIST COPY; #Lists of Image copies and Archive Logs.
4)RMAN>LIST EXPIRED BACKUP; #Backups did not found after crosscheck. That is backup is manually moved or deleted from OS.
5)RMAN>LIST BACKUP BY FILE; #List backup by Datafile, controlfile, spfile.
6)RMAN>LIST BACKUP SUMMARY; #Lists backup sets, proxy copies, and disk copies.
7)LIST BACKUP OF DATABASE; LIST BACKUP LIKE '/tmp/%'; list backup of datafile 1; LIST ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE sbt;LIST COPY OF DATAFILE 2 COMPLETED BETWEEN '17-MAR-2008' AND '22-MAR-2008'; are also available.
8) LIST INCARNATION; LIST INCARNATION OF DATABASE; to see the incarnations of your database.

Report Command:
RMAN REPORT command analyzes the available backups and return results about while files need backup which files are obsolete etc.

Remember the result of REPORT command is based on repository data. So, if backups have been deleted from disk or tape outside of RMAN, reports generated by RMAN do not automatically reflect these changes.

So before report it is good to run CROSSCHECK of all backup in order to update repository.

1)REPORT NEED BACKUP; # Determine which database files need backup under a specific retention policy.

2)REPORT UNRECOVERABLE; #Report which database files require backup because they have been affected by some NOLOGGING operation.

3)REPORT SCHEMA; #Lists and displays information about the database files.

4)REPORT OBSOLETE; #REPORT OBSOLETE displays the backups that are obsolete according to the current retention policy.

5)REPORT NEED BACKUP RECOVERY WINDOW OF 2 DAYS DATABASE SKIP TABLESPACE data01;

If you use Recovery Catalog then past data can be shown.
Like, REPORT SCHEMA AT TIME 'SYSDATE-10';


Delete Command:
Delete commands is used to delete any backup or backupsets.
1)Delete all your backup sets RMAN> delete backupset all;
2)Delete all image copies. RMAN> delete copy all;
3)Delete obsolete Backups. RMAN>DELETE OBSOLETE;
4)Delete backup using BP Key from LIST output.
RMAN> list backup;


List of Backup Sets
===================

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
1       391.11M    DISK        00:00:24     25-SEP-11
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20110925T140027
        Piece Name: E:\01MNEFNS_1_1

  List of Archived Logs in backup set 1
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    114     4715501    08-SEP-11 4725766    08-SEP-11
  1    115     4725766    08-SEP-11 4737735    08-SEP-11
  1    116     4737735    08-SEP-11 4747351    08-SEP-11
  1    117     4747351    08-SEP-11 4753345    08-SEP-11
  1    118     4753345    08-SEP-11 4784439    11-SEP-11
  1    119     4784439    11-SEP-11 4814646    11-SEP-11
  1    120     4814646    11-SEP-11 4908843    12-SEP-11
  1    121     4908843    12-SEP-11 5000884    12-SEP-11
  1    122     5000884    12-SEP-11 5020912    13-SEP-11
  1    123     5020912    13-SEP-11 5057538    14-SEP-11
  1    124     5057538    14-SEP-11 5078712    25-SEP-11
  1    125     5078712    25-SEP-11 5079309    25-SEP-11
  1    126     5079309    25-SEP-11 5079467    25-SEP-11

RMAN> delete backuppiece 1;

using channel ORA_DISK_1

List of Backup Pieces
BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
1       1       1   1   AVAILABLE   DISK        E:\01MNEFNS_1_1
Do you really want to delete the above objects (enter YES or NO)?

5) Delete backups by filename on disk: DELETE CONTROLFILECOPY '/tmp/ctl01.ctl';

6) Delete archive logs from disk based on sequence: DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 5;

7) Delete backups based on tags: DELETE BACKUP TAG='special_tag';

8) Delete expired RMAN backup using CROSSCHECK
CROSSCHECK BACKUP;
DELETE EXPIRED BACKUP;

9) Delete obsolete RMAN backups. DELETE OBSOLETE;
You can also use the REDUNDANCY or RECOVERY WINDOW clauses with DELETE to delete backups obsolete under a specific retention policy instead of the configured default:

For example:
DELETE OBSOLETE REDUNDANCY = 2;
DELETE OBSOLETE RECOVERY WINDOW OF 4 DAYS;

Oracle Backup

     1.  Steps to configure Fast Recovery Area (FRA)

SQL> set ORACLE_SID=<ORACLE_SID_NAME> (this command not required if there is only one DB running on the server)
SQL> alter system set db_recovery_file_dest_size = 100G scope=both; (depends on the Disk space available)
SQL> alter system set db_recovery_file_deste = 'd:\fast_recovery_area' scope=both; (d:\fast_recovery_area must be created)

     2.  Steps to configure ARCHIVELOG mode

SQL> alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST';
SQL>shutdown immediate
SQL>startup mount
SQL>alter database archivelog;
SQL> alter database flashback on;
SQL> alter database open;
SQL> archive log list;
SQL> alter system switch logfile; (this will create the archive log files in FRA)

     3. Steps to configure RMAN parameters;

C:\> rman target /
RMAN> show all;
RMAN> configure retention policy to recovery window of 3 days; (you can specify 3 or 7 days as per the policy)
RMAN> configure backup optimization on;
RMAN> configure controlfile autobackup on;

RMAN> show all;

Oracle Backup

     1.  Steps to configure Fast Recovery Area (FRA)

SQL> set ORACLE_SID=<ORACLE_SID_NAME> (this command not required if there is only one DB running on the server)
SQL> alter system set db_recovery_file_dest_size = 100G scope=both; (depends on the Disk space available)
SQL> alter system set db_recovery_file_deste = 'd:\fast_recovery_area' scope=both; (d:\fast_recovery_area must be created)

     2.  Steps to configure ARCHIVELOG mode

SQL> alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST';
SQL>shutdown immediate
SQL>startup mount
SQL>alter database archivelog;
SQL> alter database flashback on;
SQL> alter database open;
SQL> archive log list;
SQL> alter system switch logfile; (this will create the archive log files in FRA)

     3. Steps to configure RMAN parameters;

C:\> rman target /
RMAN> show all;
RMAN> configure retention policy to recovery window of 3 days; (you can specify 3 or 7 days as per the policy)
RMAN> configure backup optimization on;
RMAN> configure controlfile autobackup on;

RMAN> show all;

Oracle UTF-8

Hello,

Most of times when we deployed our projects in some Cyrillic supported country we meet with problem to display properly. Thats why I am posting this solution here may be it saved your time.

Do not hesitate  to commenting :)

1) Enter from sqlplus / as sysdba
2)shutdown immediate

Database closed.
Database dismounted.
ORACLE instance shut down.
3) startup restrict
ORACLE instance started.

Total System Global Area 2.0602E+10 bytes
Fixed Size                  3842760 bytes
Variable Size            2751466808 bytes
Database Buffers         1.7784E+10 bytes
Redo Buffers               63262720 bytes
Database mounted.
Database opened.

4)alter database character set INTERNAL_USE AL32UTF8;

Database altered.

5)alter database character set AL32UTF8;

Database altered.

6) shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
7) startup
ORACLE instance started.

Total System Global Area 2.0602E+10 bytes
Fixed Size                  3842760 bytes
Variable Size            2751466808 bytes
Database Buffers         1.7784E+10 bytes
Redo Buffers               63262720 bytes
Database mounted.
Database opened.

вторник, 10 мая 2016 г.

Port forward in Windows

Hi, again problem with connection between VMWare and Cisco router, router allow connection just from one machine but we have to use also second server.

So our solution is NETSH in Windows, we will create this rules in first Windows machine which have access to Cisco:

Command for port forwarding
netsh interface portproxy add v4tov4 listenaddress=192.168.28.30 listenport=8099 connectaddress=192.168.20.96 connectport=8083

Command for check result
netsh interface portproxy show all

Command for delete rule
netsh interface portproxy delete v4tov4 listenport=8099 lictenaddress=192.168.1.30

четверг, 5 мая 2016 г.

ORA-39006: internal error; ORA-39213: Metadata processing is not available;

Oracle 11.2.0.3 - 64 bit on Windows


When using IMPDP you get the error :


ORA-39006: internal error

ORA-39213: Metadata processing is not available


Workaround 


sqlplus / as sysdba

SQL> execute sys.dbms_metadata_util.load_stylesheets;

ORA-39006: internal error; ORA-39213: Metadata processing is not available;

Oracle 11.2.0.3 - 64 bit on Windows


When using IMPDP you get the error :


ORA-39006: internal error

ORA-39213: Metadata processing is not available


Workaround 


sqlplus / as sysdba

SQL> execute sys.dbms_metadata_util.load_stylesheets;

среда, 23 марта 2016 г.

Port 80 already in use

Port 80 already in use
Hi Dears, always after installation XAMP or other WEB server we meet with problem when Apache can not start properly because port 80 busy now, so below I write little and fast guide I hope it will save time for somebody.

1) Press Start and type "cmd"  then click right button of mouse and start as Administrator
2) After type "netstat -a -n -o"
3) On fields PID you see pid of process which used port 80
4) In cmd type tasklist /svc /FI "PID eq 1348" where is PID your PID of process which used port 80
5) Open Task Manager and in Processes find needed process and kill and start Apache

вторник, 18 августа 2015 г.

ERROR 1045 (28000) Access denied for user 'root'@'localhost'

Запускаем в режиме без проверки прав доступа: /usr/bin/mysqld_safe --skip-grant-tables & Соединяемся как root без пароля: mysql --user=root mysql Обновляем пароль: mysql> update user set Password=PASSWORD('новый пароль') WHERE User='root'; mysql> flush privileges; Перезапускаем БД и пробуем войти под рутом с паролем mysql -u root -p

четверг, 5 марта 2015 г.

Tajik MAC, Таджикский язык в МАК-е, Забонӣ тоҷики дар МАК

https://dl.dropbox.com/u/46870715/k/tajik.zip  --ин нишони барнома

Барои истифода архив-ро кушода папкаи tajik-ро дар Home/Library/Keyboard Layouts  гузоред, баъд аз он МАК-ро хомуш карда аз нав гирон кунед. Барори кор :)

https://dl.dropbox.com/u/46870715/k/tajik.zip  --path for download


Download and unpack then put in  Home/Library/Keyboard Layouts. Restart your MAC and can use Tajiki language

среда, 25 февраля 2015 г.

Find and copy file to FTP

Hi dears, so another new task is copy file by mask from Lunux server to FTP, lets start:


find ./ -iname "orec*" -type f  -mmin -600 | xargs -I {} ftp -u ftp://login:pasword@172.16.10.2:21/msc/ {}

so its end :) 

Общее·количество·просмотров·страницы