mirror of
https://github.com/dnote/dnote
synced 2026-03-14 22:45:50 +01:00
Simplify dev environment (#301)
This commit is contained in:
parent
41ada2298c
commit
5d9662373b
5 changed files with 18 additions and 10 deletions
|
|
@ -15,15 +15,17 @@ Dnote uses [Vagrant](https://github.com/hashicorp/vagrant) to provision a consis
|
|||
* Vagrant ([Download](https://www.vagrantup.com/downloads.html))
|
||||
* VirtualBox ([Download](https://www.virtualbox.org/))
|
||||
|
||||
Following steps will set up your development environment and install dependencies in a virtual machine.
|
||||
Run the following command from the project root. It starts the virtual machine and bootstraps the project.
|
||||
|
||||
1. Run `vagrant up` to start a virtual machine and bootstrap the development environment.
|
||||
2. Run `vagrant rsync-auto` to sync the files with the virtual machine.
|
||||
```
|
||||
vagrant up
|
||||
```
|
||||
|
||||
*Workflow*
|
||||
|
||||
* You can make changes to the source code from the host machine.
|
||||
* Any commands need to be run inside the virtual machine. You can connect to it by running `vagrant ssh`.
|
||||
* If you want to run tests in a WATCH mode, please do so from the host machine. We cannot watch file changes due to the limitation of file system used in a virtual machine.
|
||||
|
||||
## Server
|
||||
|
||||
|
|
@ -40,8 +42,14 @@ The server consists of the frontend web application and a web server.
|
|||
# Run tests for the frontend web application
|
||||
make test-web
|
||||
|
||||
# Run in watch mode
|
||||
WATCH=true make test-web
|
||||
|
||||
# Run tests for API
|
||||
make test-api
|
||||
|
||||
# Run in watch mode
|
||||
WATCH=true make test-api
|
||||
```
|
||||
|
||||
|
||||
|
|
|
|||
4
Vagrantfile
vendored
4
Vagrantfile
vendored
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "ubuntu/bionic64"
|
||||
config.vm.synced_folder '.', '/go/src/github.com/dnote/dnote', type: "rsync", create: true,
|
||||
rsync__args: ["--verbose", "--archive", "--delete", "-z"],
|
||||
rsync__exclude: [".git/", ".vagrant/", "web/public"]
|
||||
config.vm.synced_folder '.', '/go/src/github.com/dnote/dnote'
|
||||
config.vm.network "forwarded_port", guest: 3000, host: 3000
|
||||
config.vm.network "forwarded_port", guest: 8080, host: 8080
|
||||
config.vm.network "forwarded_port", guest: 5432, host: 5433
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ func main() {
|
|||
e = execCmd()
|
||||
|
||||
log.Printf("watching %d files", len(w.WatchedFiles()))
|
||||
if err := w.Start(time.Millisecond * 500); err != nil {
|
||||
if err := w.Start(time.Millisecond * 1000); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,4 @@ set +a
|
|||
devServerPID=$!
|
||||
|
||||
# run server
|
||||
(cd "$serverPath" && CompileDaemon \
|
||||
-command="$serverPath/server start -port $serverPort")
|
||||
(cd "$serverPath/watcher" && go run main.go)
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ module.exports = env => {
|
|||
production: false,
|
||||
test: isTest
|
||||
}),
|
||||
externals
|
||||
externals,
|
||||
watchOptions: {
|
||||
poll: 2500
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue