github.com/Azareal/Gosora@v0.0.0-20210729070923-553e66b59003/docs/installation.md (about)

     1  # Windows Installation
     2  
     3  Run `install.bat`, e.g. double-click on it. You will also have to start-up MySQL, which if you're using Wnmp or friends is just a matter of opening that program and starting the MySQL process via it.
     4  
     5  Follow the instructions shown on the screen.
     6  
     7  To navigate to the folder the software is in at any time in the future, you can just type `cd` followed by the folder's name, e.g. `cd /home/gosora/src/` and then you can run your commands. cd stands for change directory.
     8  
     9  
    10  # Linux Simple Installation
    11  
    12  Simple installations are usually recommended for trying out the software rather than for deploying it in production as they're less hardened and have fewer service facilities.
    13  
    14  This might also be fine, if you're using something else as a reverse-proxy (e.g. Nginx or Apache).
    15  
    16  First, we need somewhere for the software to live, if you're familiar with Linux, then you might have some ideas of your own, otherwise we may just go for `~/gosora`.
    17  
    18  First, we'll navigate to our home folder by typing: `cd ~`
    19  
    20  And then, we'll going to pull a copy of Gosora off the git server with: `git clone https://github.com/Azareal/Gosora gosora`
    21  
    22  We can now hop into the newly created folder with the same command we used for getting to the home folder:
    23  
    24  `cd gosora`
    25  
    26  And now, we'll change the permissions on the installer script, otherwise we'll get an access denied error:
    27  
    28  `chmod 755 ./update-deps-linux`
    29  
    30  `chmod 755 ./install-linux`
    31  
    32  Just run this to run the installer:
    33  
    34  `./install-linux`
    35  
    36  Follow the instructions shown on the screen.
    37  
    38  
    39  # Linux Installation with Systemd Service
    40  
    41  You will need administrator privileges on the machine (aka root) to add a service.
    42  
    43  First, you will need to jump to the place where you want to put the code, we will use `/home/gosora/src/` here, but if you want to use something else, you'll have to modify the service file with your own path (but *never* in a folder where the files are automatically served by a webserver).
    44  
    45  If you place it in `/www/`, `/public_html/` or any similar folder, there's a chance that your server might be compromised.
    46  
    47  The following commands will pull the latest copy of Gosora off the Git repository, will create a user account to run Gosora as, will set it as the owner of the files and will start the installation process.
    48  
    49  If you're casually setting up an installation on your own machine which isn't exposed to the internet just to try out Gosora, you might not need to setup a seperate account for it or do `chmod 2775 logs`.
    50  
    51  Please type the following commands into the console and hit enter:
    52  
    53  `cd /home/`
    54  
    55  `useradd gosora`
    56  
    57  `passwd gosora`
    58  
    59  Type in a strong password for the `gosora` user, please oh please... Don't use "password", just... don't, okay? Also, you might want to note this down somewhere.
    60  
    61  ```bash
    62  mkdir gosora
    63  
    64  cd gosora
    65  
    66  git clone https://github.com/Azareal/Gosora src
    67  
    68  chown -R gosora ../gosora
    69  
    70  chgrp -R www-data ../gosora
    71  
    72  cd src
    73  
    74  chmod 2775 logs
    75  
    76  chmod 2775 attachs
    77  
    78  chmod 2775 uploads
    79  
    80  chmod 2775 tmp
    81  
    82  chmod 755 ./update-deps-linux
    83  
    84  chmod 755 ./install-linux
    85  
    86  ./install-linux
    87  ```
    88  
    89  Follow the instructions shown on the screen.
    90  
    91  We will also want to setup a service:
    92  
    93  `chmod 755 ./pre-run-linux`
    94  
    95  `cp ./gosora_example.service /lib/systemd/system/gosora.service`
    96  
    97  `systemctl daemon-reload`
    98  
    99  
   100  # Additional Configuration
   101  
   102  For things like HTTPS, you might also need to [modify your config.json](https://github.com/Azareal/Gosora/blob/master/docs/configuration.md) file after installing Gosora to get it working.
   103  
   104  You can get a free private key and certificate pair from Let's Encrypt or Cloudflare.
   105  
   106  If you're using Nginx or something else as a reverse-proxy in-front of Gosora, you will have to consult their documentation for advice on setting HTTPS. You may also need to enable LoosePort and LooseHost in `config/config.json`.
   107  
   108  If you're behind a reverse-proxy that terminates the SSL / TLS connection, you may want to set the SslSchema config setting to true in `config/config.json` and leave EnableSsl disabled. An example of this is if the certificate is setup on the reverse-proxy rather than the instance.
   109  
   110  
   111  For email, you will need a SMTP server (either provided by yourself or by a transactional mail provider who specialises in doing so).
   112  You can setup it up via config.json with the Email setting and the ones starting with SMTP.
   113  
   114  It is possible to send emails without SMTP with the experimental sendmail plugin, however there is a high chance of your emails ending up in the user's spam folder, if it arrives at all.
   115  
   116  You may need to open a port in your firewall in order for the outside world to see your instance of Gosora.
   117  
   118  
   119  # Advanced Installation
   120  
   121  This section explains how to set things up without running the batch or shell files. For Windows, you will likely have to open up cmd.exe (the app called Command Prompt in Win10) to run these commands inside or something similar, while with Linux you would likely use the Terminal or console.
   122  
   123  For more info, you might want to take a gander inside the `./run-linux` and `./install-linux` shell files to see how they're implemented.
   124  
   125  Linux:
   126  
   127  ```bash
   128  git clone https://github.com/Azareal/Gosora gosora
   129  
   130  cd gosora
   131  
   132  go get -u github.com/mailru/easyjson/...
   133  
   134  easyjson -pkg common
   135  
   136  go get
   137  
   138  rm -f tmpl_*.go
   139  
   140  rm -f gen_*.go
   141  
   142  rm -f tmpl_client/tmpl_*.go
   143  
   144  rm -f ./Gosora
   145  
   146  rm -f ./common/gen_extend.go
   147  
   148  go generate
   149  
   150  go build -ldflags="-s -w" -o RouterGen "./router_gen"
   151  
   152  ./RouterGen
   153  
   154  go build -ldflags="-s -w" -o HookStubGen "./cmd/hook_stub_gen"
   155  
   156  ./HookStubGen
   157  
   158  go build -ldflags="-s -w" -o HookGen "./cmd/hook_gen"
   159  
   160  ./HookGen
   161  
   162  go build -ldflags="-s -w" -o QGen "./cmd/query_gen"
   163  
   164  ./QGen
   165  
   166  go build -ldflags="-s -w" -o Gosora
   167  
   168  go build -ldflags="-s -w" -o Install "./cmd/install"
   169  
   170  ./Install
   171  
   172  go get -u github.com/mailru/easyjson/...
   173  
   174  easyjson -pkg common
   175  
   176  ./Gosora -build-templates
   177  
   178  ./Gosora
   179  ```
   180  
   181  Windows:
   182  
   183  ```batch
   184  git clone https://github.com/Azareal/Gosora gosora
   185  
   186  cd gosora
   187  
   188  go get -u github.com/mailru/easyjson/...
   189  
   190  easyjson -pkg common
   191  
   192  go get
   193  
   194  del "template_*.go"
   195  
   196  del "tmpl_*.go"
   197  
   198  del "gen_*.go"
   199  
   200  del ".\tmpl_client\template_*"
   201  
   202  del ".\tmpl_client\tmpl_*"
   203  
   204  del ".\common\gen_extend.go"
   205  
   206  del "gosora.exe"
   207  
   208  go generate
   209  
   210  go build -ldflags="-s -w" "./router_gen"
   211  
   212  router_gen.exe
   213  
   214  go build -ldflags="-s -w" "./cmd/hook_stub_gen"
   215  
   216  hook_stub_gen.exe
   217  
   218  go build -ldflags="-s -w" "./cmd/hook_gen"
   219  
   220  hook_gen.exe
   221  
   222  easyjson -pkg common
   223  
   224  go build -ldflags="-s -w" "./cmd/query_gen"
   225  
   226  query_gen.exe
   227  
   228  go build -ldflags="-s -w" -o gosora.exe
   229  
   230  go build -ldflags="-s -w" "./cmd/install"
   231  
   232  install.exe
   233  
   234  gosora.exe -build-templates
   235  
   236  gosora.exe
   237  ```
   238  
   239  I'm looking into minimising the number of go gets for the advanced build and to maybe remove the platform and database engine specific dependencies if possible for those who don't need them.
   240  
   241  If systemd gives you no permission errors, then make sure you `chown`, `chgrp` and `chmod` the files and folders appropriately.
   242  
   243  You don't need `-ldflags="-s -w"` in any of the commands, however it will make compilation times faster.
   244  
   245  Building and running HookGen is optional, but strips unneccesary hook indirects for plugins you don't use.