Просмотр исходного кода

Final touches to no docker dev environment

jnfrati 4 лет назад
Родитель
Сommit
0ed6fa32a1
3 измененных файлов с 54 добавлено и 7 удалено
  1. 2 0
      .gitignore
  2. 6 1
      Makefile
  3. 46 6
      docs/developing/setup.md

+ 2 - 0
.gitignore

@@ -55,3 +55,5 @@ override.tf.json
 # Ignore CLI configuration files
 .terraformrc
 terraform.rc
+
+tmp

+ 6 - 1
Makefile

@@ -2,8 +2,13 @@
 include ./docker/.env
 export $(shell sed 's/=.*//' ./docker/.env)
 
+setup:
+	go mod download;
+	cd dashboard && npm install;
+	cd ../;
+
 run-server: 
 	air -c .air.toml
 
 run-frontend:
-	cd ./dashboard && npm run start
+	cd ./dashboard && npm run start

+ 46 - 6
docs/developing/setup.md

@@ -22,9 +22,47 @@ DB_NAME=porter
 SQL_LITE=false
 ```
 
-Once you've done this, go to the root repository, and run `docker-compose -f docker-compose.dev.yaml up`. You should see postgres, webpack, and porter containers spin up. When the webpack and porter containers have finished compiling and have spun up successfully (this will take 5-10 minutes after the containers start), you can navigate to `localhost:8080` and you should be greeted with the "Log In" screen. Create a user by entering an email/password on the "Register" screen. 
+Once you've done this, go to the root repository, and run `docker-compose -f docker-compose.dev.yaml up`. You should see postgres, webpack, and porter containers spin up. When the webpack and porter containers have finished compiling and have spun up successfully (this will take 5-10 minutes after the containers start), you can navigate to `localhost:8080` and you should be greeted with the "Log In" screen. Create a user by entering an email/password on the "Register" screen.
 
-At this point, you can make a change to any `.go` file to trigger a backend rebuild, and any file in `/dashboard/src` to trigger a hot reload. 
+At this point, you can make a change to any `.go` file to trigger a backend rebuild, and any file in `/dashboard/src` to trigger a hot reload.
+
+## Setup without docker
+
+While docker is an awesome way of getting started as it simulates the real environment that we use on our hosted dashboard, for some people this may bee too much.
+
+In order to decrease the complexity of all the environment, you can just run the development environment locally without docker.
+
+To do so you should follow the next steps:
+
+1- First, inside the folder where you cloned the repo (e.g: /home/user/porter) run `make setup`. This should download all the modules for go to work and install all the dependencies that the frontend needs to work!
+
+2- After installing everything you should update the env variables:
+The `/dashboard/.env` should look like this:
+
+```
+NODE_ENV=development
+DEV_SERVER_PORT=8081 # Tell the webpack dev server in wich port we wanna run, it defaults to 8080 but we have to be carefull this is not the same port as the backend
+ENABLE_PROXY=true # Usually we would use nginx, but for this environment we're going to enable webpack-dev-server proxy
+API_SERVER=http://localhost:8080 # API server url, this url will be used for the proxy to redirect all /api calls
+```
+
+And the `/docker/.env` variables should look like this:
+
+```
+SERVER_URL=http://localhost:8080
+SERVER_PORT=8080
+SQL_LITE=true
+SQL_LITE_PATH=./porter.db
+REDIS_ENABLED=false
+```
+
+In this case SQLLite is the simplest solution for getting the environment running, but you can enable postgres or redis if you want!
+
+3- Open two terminals and run `make run-server` and in the second one `make run-frontend`. This should get everything up and running!
+
+### Disclaimer
+
+This environment is experimental, if you run into any issue don't doubt in contact us through our [discord!](https://discord.gg/GJynMR3KXK)
 
 ## Getting PostgreSQL Access
 
@@ -34,7 +72,7 @@ You can get `psql` access by running the following:
 
 This will prompt you for a password. Enter `porter`, and you should see the `psql` shell!
 
-### Setting your email to be verified 
+### Setting your email to be verified
 
 If you are getting blocked out of the dashboard because your email is not verified (fixed in `v0.6.2` of Porter, so make sure you've pulled from `master` recently), you can update your email in the database to `verified":
 
@@ -43,16 +81,18 @@ If you are getting blocked out of the dashboard because your email is not verifi
 ## Setting up Minikube
 
 These steps will help you get set up with a minikube cluster that can be used for development. Prerequisities:
+
 - `kubectl` installed locally
 - Development instance of Porter is running
 
 Following the OS-specific steps to get minikube running:
+
 - [MacOS](#macos)
 - [Linux](#linux)
 
 If you now navigate to `http://localhost:8080`, you should see the minikube cluster attached! There will be some limitations:
-- **It is not possible to expose a service that you create. Whenever you create a web service, de-select the "Expose to external traffic" option.**
 
+- **It is not possible to expose a service that you create. Whenever you create a web service, de-select the "Expose to external traffic" option.**
 
 ### MacOS
 
@@ -119,6 +159,6 @@ If using Chrome, paste the following into the Chrome address bar:
 
 > chrome://flags/#allow-insecure-localhost
 
-And then Enable the **Allow invalid certificates for resources loaded from localhost** field. 
+And then Enable the **Allow invalid certificates for resources loaded from localhost** field.
 
-Finally, run `docker-compose -f docker-compose.dev-secure.yaml up` instead of the standard docker-compose file. 
+Finally, run `docker-compose -f docker-compose.dev-secure.yaml up` instead of the standard docker-compose file.