We will be using an Ubuntu server os for the above. Please update OS using commands below:
sudo apt-update sudo apt-upgrade
Install the dependencies before installing Gitlab:
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
For Gitlab EE, you can refer to the following link: https://about.gitlab.com/install/#ubuntu. It just has different installation Curl URL. We will be using Gitlab-CE for installation using a different CURL URL. The rest of the process will be same for any Gitlab installation.
Get package of Gitlab CE - community edition from the link below by using the curl command therein. https://packages.gitlab.com/gitlab/gitlab-ce/install
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
Install Gitlab using the command below:
sudo apt-get install gitlab-ce
After completion of installation, edit the gitlab configuration file below:
sudo nano /etc/gitlab/gitlab.rb
Uncomment and change the following entries to your own domain name and the localhost port that you would like to use (Be sure to allow the port in your firewall).
external_url 'https://yourgitlab.example.com' gitlab_rails['trusted_proxies'] = ['127.0.0.1'] nginx['listen_port'] = 9000 nginx['listen_https'] = false
Update the Gitlab configuration by running the command:
sudo gitlab-ctl reconfigure
Create the website domain in aaPanel and update the Reverse Proxy menu. Click Add for adding new reverse proxy.
Target URL: http://127.0.0.1:9000/ Sent Domain: $http_host
Click on conf for manual editing. Check of the following values and update any if required.
proxy_pass http://127.0.0.1:9000/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_http_version 1.1;
Congratulations! Now your Gitlab web app is accessible in your require domain/subdomain using reverse proxy in the same web server where you can host other websites as well.
]]>You can install the required packages for database and python related files from Ubuntu apt repository. First you need to update the package indexes before downloading and installing any other packages, with the following command in terminal:
sudo apt update
Please ensure that python3 is installed before proceeding further:
python3 -V
The above command should show the version installed like Python 3.10.6 If you need to update to different Python version you can update using deadsnakes repository:
sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.11
Please run the following command to install Postgres, Nginx and related python files:
sudo apt install python3-venv python3-dev libpq-dev postgresql postgresql-contrib nginx curl
If you update to higher python versions say 3.11 then you can also install the related files similarly, else you can proceed further to the next step.
sudo apt install python3.11-venv python3.11-dev
An administrative user in the name of postgres was created during postgresql installation both in linux system and in postgresql database. This user will be needed further to perform administrative tasks in postgressql. You can log in as postgres user using sudo and start the postgresql tasks.
sudo -u postgres psql
You can create the database in the logged in prompt of PostgreSQL.
CREATE DATABASE django_project_1;
Then create a database user for this project with a strong password.
CREATE USER dj_project_1_user WITH PASSWORD 'password';
Then set the default database encoding expected by Django.
ALTER ROLE dj_project_1_user SET client_encoding TO 'utf8';
Then set the default transaction isolation scheme to read committed to ensure the reading from committed transactions only.
ALTER ROLE dj_project_1_user SET default_transaction_isolation TO 'read committed';
Then set the timezone to UTC which is generally used in Django based projects. ALTER ROLE dj_project_1_user SET timezone TO 'UTC';
Finally provide all the privileges of managing the created database to the newly created database user.
GRANT ALL PRIVILEGES ON DATABASE django_project_1 TO dj_project_1_user;
Thereafter you can logout from database console by typing \q and pressing enter. The above steps successfully configured PostgreSQL with database ready for connection.
We will create the python virtual environment at /var/www/ for our first django project and will create more folders for subsequent django projects as well. You can also keep you files in /var/www/html/ folder or any other folder as you like it.
cd /var/www mkdir django_project_1
Then create the virtual environment inside the project folder.
cd django_project_1 python3 -m venv venv
You can give a different name to your virtual environment folder. I keep it as venv for simplicity of use. You can use higher version python here if you need.
]]>python3.11 -m...
(08004/1040): Too many connections
(HY000/1040): Too many connections
The above errors appear when all MySql/MariaDB connections allowed are currently being used up and there are more connections requests than allowed. Though this may also be case of poor development, if the database connections are not closed properly, but this tutorial assumes that the the development related optimisations have been applied properly and still this above issue is being faced.
To resolve this error, we need to increase the connections limit via the max_connections varibale of MySql/MariaDB. For this we will follow 3 different steps as below:
1. Check the current max_connections value
In order to check the value please log in to MySql using the terminal as below:
mysql -u root -p
Once logged in, check the variables using the command:
SHOW variables;
You can also check the specific value using the command:
SHOW VARIABLES LIKE 'max_connections';
The result lists out all the variables being used. You can scroll upwards to check the valur of variable max_connections. You can exit using quit; command.
2. Change the max_connections value
In order to change the value please open up the terminal, and edit the configuration file (the availability may differ on different OS installations):
sudo nano /etc/my.cnf
Once the file is open please enter the max connections value directly the first line
[mysql]
And add the number of connections that you want to specify as max (I am adding 1000 for example)
max_connections=1000
Please save the file and exit the file (Ctrl+O, Ctrl+X).
3. Update the Global values
Please update the global values of max_connections using MySql / MariaDB by logging in via terminal:
mysql -u root -p
You can the set the global value of using the command below (I am using 1000 for example):
SET GLOBAL max_connections=1000;
Thereafter you can quit database using the command below:
quit;
That is all you would require to resolve the Too Many Connections error of MySql / MariaDB. You can further monitor the performance using further Sql command or by using MySql Workbench community edition.
]]>In order to delete the temporary files, please find the temporary files folder in your server. The folder may be in /tmp/ or /var/tmp/ or anywhere else depending on the operating system distro. I am using ubuntu server for this example and the temporary files are available in /tmp/ folder. Try deleting the files manually from terminal with the following command:
sudo rm -r /tmp/*
This will delete the files from the temporary folder and free up your valuable server disk space. However some servers' need a restart after cleaning temporary files which we will address in our crontab job now.
In order to clean and restart server automatically, please create a cron job from sudo user as it needs super user permissions. Type the following command in terminal.
sudo crontab -e
The crontab will be opened up for editing. If you're using it for first time, it will ask you to choose an editor for editing crontab. You can choose any one. I generally use nano. Enter the following details for deleting the temporary files close to midnight (You can choose your time accordingly in crontab):
57 23 rm -r /tmp/ 59 23 * /sbin/shutdown -r now
Save the above in nano using Ctrl+O and exit using Ctrl+X.
Congratulations! You have set up your crontab for automatic cleaning for temporary files in server. You can check the crontab listing any using the following command:
sudo crontab -l
Thank you for reading. You may share this article, if you find it useful.
]]>In virtual environment, install by using pip as below:
pip install DjangoAsyncMail
INSTALLED_APPS = [ ... 'DjangoAsyncMail', ]
#SMTP Mail Settings EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.yourdomainname.com' EMAIL_USE_TLS = False EMAIL_PORT = 587 EMAIL_HOST_USER = 'noreply@yourdomainname.com' EMAIL_HOST_PASSWORD = 'your_email_password' DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
from DjangoAsyncMail.mail import send_html_mail send_html_mail(subject,email_body,recipient_list,reply_to) Example: send_html_mail('Testing','Test HTML Content',['example@example.com'],['noreply@yourdomainname.com'])
If you have been figuring out how to write to NTFS drives natively in macOS Catalina and later and have found numerous articles but nothing works, then you are finally at the right destination. I have been facing issues in enabling NTFS write functionality in my Macbook Pro 2017 model after upgrading to macOS Catalina. Earlier i used brew and fuse and everything worked right but not from macOS Catalina onwards, as the file system has been restructured by Apple from macOS Catalina onwards. You may read about that anywhere else but currently here we need to enable Native NTFS write support in your macOS. So let's do it.
Broadly these are the steps that we need to follow:
That particular order is what i used to achieve permanent ntfs write support in my macOS and have since been able to write to NTFS drives natively. There are many blogs out there covering some of the topics above but none of them covers all of them at a single place. Luckily I am your GOD today ;) So let's begin.
Open up your terminal in macOS and write the code line below to install Xcode and terminal tools (Copy-Paste recommended).
xcode-select --install
An installation window shall pop up where you need to click "Install" and then "Accept" and proceed with the full installation.
Please download the MacPorts package (.pkg) from this link and install the same by clicking and pressing the regularized buttons :P
For some reason that Apple finds it reasonable, the default shell terminal from macOS Catalina onwards has been changed from bash to zsh and you, on all earth, are supposed to write a line of code in your terminal, to facilitate that change from bash to zsh. The line of code is present whenever you open the terminal and it's a one time change. For those who are still figuring out the line, please check below:
chsh -s /bin/zsh
Please enter your system password when prompted to make the changes. Please note that this step is necessary for the next step to be completed successfully.
Please download and install FUSE from this link. Please open the terminal after successfull installation and copy paste the following command.
sudo ln -s /usr/local/lib/pkgconfig/fuse.pc /opt/local/lib/pkgconfig/fuse.pc
If for some reason the above command shows message that the file already exists, then simply remove the file using command below and retry the command above. It shall work.
sudo rm /opt/local/lib/pkgconfig/fuse.pc
Please install NTFS-3g by writing the following command in the terminal.
sudo port install ntfs-3g
If your face...
]]>GoPro releases its awaited GoPro Hero 8 alongside GoPro Max in September 2019 for pre-order. So what’s new with the GoPro Hero 8? Is it better than Hero 7? Is it a perfect Vlogging camera? Is the battery worth it’s upgrades and attachments? When are the attachments going to be released? Is the shotgun mic any better than the market leading shotgun mics like Rode? It the extra screen worth the extra bucks and battery drain? Do we really need a flash video light? What about Hyper-lapses, timewarp, hyper smooth? What about the field of view and how many? All these and many more questions arises in our mind when think of the new GoPro Hero 8. Let’s ponder over some of the product features to search for answers within.
As an avid owner of GoPro Hero 7 Black, I must say that is is the most convenient action camera with best in-class hyper smooth stabilisation and is my go to camera for most of the time. It easily replaces my Canon EOS 70D in daytime because of the convenience and it’s 4K capabilities. Speaking of 4K 60fps, the new Hero 8 has the same 4K60fps and 1080p240fps along side the other options. What new stuff to focus about it is the Hypersmooth Stabilisation 2.0 and the Boost mode for Hypersmooth stabilisation. The Boost mode provide the extra smoothness to the already being stabilised video shot, just in case, you need it. The importance to this, according to me, is to exfoliate the feel of a Hollywood movie level shot for a speed movement capture with high level of randomness. It’s just so much better to have it stabilised in camera, while capturing, than to do it in post. Plus it leaves you with better work to do in post production. So the hyper smooth stabilisation with burst mode is a top notch feature that you can get in this mini action cam.
What I personally missed in Hero 7 Black was the FOV (field of view) options in 4K. The new Hero 8 flexes the 4 different types of FOVs with and added advantage of keeping your customised POV settings (more of resolution and frame rate settings though) for quick capture. The 4 POV types namely Narrow (27mm), Linear (19-39mm), Wide (16-34mm), and SuperView (16mm) are cool to have specially for those who need to carve out the fish-eye look from the GoPro videos and to give a DSLR shot video look. With stabilisation racking up version numbers, the Timewarp feature leaves no stone unturned and adds a merit to itself as the new Timewarp 2.0. With the new Timewarp 2.0, you can have slow-mo shots while you are recording a timewarp by the simple press of a button, depending on what time you actually need to do it. It’s more attractive to use you need to shoot short video for Instagram stories or stories for other social media platforms.
The most important attraction of GoPro Hero 8 is...
]]>