### Install Global npm Package Source: https://docs.opalstack.com/topic-guides/nodejs Example command to install a global package like PM2 after configuring the home directory environment. ```bash npm install -g pm2 ``` -------------------------------- ### Install Project Dependencies Source: https://docs.opalstack.com/topic-guides/nodejs Navigate to the project directory and install dependencies using npm. ```bash cd ~/apps/appname/projectname npm install ``` -------------------------------- ### Install Composer in Home Directory Source: https://docs.opalstack.com/topic-guides/php Downloads and installs the Composer dependency manager to the ~/bin directory. ```bash cd ~ mkdir -p ~/bin wget -O composer-setup.php https://getcomposer.org/installer php composer-setup.php --install-dir=$HOME/bin --filename=composer rm composer-setup.php ``` -------------------------------- ### Install MariaDB Dependencies Source: https://docs.opalstack.com/topic-guides/rails Configure the environment and install MariaDB dependencies for Ruby. ```bash cd ~/apps/myapp source setenv cd myproject bundle install ``` -------------------------------- ### Install Package in Virtual Environment Source: https://docs.opalstack.com/topic-guides/python Activates the environment and installs a package using pip. ```bash source ~/apps/myapp/env/activate pip install packagename ``` -------------------------------- ### Running an Installation Script Source: https://docs.opalstack.com/user-guide/applications This command demonstrates how to execute a custom installation script for an application. Ensure you replace the placeholders with your application's UUID and name, and the correct path to your script. ```bash cd ~/apps/name_of_app; ~/.osscrc/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX \ -i XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX \ -n name_of_app > ~/logs/apps/name_of_app/install.log ``` -------------------------------- ### Install PostgreSQL Dependencies Source: https://docs.opalstack.com/topic-guides/rails Configure the environment and install PostgreSQL dependencies for Ruby. ```bash cd ~/apps/myapp source setenv export PATH=/usr/pgsql-11/bin/:$PATH cd myproject bundle install ``` -------------------------------- ### Install Gems in Rails Project Source: https://docs.opalstack.com/topic-guides/rails After preparing your shell environment and switching to your project directory, use `bundle install` to install gems specified in your project's `Gemfile`. ```bash cd $PROJECTDIR bundle install ``` -------------------------------- ### Install PEAR via SSH Source: https://docs.opalstack.com/topic-guides/php Commands to download and execute the PEAR installer within a shell session. ```bash cd ~ mkdir ~/tmp wget https://pear.php.net/go-pear.phar php go-pear.phar ``` -------------------------------- ### PEAR Installation Layout Prompt Source: https://docs.opalstack.com/topic-guides/php The default file layout configuration displayed during the PEAR installation process. ```text Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : /home/username/pear 2. Temporary directory for processing : /home/username/tmp/pear/install 3. Temporary directory for downloads : /home/username/tmp/pear/install 4. Binaries directory : /home/username/pear/bin 5. PHP code directory ($php_dir) : /home/username/pear/share/pear 6. Documentation directory : /home/username/pear/docs 7. Data directory : /home/username/pear/data 8. User-modifiable configuration files directory : /home/username/pear/cfg 9. Public Web Files directory : /home/username/pear/www 10. System manual pages directory : /home/username/pear/man 11. Tests directory : /home/username/pear/tests 12. Name of configuration file : /home/username/.pearrc 1-12, 'all' or Enter to continue: ``` -------------------------------- ### Install django-mcp-server Source: https://docs.opalstack.com/user-guide/mcp Command to install the Django MCP server package. ```bash pip install django-mcp-server ``` -------------------------------- ### Install Package Globally Source: https://docs.opalstack.com/topic-guides/python Installs a package in the home directory without using a virtual environment. ```bash pip install --user packagename ``` -------------------------------- ### Install pg gem for Ruby Source: https://docs.opalstack.com/user-guide/postgresql-databases Install the 'pg' gem to enable Ruby applications to connect to PostgreSQL. Ensure your PATH is correctly configured before installation. ```bash export PATH=/usr/pgsql-14/bin/:$PATH gem install pg ``` -------------------------------- ### Install psycopg for Python Source: https://docs.opalstack.com/user-guide/postgresql-databases Install the psycopg library to enable Python applications to connect to PostgreSQL databases. Ensure your PATH is set correctly and activate your virtual environment. ```bash export PATH=/usr/pgsql-14/bin/:$PATH cd ~/apps/appname source env/bin/activate pip install psycopg ``` -------------------------------- ### Configure Symlink Path Source: https://docs.opalstack.com/topic-guides/symlinks Example path format for a symlink application pointing to a directory in the user's home folder. ```text /home/myuser/myfiles/ ``` -------------------------------- ### Install Javascript Packages with npm Source: https://docs.opalstack.com/topic-guides/ghost Install additional Javascript packages for your Ghost application using npm. Ensure you are in the correct directory and replace 'package_name' with the desired package. ```bash source ~/apps/myapp/setenv cd ~/apps/myapp/node npm install package_name ``` -------------------------------- ### Install virtualenv for Python 2 Source: https://docs.opalstack.com/topic-guides/python Configures the environment and installs the virtualenv package required for Python 2. ```bash export PATH=$HOME/.local/bin:$PATH pip2.7 install --user -U pip==20.3.4 ~/.local/bin/pip2.7 install --user virtualenv==20.15.1 ``` -------------------------------- ### Install Python Dependencies with Pip Source: https://docs.opalstack.com/topic-guides/python Install Python packages for your application using pip. Use 'pip install packagename' for individual packages or 'pip install -r requirements.txt' to install from a requirements file. ```bash pip install packagename ``` ```bash pip install -r requirements.txt ``` -------------------------------- ### Execute Single Command via SSH Source: https://docs.opalstack.com/user-guide/server-access Run a single command on your Opalstack server without starting an interactive session. This example reads the date from the server. ```bash ssh myuser@opal1.opalstack.com date ``` -------------------------------- ### Install MariaDB Dependencies for Django Source: https://docs.opalstack.com/topic-guides/django Enable the necessary development tools, activate your application's virtual environment, and install the mysqlclient package for MariaDB support. Replace 'myapp' with your application's name. ```bash scl enable devtoolset-9 bash source ~/apps/myapp/env/bin/activate pip install mysqlclient ``` -------------------------------- ### Install pg package for Node.js (Javascript) Source: https://docs.opalstack.com/user-guide/postgresql-databases Install the 'pg' package for Node.js to allow Javascript applications to connect to PostgreSQL. Set your PATH and navigate to your project directory. ```bash export PATH=/usr/pgsql-14/bin/:$PATH npm install pg ``` -------------------------------- ### Install Rails Dependencies Source: https://docs.opalstack.com/topic-guides/rails Install project dependencies using Bundler within the project directory. ```bash cd /home/myuser/apps/myapp/yourproject bundle install ``` -------------------------------- ### Create SSH Directory and Files Source: https://docs.opalstack.com/user-guide/server-access These commands are used to create the necessary SSH directory and the `authorized_keys` file with the correct permissions on the server. This is typically done after logging in via SSH, for example, when configuring PuTTY. ```bash mkdir ~/.ssh chmod 700 ~/.ssh touch ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys ``` -------------------------------- ### Install PostgreSQL Dependencies for Django Source: https://docs.opalstack.com/topic-guides/django Activate your Django application's virtual environment and install the psycopg2 binary package for PostgreSQL support. Replace 'myapp' with your application's name. ```bash source ~/apps/myapp/env/bin/activate pip install "psycopg[binary]" ``` -------------------------------- ### Install Gems in Application Environment Source: https://docs.opalstack.com/topic-guides/rails Use the `gem install` command after preparing your shell environment to add gems to the core Ruby on Rails software within your application's environment. ```bash gem install name_of_gem ``` -------------------------------- ### Connect via Python Source: https://docs.opalstack.com/user-guide/mariadb-databases Requires the mysqlclient library installed in the environment. ```bash source env/bin/activate pip install mysqlclient ``` ```python import MySQLdb as mysql conn = mysql.connect(host='localhost', user='mydbuser', password='mydbpassword', database='mydb') ``` -------------------------------- ### Configure Laravel Public Directory Path Source: https://docs.opalstack.com/topic-guides/symlinks Example path configuration for a Laravel project's public directory. ```text /home/myuser/mysite/public/ ``` -------------------------------- ### PHP Configuration Prompt Source: https://docs.opalstack.com/topic-guides/php The prompt asking to modify the system php.ini file during installation. ```text Would you like to alter php.ini ? [Y/n] : ``` -------------------------------- ### Connect via Ruby Source: https://docs.opalstack.com/user-guide/mariadb-databases Requires the mysql2 gem installed in the environment. ```bash gem install mysql2 ``` ```ruby require 'mysql2' conn = Mysql2::Client.new(:host => "localhost", :username => "mydbuser", :database => "mydb", :password => "mydbpassword") ``` -------------------------------- ### Define Custom MCP Tools Source: https://docs.opalstack.com/user-guide/mcp Example of defining custom tools by extending the MCPToolset class. ```python # myapp/mcp.py from mcp_server import MCPToolset class MyTools(MCPToolset): def ping(self, name: str = "world") -> dict: """Return a simple greeting.""" return {"message": f"hello, {name}"} ``` -------------------------------- ### Restart Gitea Application Source: https://docs.opalstack.com/topic-guides/git Commands to stop and then start your Gitea application after making configuration changes. Ensure you replace 'username' and 'appname' with your specific details. ```bash /home/username/app/appname/stop /home/username/app/appname/start ``` -------------------------------- ### Connect via Javascript Source: https://docs.opalstack.com/user-guide/mariadb-databases Requires the mysql package installed via npm. ```bash npm install mysql ``` ```javascript var mysql = require('mysql'); var conn = mysql.createConnection({ host: 'localhost', user: 'mydbuser', password: 'mydbpassword', database: 'mydb' }); conn.connect(); ``` -------------------------------- ### Recreate Python 3 Virtual Environment and Install Dependencies Source: https://docs.opalstack.com/user-guide/migrations Use these shell commands to recreate a Python 3 virtual environment and reinstall project dependencies after migrating to AlmaLinux 9. This is for a Django project using a virtual environment named 'env'. ```shell cd ~/apps/myapp # recreate the env mv env env.centos7 python3.10 -m venv env source env/bin/activate pip cache purge # install uwsgi and your project dependencies pip install uwsgi pip install -r myproject/requirements.txt ``` -------------------------------- ### Upgrade Installed Package Source: https://docs.opalstack.com/topic-guides/python Upgrades a package using the -U flag, either globally or within an active environment. ```bash pip install --user -U packagename ``` ```bash pip install -U packagename ``` -------------------------------- ### Clone Repository using Gitea SSH Source: https://docs.opalstack.com/topic-guides/git Example of cloning a repository from your Gitea instance using SSH authentication with your configured key. Replace 'myshelluser', 'gitea.mydomain.com', 'username', and 'reponame' accordingly. ```bash git clone myshelluser@gitea.mydomain.com:username/reponame.git ``` -------------------------------- ### Install Javascript Packages with npm (Build from Source) Source: https://docs.opalstack.com/topic-guides/ghost Re-install a Javascript package with the NPM_CONFIG_BUILD_FROM_SOURCE environment variable set to true, which can resolve binary compatibility issues. ```bash source ~/apps/myapp/setenv cd ~/apps/myapp/node NPM_CONFIG_BUILD_FROM_SOURCE=true npm install package_name ``` -------------------------------- ### Activate Python Environment Source: https://docs.opalstack.com/topic-guides/django Activate your application's Python environment via SSH before installing dependencies or running management commands. ```bash cd ~/apps/appname source env/bin/activate ``` -------------------------------- ### Restart Python/uWSGI Application Source: https://docs.opalstack.com/topic-guides/python After modifying configuration files like uwsgi.ini, restart your application using its stop and start scripts to apply the changes. ```bash /home/username/apps/appname/stop ``` ```bash /home/username/apps/appname/start ``` -------------------------------- ### Reinstall Node.js Application Dependencies on AlmaLinux 9 Source: https://docs.opalstack.com/user-guide/migrations Shell commands to reinstall Node.js application dependencies using npm after migrating to AlmaLinux 9. This example assumes Node.js v20 is used. ```shell cd ~/apps/myapp/myproject source scl_source enable nodejs20 npm install --force ``` -------------------------------- ### Set up PostgreSQL Backup Directory and Script Source: https://docs.opalstack.com/user-guide/postgresql-databases These commands create necessary directories and files for automated PostgreSQL backups. They set up the database name, backup directories, and a placeholder script for the backup process. Ensure permissions are set correctly. ```bash export DBNAME=mydb mkdir -m 700 -p ~/.local/bin mkdir -m 700 -p ~/.local/etc/psql_backups mkdir -m 700 -p ~/backups/psql touch ~/.pgpass chmod 600 ~/.pgpass touch ~/.local/bin/backup_$DBNAME chmod 700 ~/.local/bin/backup_$DBNAME ``` -------------------------------- ### Create Backup Directories and Files Source: https://docs.opalstack.com/user-guide/mariadb-databases Run these commands to set up the necessary file structure and permissions for MariaDB backups. Ensure you replace 'mydb' with your actual database name. ```bash export DBNAME=mydb mkdir -m 700 -p ~/.local/bin mkdir -m 700 -p ~/.local/etc/mariadb_backups mkdir -m 700 -p ~/backups/mariadb touch ~/.local/etc/mariadb_backups/$DBNAME.cnf chmod 600 ~/.local/etc/mariadb_backups/$DBNAME.cnf touch ~/.local/bin/backup_$DBNAME chmod 700 ~/.local/bin/backup_$DBNAME ``` -------------------------------- ### Prepare Shell Environment for Gem Management Source: https://docs.opalstack.com/topic-guides/rails Execute these commands to set up your shell environment for managing gems. Replace `myapp` and `myproject` with your actual application and project names. ```bash cd ~/apps/myapp source setenv ``` -------------------------------- ### Install SQLite Binary for Django (Pre-Dec 2021) Source: https://docs.opalstack.com/topic-guides/django For Django applications installed prior to December 2021, install an updated SQLite binary package for Python using pip. Replace 'myapp' with your application's name. ```bash source ~/apps/myapp/env/bin/activate pip install pysqlite3-binary ``` -------------------------------- ### Initialize Rails Application Environment Source: https://docs.opalstack.com/topic-guides/rails Navigate to the application directory and load the environment variables. ```bash cd /home/myuser/apps/myapp source setenv ``` -------------------------------- ### Create a Subversion repository Source: https://docs.opalstack.com/topic-guides/subversion Initializes a new Subversion repository in the specified directory using the svnadmin tool. ```bash svnadmin create ~/myrepo ``` -------------------------------- ### Configure Ghost Site URL and Restart Source: https://docs.opalstack.com/topic-guides/ghost Set the site URL for your Ghost application and restart the service. Ensure you replace placeholders with your actual domain and app name. ```bash source ~/apps/myapp/setenv cd ~/apps/myapp/ghost ghost config url https://domain.com ghost restart ``` -------------------------------- ### Activate Python Virtual Environment Source: https://docs.opalstack.com/topic-guides/python Activate your application's isolated Python environment before installing dependencies. This ensures packages are installed specifically for your application. ```bash source /home/app_user/apps/app_name/env/bin/activate ``` -------------------------------- ### Activate Node.js Environment Source: https://docs.opalstack.com/topic-guides/nodejs Commands to navigate to the application directory and enable the Node.js 20 environment. ```bash cd ~/apps/appname source scl_source enable nodejs20 ``` -------------------------------- ### Connect via Command Line Client Source: https://docs.opalstack.com/user-guide/mariadb-databases Use the mysql command line tool after logging into an SSH session. ```bash mysql -p -u mydbuser mydb ``` -------------------------------- ### Update Gitea Start Script Source: https://docs.opalstack.com/user-guide/migrations Modify the Gitea application's start script to remove specific environment enabling commands, allowing it to run correctly on the new operating system. ```shell /usr/sbin/daemonize -a -c $PWD -p $PIDFILE -e $HOME/logs/apps/gitea/gitea_error.log -o $HOME/logs/apps/gitea/gitea.log $PWD/gitea ``` -------------------------------- ### Configure Global npm Tools Source: https://docs.opalstack.com/topic-guides/nodejs Commands to set up the npm prefix and update shell configuration to include global binaries in the PATH. ```bash mkdir -p ~/.npm echo 'prefix=~/.npm' >> ~/.npmrc echo 'source scl_source enable nodejs20' >> ~/.bashrc echo 'export PATH="$PATH:$HOME/.npm/bin"' >> ~/.bashrc source ~/.bashrc ``` -------------------------------- ### Configure Django SQLite Backend Source: https://docs.opalstack.com/topic-guides/django Include these lines in your `settings.py` before the `DATABASES` dictionary to use `pysqlite3` for SQLite. ```python __import__('pysqlite3') import os import sys sys.modules['sqlite3'] = sys.modules.pop('pysqlite3') ``` ```python DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } ``` -------------------------------- ### Connect via PHP Source: https://docs.opalstack.com/user-guide/mariadb-databases Uses the mysqli extension to establish a database connection. ```php $conn = new mysqli("localhost", "mydbuser", "mydbpassword", "mydb"); ``` -------------------------------- ### Restart Rails Instance Source: https://docs.opalstack.com/topic-guides/rails Create necessary temporary directories and execute the restart script. ```bash mkdir -p /home/myuser/apps/myapp/yourproject/tmp/pids mkdir -p /home/myuser/apps/myapp/yourproject/tmp/sockets cp /home/myuser/apps/myapp/oldproject/tmp/pids/* /home/myuser/apps/myapp/yourproject/tmp/pids/ /home/myuser/apps/myapp/restart ``` -------------------------------- ### Create Environment in App Directory Source: https://docs.opalstack.com/topic-guides/python Creates a virtual environment within a specific application directory. ```bash python3 -m venv ~/apps/appname/env ``` -------------------------------- ### Create Apache Password File Source: https://docs.opalstack.com/topic-guides/php Initializes a password file for HTTP authentication using the htpasswd utility. ```bash cd ~/apps/myapp htpasswd -c .htpasswd webuser ``` -------------------------------- ### Run mbsync Migration Source: https://docs.opalstack.com/user-guide/email Execute the synchronization process to pull mail from the configured source to the destination. ```bash mbsync --pull --all ``` -------------------------------- ### Remove PHP Handler from .htaccess Source: https://docs.opalstack.com/topic-guides/php Example of a handler configuration that should be removed if the site is serving raw PHP source code. ```apache SetHandler php72-cgi ``` -------------------------------- ### Keyboard Shortcuts Source: https://docs.opalstack.com/topic-guides/symlinks List of keyboard shortcuts available for navigating the documentation. ```text ? | Open this help n | Next page p | Previous page s | Search ``` -------------------------------- ### Connect to PostgreSQL via Command Line Source: https://docs.opalstack.com/user-guide/postgresql-databases Use this command to connect to your PostgreSQL database from the server's command line. You will be prompted for your database user password. ```bash psql -U mydbuser mydb ``` -------------------------------- ### Configure PostgreSQL Credentials for Backup Source: https://docs.opalstack.com/user-guide/postgresql-databases Add this line to the `~/.pgpass` file to store your PostgreSQL connection details securely for automated backups. Replace 'mydbuser' and 'mydbpassword' with your actual credentials. ```bash localhost:5432:mydb:mydbuser:mydbpassword ``` -------------------------------- ### Configure Puma Project Directory Source: https://docs.opalstack.com/topic-guides/rails Update the project directory path in the Puma start/stop scripts. ```bash PROJECTDIR=$HOME/apps/$APPNAME/yourproject ``` -------------------------------- ### Set PHP Memory Limit Source: https://docs.opalstack.com/topic-guides/php Adjust the memory limit for your PHP application by setting the `memory_limit` directive in your `.user.ini` file. This example sets the limit to 256MB. ```ini memory_limit = 256M ``` -------------------------------- ### Configure uWSGI for Flask Application Source: https://docs.opalstack.com/topic-guides/python Modify the uwsgi.ini file to point to your Flask application. This example shows how to use the 'module' directive and 'touch-reload' for automatic restarts on file changes. ```ini # adjust the following to point to your project #wsgi-file = /home/username/apps/appname/myapp/wsgi.py #touch-reload = /home/username/apps/appname/myapp/wsgi.py module = flaskapp:app touch-reload = /home/username/apps/appname/flaskapp/__init__.py ``` -------------------------------- ### Set Maximum Upload File Size in PHP Source: https://docs.opalstack.com/topic-guides/php Configure the maximum file size for uploads by adding `post_max_size` and `upload_max_filesize` directives to your `.user.ini` file. This example sets the limit to 128MB. ```ini post_max_size = 128M upload_max_filesize = 128M ``` -------------------------------- ### Configure SQLite Environment Source: https://docs.opalstack.com/topic-guides/rails Set the library path to use the system-maintained version of SQLite. ```bash cd ~/apps/myapp source setenv export PATH=/usr/sqlite330/bin:$PATH export LD_LIBRARY_PATH=/usr/sqlite330/lib:$LD_LIBRARY_PATH ``` -------------------------------- ### Run Specific PHP Versions on Command Line Source: https://docs.opalstack.com/topic-guides/php Use these commands to execute specific PHP versions from the command line, as the default 'php' command may vary by server OS. ```bash php56 ``` ```bash php74 ``` ```bash php80 ``` ```bash php81 ``` ```bash php82 ``` ```bash php83 ``` ```bash php84 ``` ```bash php85 ``` -------------------------------- ### Configure SQLite Database for Django (Pre-Dec 2021) Source: https://docs.opalstack.com/topic-guides/django Configure the default database connection in your Django project's settings.py to use SQLite for older applications. This configuration assumes the pysqlite3-binary package has been installed. ```python DATABASES = { ``` -------------------------------- ### Set SQLite Library Path for Django Source: https://docs.opalstack.com/topic-guides/django Before running Django management commands with SQLite, set the LD_LIBRARY_PATH environment variable to ensure Django uses the correct SQLite version. This is for apps installed after December 2021. ```bash export LD_LIBRARY_PATH=/usr/sqlite330/lib ``` -------------------------------- ### Connect to PostgreSQL from Python Source: https://docs.opalstack.com/user-guide/postgresql-databases Connect to your PostgreSQL database using the psycopg library in Python. Replace placeholder credentials with your actual database name, username, and password. ```python import psycopg conn = psycopg.connect(host='localhost', user='mydbuser', password='mydbpassword', dbname='mydb') ``` -------------------------------- ### Configure SQLite Database for Django (Post-Dec 2021) Source: https://docs.opalstack.com/topic-guides/django Configure the default database connection in your Django project's settings.py to use SQLite for applications installed after December 2021. This uses the standard Django SQLite configuration. ```python # then configure the engine and path to the DB here DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } ``` -------------------------------- ### Configure PHP include_path Source: https://docs.opalstack.com/topic-guides/php The line to add to a .user.ini file to include the PEAR directory in the PHP search path. ```ini include_path = .:/home/username/pear/share/pear ``` -------------------------------- ### Import MariaDB Database Source: https://docs.opalstack.com/user-guide/mariadb-databases Use the mysql command to import an existing SQL dump file into a database. ```bash mysql -p -u mydbuser mydb < mydb.sql ``` -------------------------------- ### Create Python 2 Virtual Environment Source: https://docs.opalstack.com/topic-guides/python Creates a virtual environment specifically for Python 2.7. ```bash virtualenv --python=python2.7 envname ``` -------------------------------- ### Configure PostgreSQL database.yml Source: https://docs.opalstack.com/topic-guides/rails Set the production database configuration for PostgreSQL. ```yaml production: <<: *default adapter: postgresql database: your_database_name username: your_database_user_name password: your_database_user_password ``` -------------------------------- ### Configure SSH Client for Gitea Source: https://docs.opalstack.com/topic-guides/git Configures your local SSH client to use the specific Gitea SSH key. Replace 'gitea.mydomain.com' with your Gitea site's domain and 'gitea_mydomain_com_rsa' with your key's filename. ```bash Host gitea.mydomain.com IdentityFile ~/.ssh/gitea_mydomain_com_rsa IdentitiesOnly yes ``` -------------------------------- ### Configure Django Static File Settings Source: https://docs.opalstack.com/topic-guides/django Set `STATIC_ROOT` and `STATIC_URL` in your `settings.py` to serve static content via Nginx. ```python STATIC_ROOT = '/home/username/apps/mystatic' STATIC_URL = '/static/' ``` -------------------------------- ### Configure MariaDB Credentials Source: https://docs.opalstack.com/user-guide/mariadb-databases Add these lines to your database credentials file. For AlmaLinux 9, include the 'no-tablespaces' parameter. ```ini [client] password='mydbpassword' ``` ```ini [client] password='mydbpassword' no-tablespaces ``` -------------------------------- ### Connect to PostgreSQL from Javascript Source: https://docs.opalstack.com/user-guide/postgresql-databases Connect to your PostgreSQL database from a Javascript application using the 'pg' package. Configure the client with your database credentials and port. ```javascript var pg = require('pg'); var conn = new pg.Client({ user: 'mydbuser', host: 'localhost', database: 'mydb', password: 'mydbpassword', port: 5432, }) conn.connect() ``` -------------------------------- ### Configure MariaDB database.yml Source: https://docs.opalstack.com/topic-guides/rails Set the production database configuration for MariaDB. ```yaml production: <<: *default adapter: mysql2 database: your_database_name username: your_database_user_name password: your_database_user_password ``` -------------------------------- ### Open authorized_keys with Nano Editor Source: https://docs.opalstack.com/user-guide/server-access This command opens the `authorized_keys` file in the `nano` text editor, allowing you to paste your public SSH key. Ensure the key is pasted as a single line. ```bash nano -w ~/.ssh/authorized_keys ``` -------------------------------- ### Establish SSH Tunnel for MariaDB Source: https://docs.opalstack.com/user-guide/mariadb-databases Use these commands on your local machine to forward a local port to the remote MariaDB server. Replace the user and host placeholders with your specific Opalstack credentials. ```bash ssh myuser@opalN.opalstack.com -L 3306:127.0.0.1:3306 -N ``` ```bash ssh myuser@opalN.opalstack.com -L 3307:127.0.0.1:3306 -N ``` -------------------------------- ### Execute IMAP Migration with imapsync Source: https://docs.opalstack.com/user-guide/email Run the transfer command without the dry-run flag to begin copying mail between servers. ```bash imapsync --host1 OLD_MAILSERVER --ssl1 --user1 OLD_MAIL_USERNAME --passfile1 ./oldpasswd.txt \ --host2 NEW_MAILSERVER --ssl2 --user2 NEW_MAILBOX --passfile2 ./newpasswd.txt ``` -------------------------------- ### Activate Virtual Environment Source: https://docs.opalstack.com/topic-guides/python Activates a virtual environment for interactive use. ```bash source envname/bin/activate ``` -------------------------------- ### Configure SQLite database.yml Source: https://docs.opalstack.com/topic-guides/rails Set the production database configuration for SQLite. ```yaml production: <<: *default adapter: sqlite3 database: db/production.sqlite3 ``` -------------------------------- ### Configure uWSGI for Django Project Source: https://docs.opalstack.com/topic-guides/django Adjust `uwsgi.ini` to point to your Django project's path and WSGI file for serving. ```ini # adjust the following to point to your project python-path = /home/username/apps/appname/newsite wsgi-file = /home/username/apps/appname/newsite/newsite/wsgi.py touch-reload = {appdir}/newsite/newsite/wsgi.py ``` -------------------------------- ### Test IMAP Migration with imapsync Source: https://docs.opalstack.com/user-guide/email Perform a dry run to verify connectivity and authentication before executing a full mail transfer. ```bash imapsync --dry --host1 OLD_MAILSERVER --ssl1 --user1 OLD_MAIL_USERNAME --passfile1 ./oldpasswd.txt \ --host2 NEW_MAILSERVER --ssl2 --user2 NEW_MAILBOX --passfile2 ./newpasswd.txt ``` -------------------------------- ### Upload SSH Key via SSH Command Source: https://docs.opalstack.com/user-guide/server-access Use this command to upload your public SSH key to the server if `ssh-copy-id` is not available. Ensure you replace 'myuser' and 'opal1.opalstack.com' with your actual username and hostname. You will be prompted for your shell user's password. ```bash cat ~/.ssh/id_rsa.pub | ssh myuser@opal1.opalstack.com \ "mkdir ~/.ssh && chmod 700 ~/.ssh && touch ~/.ssh/authorized_keys && \ chmod 600 ~/.ssh/authorized_keys && cat >> ~/.ssh/authorized_keys" ```