Artifakt Docs
Stacks 5.0 and up

Common tasks

You will find here tutorials for specific actions on the console.

Finding the main instance

The main server is indicated in the console in the sidebar that displays when clicking on a replica. When a Background Worker service is attached to your infrastructure, it is linked to the main instance of your environment.
Sidebar display when selecting the main instance
You can also check for the variable ARTIFAKT_IS_MAIN_INSTANCE on the container to have this information.
The main instance will be the one launching the cron jobs.

Connect to a database

As said in the MySQL documentation down below, the connection should be done through a SSH tunnel using one app instance as the target and the Database credentials displayed in Environment -> Resources -> Database.
Additional Services
Artifakt Docs
Check the MySQL docs for more informations
Once you have all the information needed, you can create a new connection in your MySQL Workbench or Sequel Pro software to connect to the database.
Sequel pro configuration
You can fill the above screen with the informations displayed in Environment -> Resources.
Database informations (on the right)
For starter platforms, the MySQL host is: localhost.
Make sure you use a RSA format key for MySQL Workbench since it does not support OpenSSH format keys.

Export database dumps

Using the connection you just configured above, you can run dumps of the database and re-import them in another environment. The same goes for SQL requests.
If you are connected to the app container, you can create a database dump using this example command:
mysqldump -u $ARTIFAKT_MYSQL_USER -h $ARTIFAKT_MYSQL_HOST -p$ARTIFAKT_MYSQL_PASSWORD --no-tablespaces --single-transaction $ARTIFAKT_MYSQL_DATABASE_NAME | gzip > /tmp/myDump.sql.gz
As a reminder, at this moment we do not offer manual backups. Scalable Critical platforms have daily snapshots stored 7 days, but anything more than that is of your responsibility to set up and maintain. Professional Services can help you on that.

Import a database dump

To import a database dump, you will have to:
  1. 1.
    Upload your file on the server (be careful of disk usage since the system disk is small).
  2. 2.
    Connect to the main instance via ssh.
  3. 3.
    Copy the dump file to /mnt/shared/data.
  4. 4.
    Run the following command:
Please note that IO-intensive operations like inserting a large number of lines in a database can cause disk speed throttling. When importing a very large database, grouping lines in INSERT statements can speed up the process and prevent throttling.

Send media files to the servers

Medias are stored on servers in /mnt/shared/data/pub/media, and you have 3 ways of copying over your files to the servers:
  1. 1.
    scp to copy directly your files from server to server using a temporary private key : scp <local path> <user>:<remote path> -i <your private key>
  2. 2.
    rsync to sync from another server
  3. 3.
    sftp to upload directly on the server but be careful with the permissions as the user sending the files should have rights over the remote directory.
As a remidner, /mnt/shared is the persistent folder of the app containers.

Share a SFTP folder with the application

You can share a SFTP folder with your application containers. In this example we will assume the folder is called upload and the path is /mnt/shared/data/uploads
Once you have created the SFTP access in the console, you will have to add in your file:
ln -shf /data/uploads /var/www/html/uploads
chown www-data:www-data -R /var/www/html/uploads
Those two lines will:
  • Create a symbolic link from /mnt/shared/data/uploads to /var/www/html/uploads
  • Set the right permissions on the remote folder for the app to use.

Install PHP extensions

To install additionnal PHP extensions, you can modify the configuration of the container or the server directly via the file:
  1. 1.
    Add a php-fpm.conf file in .artifakt/etc/fpm/php-fpm.conf
  2. 2.
    Copy via the file that php-fpm.conf in /usr/local/etc/php-fpm.conf
cp .artifakt/etc/fpm/php-fpm.conf /usr/local/etc/php-fpm.conf
Extensions and other configuration files can be copied in /usr/local/etc/php/conf.d.
You can also override our file named zzzz-artifakt.ini by adding it to your repo and copying it to the conf.d folder in the script. Just be careful to retrieve our file content to keep our additional parameters.

Send emails

In Artifakt, port 25 is blocked by default, so email sending is not possible from within the machines.
We encourage clients that want to send emails to use third-party services like:
  • Mailchimp
  • Sendinblue
  • Mailjet