***
 ____  _   _  ____ _____ 
/ ___|| \ | |/ ___|  ___|
\___ \|  \| | |   | |_   
 ___) | |\  | |___|  _|  
|____/|_| \_|\____|_|    
                         
 ____             _                   ____                                     
|  _ \  ___   ___| | _____ _ __      / ___|___  _ __ ___  _ __   ___  ___  ___ 
| | | |/ _ \ / __| |/ / _ \ '__|____| |   / _ \| '_ ` _ \| '_ \ / _ \/ __|/ _ \
| |_| | (_) | (__|   <  __/ | |_____| |__| (_) | | | | | | |_) | (_) \__ \  __/
|____/ \___/ \___|_|\_\___|_|        \____\___/|_| |_| |_| .__/ \___/|___/\___|
                                                         |_|                   
***

## Setting up the Nextcloud containers

# Changes in docker/compose/docker-compose.yml

Go to docker-compose.yml and change all AAAAApw to your passwords.

Then change example.org to your domain.

# Install and start docker compose

Point your domain to the public ip of your server.

Enter the command to start dockerd after installing docker on your host system:
```bash
	sudo systemctl start docker
```
Install docker-compose on your host os and in the folder docker/compose do:
```bash
	sudo docker-compose up
```

## Setting up nextcloud with deb-rust-sncf container

# Configure Nextcloud in the admin panel like in the SNCF Doku

Then open example.org in your favourite browser, 
create admin account, uncheck install recommended apps.

Do everything as described in sncf (uncheck things in settings, uninstall 
everything except forms, apporder) except the alternative custom css if you want
a save button that does nothing than reload (nextcloud does already save realtime)
but the realtime saving could be confusing for some users.

custom css code for save button:
```CSS
  #contactsmenu {
    display: none !important;
}

   
#appmenu {
   
   visibility: hidden;
   
}

#appmenu li:hover a, #appmenu li a:focus {
    font-size: 12px;
}

#appmenu li span {
   visibility: hidden;
   background-color: yellow;

}

#appmenu li svg {
   visibility: hidden;
   background-color: yellow;

}



#appmenu li a:last-child::after {
   
   
   content: "Save";
   #padding: 10px;
   #margin: 10px;
   height: 50%;
   width: 200%;
   padding-top: 7px;
   padding-right: 6px;
   #padding-bottom: 10px;
   padding-left: 10px;
   visibility: visible;
   background-color: rgba(237, 237, 237, .7);
   color: black;
   #text-shadow: 0px 0px 8px black;
   font-family: "Mono", Courier, monospace;
   font-weight: bold;
   border: 1px solid rgba(237, 237, 237, .7);
   border-radius: 15px;
   
}

#appmenu li a:last-child:hover:after  {

   background-color: rgba(237, 237, 237, 0.7);
   border: 1px solid rgba(77, 77, 77, 0.3);
   #background-color: #fbc617;
   visibility: visible;

}

#appmenu li a:last-child:focus:after  {
   
   content: "✓Save";
   background-color: rgba(237, 237, 237, 0.7);
   border: 1px solid rgba(77, 77, 77, 0.3);
   #background-color: #fbc617;
   visibility: visible;

}



#settings {
    display:none !important;
}

.app-sidebar-tabs__content > ul:nth-child(2) {
    display:none !important;
}

.app-sidebar-tabs__content > ul:nth-child(4) > li:nth-child(1) {
    display:none !important;
}

.app-sidebar-tabs__content > ul:nth-child(4) > li:nth-child(2) {
    display:none !important;
}

```

# Change nextcloud config for deb-rust-sncf


then changes (with your domain) in config.php 
(/opt/docker/overlays/nextcloud/html/config):

```PHP

 'simpleSignUpLink.shown' => false
 'defaultapp' => 'apporder'
 'trusted_domains' => 
  array (
    0 => 'nextcloud-web',
    1 => 'example.org',
  ),
'trusted_proxies' => ['traefik', 'deb-rust-sncf'],
'overwrite.cli.url' => 'http://example.org',

```
get the updated config.php in your nextcloud instance with the following command:
```bash
 docker exec -u www-data nextcloud php occ files:scan --all
```

# Change nextcloud definition in compose file and uncomment deb-rust-sncf

Then open the docker-compose.yml file, comment all labels of the container
nextcloud-web.

Now uncomment the whole deb-rust-sncf container.

If you want to customize the landing or link page, some files are exposed already
(and then copied in the container during build) in the folder build/deb-rust-sncf

Regarding the sncf proxy, the files link.html and forward.rs have changes.
These changes give the functionality to send the admin link to users mail.
Until now, the post http request and the mail adress are saved in a file on the
container deb-rust-sncf.

# Configure rust build withing deb-rust-sncf

Go to docker/build/deb-rust-sncf anyway and make changes in config.toml according
the sncf wiki.
Change the passwords AAAAA and example.org to your domain.


# Remove and restart all containers

Now stop all containers with either issuing 
```bash
	sudo docker-compose stop
```
or pressing `Ctrl-C`

Delete the WHOLE network with the command
```bash
	sudo docker system prune --all
```
Then restart with
```bash
	sudo docker-compose up 
```
in the folder docker/compose


