Before deploying to Awanio, there are several things you need to prepare. First you must have an account on the Awanio service. In your account, you must at least have a team. Each application will be attached to a team.
Awanio uses ssh for deployments. You must have an ssh client on the local computer being used. This is installed by default on the macOS and Linux operating systems. You must also prepare a ssh public key that will be used during the authentication process. To view the contents of the ssh public key file, generally located at the locationi /home/myname/.ssh/id_rsa.pub.
If you don't have it before, you can read more about how to create a ssh public key on the next page https://docs.gitlab.com/ce/ssh/README.html. If you use the Windows operating system, you can use PuttyGen.
The article above also explains how to use it. The contents of the file id_rsa.pub must be inputted to Awanio as proof of credential that you can do on the dashboard page.
The contents of the file rsa.pub must be inputted to Awanio as credential proof that you can do on the dashboard page. Click the menu Accounts > Add SSH Key
After that, run the command:
ssh git@awan.io
If successful, there will be a response as below:
Hi USER You've successfully authenticated to Awanio
Connection to awan.io closed.
To create an application, please go to the "Applications" menu on the top right side of the page, click the "Create Application" button. After that the display will appear as follows:
Git is needed for the mechanism to distribute local code to Awanio's server. When creating a project in Awanio, you will get a Git URL in the form git@awan.io:TEAM_NAME/APP_NAME.git
The Git URL of an application can be seen on the application's detail page.
All projects that will be deployed to Awanio, at least require a awan.yml file that is placed in the main application folder.
Examples of the contents of the awan.yml file are:
For PHP-based applications, the contents of the awan.yml file are as follows:
version: '1.0'
web:
type: php
version: 7.0
doc_root: ./public
Following is the example awan.yml file for applications with python runtime:
version: '1.0'
web:
type: python
version: 3
run: gunicorn -b :$PORT --workers=2 my_web:app
Starter kits for python-based applications can be cloned in this repository https://github.com/Awanio/python-starter-kit
Environment variables can be set-up using the dashboard.
Generally each app has one or more supporting resources. The most common example is a database. To access the resources of the application, you can use the information in environment variables. For example, the environment variable for MySQL is:
MYSQL_DATABASE=database_name
MYSQL_USER=user_access
MYSQL_PASSWORD=db_password
MYSQL_HOST=db_host
MYSQL_PORT=3306
Sometimes we want to access a resource from the local computer that we use. For this, we can use ssh tunneling by:
ssh tunnel@awan.io -p 2222 -L 3307:ADDON_HOST:3306 -N
After that, connect with the mysql client using the command:
mysql --host=127.0.0.1 --port=3307 -u user -p
Then click the ssh tab to fill in the host, port, User Name and Authentication Method:
Finally click the Test Connection button to confirm whether the connection was successful.
By default every application in Awanio will get a sub-domain name with the format: myapp.diawan.id or myapp.onawan.eu. You can use this subdomain name as cname when setup in the domain manager where you purchased the domain. Here's an example of how the cname setup looks in Cloudflare:
Finally, the domain name that you want to use must be registered in the Routing section of the apps page.
Enjoy!