Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document development environment setup #31

Open
JPHutchins opened this issue Dec 29, 2021 · 9 comments
Open

Document development environment setup #31

JPHutchins opened this issue Dec 29, 2021 · 9 comments
Assignees

Comments

@JPHutchins
Copy link
Owner

Create a new dev environment and document procedure. This should provide sample account data for 3600/900 electrical as well as gas so that the gas API can be started.

@JPHutchins JPHutchins self-assigned this Dec 31, 2021
@JPHutchins
Copy link
Owner Author

Created a new WSL2 instance following this guide: https://cloudbytes.dev/snippets/how-to-install-multiple-instances-of-ubuntu-in-wsl2

Except that I used 20.04 instead of 21.04

@JPHutchins
Copy link
Owner Author

update upgrade, init git add ssh keys to github

@JPHutchins
Copy link
Owner Author

JPHutchins commented Dec 31, 2021

git clone [email protected]:JPHutchins/open-energy-view.git
cd open-energy-view
git status
code .

@JPHutchins
Copy link
Owner Author

sudo apt install python3.8-venv

@JPHutchins
Copy link
Owner Author

JPHutchins commented Dec 31, 2021

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
Fails, sudo apt install build-essential for gcc etc
pip3 install -r requirements.txt
Fails, need sudo apt install python3-dev
pip3 install -r requirements.txt
OK we good

@JPHutchins
Copy link
Owner Author

JPHutchins commented Jan 1, 2022

Install nvm: https://github.com/nvm-sh/nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
cd open_energy_view/frontend
Use nvm to install npm: nvm install 10.19.0 TODO: upgrade
nvm use 10
npm install
npm run build

@JPHutchins
Copy link
Owner Author

JPHutchins commented Jan 1, 2022

cd ../.. back to repo root

Install erlang:
sudo apt update
sudo apt install software-properties-common apt-transport-https
wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add -
echo "deb https://packages.erlang-solutions.com/ubuntu focal contrib" | sudo tee /etc/apt/sources.list.d/rabbitmq.list
sudo apt update
sudo apt install erlang

Install rabbitmq:
curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | sudo bash
sudo apt install rabbitmq-server

Start rabbitmq-server
sudo service rabbitmq-server start
verify:
sudo service rabbitmq-server status

sudo rabbitmqctl add_user jp admin
sudo rabbitmqctl set_user_tags jp administrator
sudo rabbitmqctl add_vhost myvhost
sudo rabbitmqctl set_permissions -p myvhost jp ".*" ".*" ".*"

@JPHutchins
Copy link
Owner Author

JPHutchins commented Jan 1, 2022

Open 4 terminals:
image

first terminal:
./run-wsgi-dev
2nd term:
./run-io-worker
3rd term:
./run-cpu-worker

4th terminal:
ip a

Note the IP address of your WSL2 instance, in this case 172.31.30.203:
image

On your host OS open a Chrome or Firefox web browser and navigate to http://<YOUR_WSL2_IP>:5000:
image

For first time setup you must register a user to your local database. I recommend using something easily memorable and keep in mind that you can register as many users as you need while testing.

Example account setup

Click "Register now!"

For email use: [email protected]
For password use: admin

Next, you are prompted to add energy sources. This is local development so there would be no way to add a real PGE account here. In the dropdown select "Fake Utility" and click "Authorize".

Next, you are prompted to name the fake energy source. Enter dev, for example, then click "Add Source".

After simulating API calls and parsing the retrieved ESPI data (J.P.'s old data) you will be greeted with an OEV instance that will respond to changes in your local Python/Flask/Celery backend and React frontend.

JPHutchins added a commit that referenced this issue Jan 1, 2022
JPHutchins added a commit that referenced this issue Jan 1, 2022
JPHutchins added a commit that referenced this issue Jan 1, 2022
@Chayanj123
Copy link

Chayanj123 commented May 14, 2024

when running
./run-io-worker

Got error:

File "/home/chayan/Projects/open-energy-view-master/open_energy_view/lib/python3.10/site-packages/amqp/connection.py", line 668, in _on_close
raise error_for_code(reply_code, reply_text,
amqp.exceptions.AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

what to do in this case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants