-
Notifications
You must be signed in to change notification settings - Fork 2
Amazon Server
Here we will show you how to set up an Amazon EC2 ubuntu server to host our circuit-service. This description requires an Amazon account.
Now, after building circuit we want to host our service.
Let's start with choosing a server. Move to "Instance>Create new Instance". You'll get now a list of the servers. We want to choose an ubuntu server 64-bit and tick it. After choosing you'll get an overview of the main Information of your server.
So let's start with setting up. If you want to ssh, to your machine you'll need a key pair to authenticate your access. You could generate one on the Amazon site at "Network&Security>Key Pairs". After generating you could save your Key Pair on your local computer.
After that, we want to connect to our server via ssh. Please execute ssh out of your Key Pair directory and use:
ssh -i generated_key_name ubuntu@public_ip
After successful ssh you will see Information like that: "Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-48-generic x86_64)
- Documentation: https://help.ubuntu.com/
System information as of Wed Jul 8 21:53:22 UTC 2015
System load: 0.15 Processes: 67 Usage of /: 9.8% of 7.75GB Users logged in: 0 Memory usage: 1% IP address for eth0: xxx.xx.x.xxx Swap usage: 0%
Graph this data and manage this system at: https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud
0 packages can be updated. 0 updates are security updates.
The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. " Great! Know we're starting with updating our new server. Please type:
sudo apt-get install update
sudo apt-get install upgrade
It is necessary to use both. The first will load all the new packages and with upgrade you'll install all of them.
Now we want to set up our service. Starting with installing git. For that use:
sudo apt-get install git
We will also need npm (nodejs packet manager):
sudo apt-get install npm
Please check if you need to install python3. Generally python is installed on the Amazon server. But sometimes the version might be wrong. To get easily the right version, we will install virtualenv:
sudo apt-get install python-virtualenv python3-dev
After installing, name your virtualenvironment, creates a new virtual environment with an python3 interpreter:
virtualenv -p python3 circuit-env
Now we want to activate the virtualenv:
source circuit-env/bin/activate
And now we could install the django-version and its needed packages for our project:
pip install django djangorestframework django-filter markdown pillow
Now we could start to follow the instructions of our circuit-wikisite github-account. Here a short overview of the needed instructions:
git clone https://github.com/7Pros/circuit.git
Move now to the circuit folder and use:
python manage.py makemigrations
python manage.py migrate
Install gulp and bower:
sudo npm install -g bower gulp
sudo npm install
First we have to build a link between nodejs and node:
sudo ln -s /usr/bin/nodejs /usr/bin/node
bower install
gulp
bower install
python manage.py runserver privatip
python notification_server privatip
redis-server --slaveof privatip 6379
Add security rule to allow traffic to port 80. Move in the Amazon Interface to Security Groups>Inbound>Edit>Add rule>CustomTCP rule and source 80.
Add security rule to allow traffic to port 9999. Go to the your EC2 Instances console, Security Groups>Inbound>Edit>Add rule>CustomTCP rule and source 0.0.0.0/16 9999.
Add security rule to allow traffic to port 6379. Go to the your EC2 Instances console, Security Groups>Inbound>Edit>Add rule>CustomTCP rule and source 0.0.0.0/16 6379.
Now you could test the reachability by typing the the public ip in the Adress-bar.
sudo apt-get install postfix
Next option window opens. Please select Internet Site and fill in the fqdn of the server.
Try it out, you'll get nice mails :)
Have a look at our page on http://52.24.24.126:80/
====Updating version on the server====
To update use git pull in the circuit-new directory.
If the server abbort, restart it.